cURL / Mailing Lists / curl-library / Single Mail

curl-library

Sending a body with a DELETE request

From: Nicolas Heynen <nicolas.heynen_at_ubisoft.com>
Date: Thu, 1 Nov 2012 10:47:52 -0400

Hello,
DELETE requests sent with libcurl does not seem to embed a body.

I am currently working with Curl 7.21.2. I have to send a body with a delete request when I contact a service. The HTTP/1.1 RFC2616 (part 9.7) does not seem to prevent to do so. But it seems that libcurl does not upload my json body with it. Is there a particular reason for this limitation? Is there an intent to support that in the future?

Best regards,
Nicolas Heynen

PS: As a matter of facts, I have managed to modify the code to enable that in url.c around lines 1467 :
<<<<<<< Original code:
case CURLOPT_CUSTOMREQUEST:
    /*
     * Set a custom string to use as request
     */
    result = setstropt(&data->set.str[STRING_CUSTOMREQUEST],
                       va_arg(param, char *));

    /* we don't set
       data->set.httpreq = HTTPREQ_CUSTOM;
       here, we continue as if we were using the already set type
       and this just changes the actual request keyword */
    break;
>>>>>>>>>>>>>>>>> Updated code:
  case CURLOPT_CUSTOMREQUEST:
    /*
     * Set a custom string to use as request
     */
    data->set.opt_no_body=FALSE;
    data->set.httpreq=HTTPREQ_CUSTOM;
    data->set.upload=TRUE;
    result = setstropt(&data->set.str[STRING_CUSTOMREQUEST],
          va_arg(param, char *));
    break;

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2012-11-01