cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: To get correct Content Length in headers

From: Dan Fandrich <dan_at_coneharvesters.com>
Date: Sat, 16 Mar 2013 21:54:24 +0100

On Sat, Mar 16, 2013 at 06:04:57PM +0530, Ajay Tanpure wrote:
>      I am using libcurl to send http post request to http server.
> I get the data from another process, Its size is variable every time.
> I add that data in POSTFIELD of the request in curl_easy_setopt() function.
>
> My data contains character '\000' so i get the different content length in
> header causing problem on server side.

From the man page for CURLOPT_POSTFIELDSIZE:

  If you want to post data to the server without letting libcurl do a strlen() to
  measure the data size, this option must be used. When this option is used you
  can post fully binary data, which otherwise is likely to fail. If this size is
  set to -1, the library will use strlen() to get the size.

>>> Dan

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2013-03-16