curl-library
Re: sending data-blocks with non-POST requests
Date: Mon, 28 Jan 2002 10:45:04 +0100 (MET)
On Sun, 27 Jan 2002, Steve Marx wrote:
> Our servers contact each other with various non-standard methods (eg COPY)
> which also contain information on the Content area of the request (like a
> POST). The only way to implement this with libcurl seems to be to use
> CURLOPT_POSTFIELDS. But then when I set the method via
> CURLOPT_CUSTOMREQUEST, the "POST" data does not get sent.
Argh! That's right, you can't actually do this... Hm, it isn't very good.
> I have experimented with various approaches including using curl_formadd()
> and trying to send the data up through a CURLOPT_READFUNCTION. None
> successful.
No, the multipart formpost is doing far too much other stuff.
> Does anyone have any suggestions?
What about doing what you explained first, use CURLOPT_POSTFIELDS to set the
data, and set COPY with the CURLOPT_CUSTOMREQUEST but apply this patch too:
--- url.c 2002/01/08 04:26:47 1.186
+++ url.c 2002/01/28 09:43:14
@@ -559,8 +559,11 @@
* Set a custom string to use as request
*/
data->set.customrequest = va_arg(param, char *);
- if(data->set.customrequest)
- data->set.httpreq = HTTPREQ_CUSTOM;
+
+ /* 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;
case CURLOPT_HTTPPOST:
/*
... and please let us know how it works!
-- Daniel Stenberg -- curl groks URLs -- http://curl.haxx.se/Received on 2002-01-28