At Wed, 15 Dec 2010 00:39:38 +0000,
Rui Miguel Silva Seabra wrote:
> The POST I send needs to be a POST but carries no data. Looking at the 
> code, it would seem a POST is done only when data is sent (hence my "" 
> rather than a NULL).
> 
> Talking of which, should this be applied then?
> 
> [...@roque ecore]$ svn diff src/lib/ecore_con/ecore_con_url.c
> Index: src/lib/ecore_con/ecore_con_url.c
> ===================================================================
> --- src/lib/ecore_con/ecore_con_url.c    (revision 55557)
> +++ src/lib/ecore_con/ecore_con_url.c    (working copy)
> @@ -859,7 +859,10 @@
> 
>           curl_easy_setopt(url_con->curl_easy, CURLOPT_POSTFIELDS, data);
>           curl_easy_setopt(url_con->curl_easy, CURLOPT_POSTFIELDSIZE, 
> length);
> +        curl_easy_setopt(url_con->curl_easy, CURLOPT_POST, 1L);
>        }
> +   else
> +        curl_easy_setopt(url_con->curl_easy, CURLOPT_POST, 0L);
> 
>      switch (url_con->time_condition)
>        {

(CURLOPT_POSTFIELDS already implies CURLOPT_POST)

libcurl does the following when parsing CURLOPT_POST:

    if(va_arg(param, long)) {
      data->set.httpreq = HTTPREQ_POST;
      data->set.opt_no_body = FALSE; /* this is implied */
    }
    else
      data->set.httpreq = HTTPREQ_GET;

So at first glance your patch seems to turn the POST request into a
GET one (I haven't worked on this stuff for a few months, so I might
be wrong here).

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)?

--
Raphael Kubo da Costa
ProFUSION embedded systems
http://profusion.mobi

------------------------------------------------------------------------------
Lotusphere 2011
Register now for Lotusphere 2011 and learn how
to connect the dots, take your collaborative environment
to the next level, and enter the era of Social Business.
http://p.sf.net/sfu/lotusphere-d2d
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to