cURL / Mailing Lists / curl-library / Single Mail


Re: cURL on Windows Xp: "Content-Length Header required" error

From: Dan Fandrich <>
Date: Fri, 9 Jan 2009 23:53:47 -0800

On Sat, Jan 10, 2009 at 11:32:44AM +0530, Tanmay Anjaria wrote:
> While executing the curl_perform it come out with an error saying that
> "content-length header required" Please find the error.html file attached
> hereby.
> Can some one please let me know how this can be resolved?

What exactly is the code you're running? Obviously, the code below isn't
quite it. For one, the URL is wrong--it looks like a set of curl command-line
arguments and not just a URL. Secondly, the libcurl POST code is mostly
commented out.

Even if the code were uncommented, it wouldn't work. CURLOPT_POSTFIELDS
shouldn't hold an HTTP header like Content-Length but rather the data to
send. But that's a bad way to send a large file like a video--use a read
callback instead.

Take a look at the example program post-callback.c to see how it should be
set up.

>>> Dan

--              The web change of address service
          Let webmasters know that your web site has moved
Received on 2009-01-10