curl-users
Error 18 with -X HEAD and responses with Content-Length header set
Date: Sat, 16 Feb 2008 19:48:30 +0100
In a regression test tool[1] I'm using curl's -X option to send
various HTTP methods in an attempt to verify that they are accepted
or rejected as expected.
I run into problems with responses to HEAD requests:
fk@TP51 ~ $curl -D - -X HEAD http://p.p/show-request
HTTP/1.1 200 OK
Content-Length: 4451
Content-Type: text/html
Cache-Control: no-cache
Date: Tue, 12 Feb 2008 18:31:17 GMT
Last-Modified: Tue, 12 Feb 2008 18:31:17 GMT
Expires: Sat, 17 Jun 2000 12:00:00 GMT
Pragma: no-cache
Connection: close
curl: (18) transfer closed with 4451 bytes remaining to read
As a workaround, I'm currently special-casing HEAD requests
and set --head instead of -X HEAD. That isn't too pretty and
it also prevents me from changing the method's capitalisation.
The attached patch (against 7.18.0) lets curl accept responses
without body if -X HEAD is used, just like it already does for
--head and -I.
Fabian
[1] http://ijbswa.cvs.sourceforge.net/*checkout*/ijbswa/current/tools/privoxy-regression-test.pl
- text/x-patch attachment: curl-nobody.diff
- application/pgp-signature attachment: signature.asc