cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Impossible to POST binary data with CURLOPT_POSTFIELDS

From: Spacen Jasset <spacenjasset_at_yahoo.co.uk>
Date: Fri, 12 Oct 2007 00:04:58 +0100

Daniel Stenberg wrote:
> On Thu, 11 Oct 2007, Dan Fandrich wrote:
>
>> - If CURLOPT_POSTFIELDSIZE *was* already set, copy that much data in
>> CURLOPT_POSTFIELDS instead of strdup().
>>
>> - If it was *not* already set, do strdup() (as now); when
>> CURLOPT_POSTFIELDSIZE is set, compare the value to the amount of data
>> actually copied. If it's equal, great. If it's not, do the copy
>> again, right this time.
>
> Yes, that's a better approach than my previous suggestion. And since the
> 7.17.0 approach is broken anyway, I think getting back to how things
> worked pre-7.17.0 is sensible. I mean, so that the lib works with code
> as it was written and working before 7.17.0.
>
> Will you do the fix? I'm running a bit short of time here...
>

I am a little confused, are we going to say that you use POSTFIELDSIZE
before setting the data? That won't be backwards compatible with old
apps since the null bytes will get in the way... Or are you going to
revert/change the code to not make a copy?

As far as I could see there was no possible fix to restore compatability
without reverting(or changing) the code for CURLOPT_POSTFIELDS back to
how it used to work -- not copying the data. -- can't even add a
var_args optional parameter becuase it's presence can't be detected.

NB - I don't personally mind what happens but it may break other
applications that use libcurl.

I am willing to sumbit a patch if you tell me what you would like done
(and it's not loads of code!)
Received on 2007-10-12