cURL / Mailing Lists / curl-library / Single Mail

curl-library

Libcurl request generating HTTP/1.1 411 Length Required error

From: Jacob Swed <gryla_at_earthlink.net>
Date: Wed, 17 Dec 2003 20:19:46 -0800

The library version being used is 7.11.0-20031217. Compiled under OS X
10.2.8 with --disable-ipv6.

When curl issues a PUT (or other custom header the pushes data) is not
including the "Content-Length" header initially. This causes a HTTP 411
Length Required error to be returned by the server. With our users it
seems to be a problem with IIS 6.0 on Windows 2003. On Windows 2000,
IIS 5.0 responds with a challenge request and when the properly
authenticated request (e.g. PUT) is reissued it does contain the
"Content-Length" header and succeeds as expected.

We do not have enough knowledge of curl to propose a fix we are sure
would not break something else. But, we suspect these lines in http.c
introduce the problem:

  if(!authdone)
       /* until the auth is done, pretend we only do GET */
       httpreq = HTTPREQ_GET;
  else
       httpreq = data->set.httpreq;

This will cause the default case to be hit in the switch statement that
follows and since that case treats the request like a GET the header is
obviously not set.

Here is the curl log illustrating the error as reported by a user
(slightly censored):

* About to connect() to xxx.xxx.xxx port 443
* Connected to xxx.xxx.xxx (xxx.xxx.xxx.xxx) port 443
* error setting certificate verify locations, continuing anyway:
* CAfile: /usr/local/share/curl/curl-ca-bundle.crt
   CApath: none
* SSL connection using RC4-MD5
* Server certificate:
* xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
* start date: 2003-08-14 23:30:43 GMT
* expire date: 2005-08-13 23:30:43 GMT
* xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
* SSL certificate verify result: 20, continuing anyway.
> PUT
/exchange/kevin/Calendar/groupcal_published_core.ics.%7B876DFCB4-B6F6-
11D7-982F-000393A56668-RID%7D.eml HTTP/1.1
User-Agent: Snerdware Groupcal/1.0 (MSIE 6.0; Windows NT 5.1)
Host: xxx.xxx.xxx
Pragma: no-cache
accept:*/*
Content-Type:message/rfc822
translate:f

< HTTP/1.1 411 Length Required
< Content-Type: text/html
< Date: Thu, 18 Dec 2003 02:33:37 GMT
< Connection: close
< Content-Length: 24
* Closing connection #0

Thank you all in advance for your help with this matter.

-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills. Sign up for IBM's
Free Linux Tutorials. Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
Received on 2003-12-18