curl-library
How to submit full HTTP request
Date: Thu, 17 Aug 2006 11:26:35 +0300
Hello Dan,
On Tue, Aug 15, 2006 09:20:34 -0700, Dan Fandrich wrote:
> On Tue, Aug 15, 2006 at 05:56:15PM +0300, Vladimir Davydov wrote:
>> I have full HTTP request (including request line, headers and body).
>> I need to send it to server, and to receive response via libcurl.
>> That is, in fact, I need libcurl only for _response parsing_.
>>
>> I know about CURLOPT_HTTPHEADER. It allows to set custom headers.
>> I know about CURLOPT_CUSTOMREQUEST. It allows to set custom method in
>> request line.
>> I know about CURLOPT_HTTPVERSION. It allows to set HTTP/1.0 or
>> HTTP/1.1 protocol in request line.
>> But there is no option to set request _body_.
>> HTTP/1.1 standard does not prohibit sending non-empty body in any
>> requests (including GET).
>> And, of course, there is no option to set _full already prepared
>> custom HTTP request_.
>>
>> As far as I can see for the moment, the only way to do it, is to patch
>> libcurl, and to add CURLOPT_RAWREQUEST option, which takes full HTTP
>> request as (char *) parameter.
>>
>> Can anybody give an advice ?
>> Is there a way to solve this task in more legal way (without patching
>> libcurl) ?
>
> How about setting up curl to do a normal POST or PUT transfer (which
allows
> you to send your own request body), then changing the
CURLOPT_CUSTOMREQUEST
> to GET or whatever you want?
Thank you very much. It works.
-- Vladimir Davydov.Received on 2006-08-17