cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Error 18 with -X HEAD and responses with Content-Length header set

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Sat, 16 Feb 2008 22:07:43 +0100 (CET)

On Sat, 16 Feb 2008, Fabian Keil wrote:

> 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:

[...]

> curl: (18) transfer closed with 4451 bytes remaining to read

That's not really a surprise. -X just changes the method keyword, not any
actual behaviour.

> 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.

Why isn't it pretty? And no, it doesn't prevent you from changing
capitalisation since you can use -X _and_ --head.

> 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.

Sorry, but I just don't see the need for this. All this does is remove an
ability that exists today. Although I'll admit that it is often misunderstood.

-- 
  Commercial curl and libcurl Technical Support: http://haxx.se/curl.html
Received on 2008-02-16