cURL
Haxx ad
libcurl

curl's project page on SourceForge.net

Sponsors:
Haxx

cURL > Mailing List > Monthly Index > Single Mail

curl-tracker mailing list Archives

[ curl-Bugs-2853575 ] range support waits on keepalive timeout

From: SourceForge.net <noreply_at_sourceforge.net>
Date: Mon, 07 Sep 2009 14:23:38 +0000

Bugs item #2853575, was opened at 2009-09-07 16:13
Message generated for change (Settings changed) made by bagder
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=100976&aid=2853575&group_id=976

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: http
>Group: wrong behaviour
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Jon Nelson (jnelson)
Assigned to: Daniel Stenberg (bagder)
Summary: range support waits on keepalive timeout

Initial Comment:
If one issues a range request, the Connection: close header *should* be sent but it is not. Since the default protocol is http/1.1, what happens is that curl makes a (perfectly valid!) request without any "Connection" header, which in http/1.1 normally indicates a passive request for keep-alive. When the server is done completing the response, it will hold the socket open and wait for more requests on the same socket, typically timing out eventually and closing the socket.

Since curl does not send a "Connection: close" header with the http/1.1 request, curl will also dutifully wait until the server times out and closes the connection. This can be quite some time, although usually it's between 15 and 30 seconds.

Fix: send a "Connection: close" header when making http/1.1 requests.

Side note: when curl is used to make the same exact request *without* --range, it (curl) *closes* the connection after doing so. As an indication that it intends to do so, it really should (but this is not a bug) send a connection: close header.

Sample Request:

curl -D - --range 0-0,10-10,-30 http://.....

----------------------------------------------------------------------

>Comment By: Daniel Stenberg (bagder)
Date: 2009-09-07 16:23

Message:
Why would a range: request need a connection: close header any more than
any other request?

The fix is not that simple as you make it sound like. curl and libcurl are
designed to do requests using persistent connections so that subsequent
requests to the same host will re-use the connection. The curl tool would
need to detect that no further requests is desired to the given host and
tell that to libcurl which then would use Connection: close.

But "connection: close" when libcurl is closing the socket anyway is
rather pointless.

curl should not wait for the server to close the socket for any requests.
That's either a bug in libcurl or a bug in the server. Can you show us the
exact sent/received headers with curl 7.19.6?

----------------------------------------------------------------------

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=100976&aid=2853575&group_id=976
Received on 2009-09-07

These mail archives are generated by hypermail.

donate! Page updated November 12, 2010.
web site info

File upload with ASP.NET