cURL
Haxx ad
libcurl

curl's project page on SourceForge.net

Sponsors:
Haxx

cURL > Mailing List > Monthly Index > Single Mail

curl-tracker mailing list Archives

[ curl-Bugs-1811551 ] Impossible to post binary data with CURLOPT_POSTFIELDS

From: SourceForge.net <noreply_at_sourceforge.net>
Date: Mon, 22 Oct 2007 02:00:27 -0700

Bugs item #1811551, was opened at 2007-10-11 15:38
Message generated for change (Comment added) made by bagder
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=100976&aid=1811551&group_id=976

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: libcurl
Group: wrong behaviour
>Status: Closed
>Resolution: Fixed
Priority: 5
Private: No
Submitted By: Spacen Jasset (sjasset)
Assigned to: Daniel Stenberg (bagder)
Summary: Impossible to post binary data with CURLOPT_POSTFIELDS

Initial Comment:
For libcurl 1.17.0

On August 1st url.c was changed (Revision 1.631) to make a copy of post data so

that the caller need not keep the post buffer arround while curl operates,

unfortunatly this change has broken binary http posts since the code now does a

strdup.

See: Curl_setstropt

It isn't possible to remedy this and keep the new semantics. The options for a fix

are therefore:

0) Revert the code to do what it did before and require the buffer to be present

durring the action

1) As (0) and then add a new api to make a copy of the post data

** The following options would change the API and application compatability:

2) Change CURLOPT_POSTFIELDS to include a size parameter

3) Require CURLOPT_POSTFIELDSIZE to be called first

In my copy of libcurl I have done (3) for the moment, but I have not proper fix as

it involved changing the api or adding a new one.

To reproduce
============

I used wireshark to monitor the network traffic, and stepping into the code.

char buffer[] = "only\0the first word will get sent.";
long size = sizeof buffer;

curl_easy_setopt(curl, CURLOPT_URL, "http://<any-server>");
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, buffer, size);
curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, size);
CURLcode result = curl_easy_perform(curl);

----------------------------------------------------------------------

>Comment By: Daniel Stenberg (bagder)
Date: 2007-10-22 11:00

Message:
Logged In: YES
user_id=1110
Originator: NO

Fixed in CVS.

----------------------------------------------------------------------

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=100976&aid=1811551&group_id=976
Received on 2007-10-22

These mail archives are generated by hypermail.

donate! Page updated November 12, 2010.
web site info

File upload with ASP.NET