cURL / Mailing Lists / curl-users / Single Mail

curl-users

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

From: Fabian Keil <freebsd-listen_at_fabiankeil.de>
Date: Sun, 17 Feb 2008 15:39:02 +0100

Daniel Stenberg <daniel_at_haxx.se> wrote:

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

I see, I misunderstood the man page then.

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

I would have preferred to pass all methods to curl the same way.
Of course you're right, -X + --head solves the capitalisation problem.

BTW, is the difference between "--include --head" and
"--head --include" intended?

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

No problem.

Fabian

Received on 2008-02-17