cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: libcurl, squid proxy, failing multipart post

From: Daniel Stenberg <daniel-curl_at_haxx.se>
Date: Mon, 9 May 2005 23:04:59 +0200 (CEST)

On Mon, 9 May 2005 man_at_tfhs.net wrote:

> nearly every time i add debug fprintfs, it makes the thing work, but i have
> managed to get the problem to manifest with prints in http.c, transfer.c,
> and sendf.c, and everything looks normal return values of 0 and
> bytes_transfered positive numbers all around.
>
> i am unsure just how these inter-relate, and how the processing continues,
> but Curl_readwrite keeps getting called, but does not seem to notice that
> the connect is closed?

If sread() or swrite() (they are macros and are really calling recv() and
send()) never return -1, libcurl will continue waiting for the proper amount
of data to get sent *and* received.

If recv() returns 0, it will be treated as the end of the download but libcurl
continue waiting for the upload to complete.

So, I'm kind of puzzled here since I'm looking for when/why libcurl gets the
info that the connection is gone and why it doesn't abort the operation then.

But if send() returns zero it means the socket went writable but that nothing
could be written to it. I guess that's a kind of an error we could use as
signal to bail out. The current code assumes that it will get -1 back and a
suitable errno set for that situation...

Can you see if that is the case? You can try modifying the condition in the
bottom of the Curl_write() function in lib/sendf.c (line 276 in my version).

-- 
  Commercial curl and libcurl Technical Support: http://haxx.se/curl.html
Received on 2005-05-09