curl-library
Re: Impossible to POST binary data with CURLOPT_POSTFIELDS
Date: Thu, 11 Oct 2007 23:09:07 +0200 (CEST)
On Thu, 11 Oct 2007, Spacen Jasset wrote:
> For libcurl 1.17.0
That's 7.17.0, with an initial seven not a one.
> 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
Ouch, yes I can only confirm that you're of course 100% correct and I really
cannot believe I didn't see this problem before! :-(
I don't like #0, #1 or #2, and #3 would be unfortunate.
I'm thinking perhaps the best approach - which is a bit of a trade-off between
the old way and the current way - is to allow the options in any order but do
the actual memory duplication when the *perform() function is called...
Comments on this?
-- Commercial curl and libcurl Technical Support: http://haxx.se/curl.htmlReceived on 2007-10-11