From: Raphael K. da C. <ku...@pr...> - 2010-12-17 15:51:25
|
On Friday 17 December 2010 03:49:30 Carsten Haitzler wrote: > On Thu, 16 Dec 2010 12:15:26 -0200 Raphael Kubo da Costa > <ku...@pr...> > > said: > > On Thursday 16 December 2010 06:34:29 Carsten Haitzler wrote: > > > On Wed, 15 Dec 2010 01:34:33 -0200 Raphael Kubo da Costa > > > <ku...@pr...> > > > > > > > Quoting libcurl's documentation for curl_easy_setopt: > > > > If you want to do a zero-byte POST, you need to set > > > > CURLOPT_POSTFIELDSIZE explicitly to zero, as simply setting > > > > CURLOPT_POSTFIELDS to NULL or "" just effectively disables the > > > > sending of the specified string. libcurl will instead assume that > > > > you'll send the POST data using the read callback! > > > > > > > > Doesn't it make more sense to unconditionally set at least > > > > CURLOPT_POSTFIELDSIZE in this function (if data == NULL, set it to > > > > 0)? > > > > > > i did just that :) in sv. > > > > Well, _only_ setting CURLOPT_POSTFIELDSIZE to 0 probably won't have any > > effect on its own: it doesn't automatically make the request a POST, and > > a GET will not send the 'Content-Length:' header, so it ends up being a > > NOP. > > well from what u said it seems u jjst had to set > > curl_easy_setopt(url_con->curl_easy, CURLOPT_POSTFIELDSIZE, 0); > > so u ALSO have to > curl_easy_setopt(url_con->curl_easy, CURLOPT_POSTFIELDS, NULL); > ? Yes, I think so. My concern now is how you're going to decide whether to send a GET or a POST depending only on data's value. -- Raphael Kubo da Costa ProFUSION embedded systems http://profusion.mobi |