cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Digest, HEAD, no Content-Length

From: Daniel Stenberg <daniel-curl_at_haxx.se>
Date: Thu, 16 Sep 2004 22:42:22 +0200 (CEST)

On Thu, 16 Sep 2004, Bob Bob wrote:

> When using Digest authentication and doing a POST request with a body that
> is read from file (read callback), libcurl first posts a HEAD request to
> handle the authentication.

It does this no matter how the POST data is read.

> This HEAD request does not contain a Content-Length.

HEAD requests never do and never should.

> According to RFC2616 (HTTP 1.1):
>
> "The Content-Length entity-header field indicates the size of the
> entity-body, in decimal number of OCTETs, sent to the recipient or, in the
> case of the HEAD method, the size of the entity-body that would have been
> sent had the request been a GET."

This is what the server side needs to consider, yes, as the server is what
sends the Content-Length: header - even for HEAD.

> Is this a bug in libcurl or is there a reason to omit it? The server with
> which we try to comunicate returns "411 Length Required".

I think you're doing a POST without 1) having specified the
CURLOPT_POSTFIELDSIZE or 2) having enabled chunked-transfer encoding.

I don't think this is a bug.

If you think differently, then please provide some detailed -v or --trace
outputs for us to analyze!

-- 
      Daniel Stenberg -- http://curl.haxx.se -- http://daniel.haxx.se
       Dedicated custom curl help for hire: http://haxx.se/curl.html
Received on 2004-09-16