cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: How to submit full HTTP request

From: Dan Fandrich <dan_at_coneharvesters.com>
Date: Tue, 15 Aug 2006 09:20:34 -0700

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?

>>> Dan

-- 
http://www.MoveAnnouncer.com              The web change of address service
          Let webmasters know that your web site has moved
Received on 2006-08-15