curl-library
Re: Strange behavior of CURLOPT_POSTFIELDS
Date: Mon, 17 Dec 2012 15:31:11 -0600
On Mon, Dec 17, 2012 at 3:11 PM, Daniel Stenberg <daniel_at_haxx.se> wrote:
> On Mon, 17 Dec 2012, Jeff Pohlmeyer wrote:
>
>>> if I have a const char* string literal in CURLOPT_POSTFIELDS it works. If
>>> it's not coming from a literal, it fails.
>>
>>
>> Are you using a local variable to store the paramsString? I think that
>> won't work, the string must remain in scope until curl_easy_perform()
>> returns.
>
>
> ... at least if a version earlier than 7.17.0 is used. After that version
> libcurl copies provided strings.
The man page for CURLOPT_POSTFIELDS ( version 7.28.1 ) says:
"The pointed data are NOT copied by the library: as a consequence,
they must be preserved by the calling application until the transfer
finishes."
-Jeff
http://curl.haxx.se/libcurl/c/curl_easy_setopt.html#CURLOPTPOSTFIELDS
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2012-12-17