On Mon, Nov 17, 2008 at 1:49 PM, Piotr Dobrogost <curlpp_at_2008.autoera.pl>wrote:
> Jean
>
> In example 12 you have this
>
> request.setOpt(new cURLpp::Options::PostFields("abcd"));
> request.setOpt(new cURLpp::Options::PostFieldSize(5));
This question is more specific to libcURL, so you might want to ask in
libcURL's mailing-list. However looking at the documentation,
it seems that using strlen would be enough. So,
request.setOpt(new cURLpp::Options::PostFields("abcd"));
request.setOpt(new cURLpp::Options::PostFieldSize(4));
Would be alright.
>
> Why is PostFieldSize set to 5? Do you have to take into account null
> terminated string used by libcurl?
>
> And do you know why in libcurl's tutorial (
> http://curl.haxx.se/libcurl/c/libcurl-tutorial.html) in this example
>
> struct curl_slist *headers=NULL;
> headers = curl_slist_append(headers, "Content-Type: text/xml");
>
> /* post binary data */
> curl_easy_setopt(easyhandle, CURLOPT_POSTFIELDS, binaryptr);
>
> /* set the size of the postfields data */
> curl_easy_setopt(easyhandle, CURLOPT_POSTFIELDSIZE, 23L);
>
> /* pass our list of custom made headers */
> curl_easy_setopt(easyhandle, CURLOPT_HTTPHEADER, headers);
>
> curl_easy_perform(easyhandle); /* post away! */
>
> curl_slist_free_all(headers); /* free the header list */
>
> they set CURLOPT_POSTFIELDSIZE to 23? They don't show in this example the
> data pointed to by binaryptr.
> Strange enough the length of Content-Type header is exactly 23 but this is
> only a coincidence, isn't it?
>
> Regards
> Piotr Dobrogost
> _______________________________________________
> cURLpp mailing list
> cURLpp_at_rrette.com
> http://www.rrette.com/mailman/listinfo/curlpp
>
_______________________________________________
cURLpp mailing list
cURLpp_at_rrette.com
http://www.rrette.com/mailman/listinfo/curlpp
Received on 2008-11-17