cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: How bad is "Empty reply from server" ?

From: jérôme Muffat-Méridol <jmuffat_at_webphotomag.com>
Date: Fri, 15 Feb 2008 11:21:53 +0100

yes, premature is true.

Now, looking in detail, this patch doesn't accomplish anything:

1) It avoids calling failf, which only affects stderr
2) it returns CURLE_GOT_NOTHING instead of CURLE_OK.
    this gets returned to Curl_done which doesn't it (but forwards to
the caller).
    Caller is curl_multi_remove_handle which ignores Curl_done's
return value altogether.

I'm going to try and write a sample that:
 - sends a request to a server through an easy in a multi
 - performs
 - removes the easy from the multi, and cleans the easy
 - sends a new request to the same server for a new file, with a new
easy in the same multi
 - performs until done.

see what I get. I think this is the precise scenario.

On Thu, Feb 14, 2008 at 10:32 PM, Daniel Stenberg <daniel_at_haxx.se> wrote:
> On Thu, 14 Feb 2008, jérôme Muffat-Méridol wrote:
>
> > If one of my objects is destroyed while downloading, it attempts to
> > cancel it by calling:
> > - curl_multi_remove_handle (which seems to do the actual cancelling)
> > - curl_easy_cleanup
> >
> > This works well, except in one case : if I cancel a request between
> > the time it was sent to the HTTP server and the time we have received
> > something back.
> >
> > I'm getting a failf(data, "Empty reply from server");
> > in Curl_http_done (because readbytecount==0, headerbytecount==0 and
> > deductheadercount==0)
> > coming from the call "conn->handler->done" in Curl_done
> > coming from curl_multi_remove_handle
>
> When this is done, the argument 'premature' is set TRUE isn't it?
>
> I really think a correct fix is to not do the do "Empty reply"-check if this
> is done prematurely, since it makes little sense warning for no content when
> the transport was deliberately cancelled.
>
> IOW, please tell us if this patch fixes the problem for you!
>
> --- lib/http.c 31 Jan 2008 12:04:33 -0000 1.360
> +++ lib/http.c 14 Feb 2008 21:31:30 -0000
> @@ -1832,7 +1832,8 @@
> if(status != CURLE_OK)
> return (status);
>
> - if(!conn->bits.retry &&
> + if(!premature &&
> + !conn->bits.retry &&
> ((http->readbytecount +
> data->req.headerbytecount -
> data->req.deductheadercount)) <= 0) {
>
>
> --
> Commercial curl and libcurl Technical Support: http://haxx.se/curl.html

-- 
___________________________________________
Jérôme Muffat-Méridol - www.gpuViewer.com
Received on 2008-02-15