cURL
Haxx ad
libcurl

curl's project page on SourceForge.net

Sponsors:
Haxx

cURL > Mailing List > Monthly Index > Single Mail

curl-tracker Archives

[ curl-Bugs-3542731 ] curl closes connection after HEAD request fails

From: SourceForge.net <noreply_at_sourceforge.net>
Date: Wed, 11 Jul 2012 13:56:44 -0700

Bugs item #3542731, was opened at 2012-07-11 13:56
Message generated for change (Settings changed) made by edolstra
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=100976&aid=3542731&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: libcurl
>Group: bad behaviour
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Eelco Dolstra (edolstra)
Assigned to: Daniel Stenberg (bagder)
Summary: curl closes connection after HEAD request fails

Initial Comment:
Curl 7.26.0 will close an HTTP connection instead of reusing it, when doing a HEAD request and the resulting header does not include a Content-Length or "Transfer-Encoding: chunked" header. This is unnecessary because there is no message body. The HTTP 1.1 spec says that "In order to remain persistent, all messages on the connection MUST have a self-defined message length" and a HEAD request by definition has a message length of 0.

The attached patch causes libcurl to reuse connections after a HEAD request regardless of whether Content-Length etc. are returned. Tested against Apache 2.2.22.

Example of the problem (note "no chunk, no close, no size. Assume close to signal end"):

$ curl -v --head http://nixos.org/foo1 http://nixos.org/foo2
* About to connect() to nixos.org port 80 (#0)
* Trying 130.161.158.181...
* connected
* Connected to nixos.org (130.161.158.181) port 80 (#0)
> HEAD /foo1 HTTP/1.1
> User-Agent: curl/7.26.0
...
< HTTP/1.1 404 Not Found
HTTP/1.1 404 Not Found
< Date: Wed, 11 Jul 2012 20:47:29 GMT
Date: Wed, 11 Jul 2012 20:47:29 GMT
< Server: Apache/2.2.22 (Unix) DAV/2 mod_ssl/2.2.22 OpenSSL/1.0.0i PHP/5.3.14 SVN/1.7.5
Server: Apache/2.2.22 (Unix) DAV/2 mod_ssl/2.2.22 OpenSSL/1.0.0i PHP/5.3.14 SVN/1.7.5
< Vary: accept-language,accept-charset
Vary: accept-language,accept-charset
< Accept-Ranges: bytes
Accept-Ranges: bytes
< Content-Type: text/html; charset=iso-8859-1
Content-Type: text/html; charset=iso-8859-1
< Content-Language: en
Content-Language: en
* no chunk, no close, no size. Assume close to signal end
...
* Closing connection #0
* About to connect() to nixos.org port 80 (#0)
...

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

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

These mail archives are generated by hypermail.

donate! Page updated January 05, 2012.
web site info

File upload with ASP.NET