cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Is there an interface to generate http request?

From: Dan Fandrich <dan_at_coneharvesters.com>
Date: Sun, 15 Mar 2009 21:38:33 -0600

On Sun, Mar 15, 2009 at 11:23:56PM +0800, Y.J. wrote:
> I think cURL is awesome.Programmers can do many things without worrying much
> about connection.
> But now my project should create and use connection externally.
> That means,my program will create a socket using socket(),then construct http
> request,send it to webserver using send(),then receive http response using recv
> ().
> I need an interface to construct request and output it to a buffer which can be
> the second parameter of send().
>
> I read the source code of curl_easy_perform(),it seems like that there is no
> such function.
> Does cURL provide such interface? Or how can I write one based on libcurl?

You can't do that directly with libcurl, but you can use the
CURLOPT_OPENSOCKETFUNCTION callback to pass the app's socket into libcurl so
it will start using it. It will be tricky to regain control of that
socket later if you need to but this might do the trick, depending on
exactly what you're trying to do.

>>> Dan

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