You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Bryan Field-Elliot <br...@netmeme.org> on 2006/07/10 03:25:26 UTC
Simple API for HTTP GET?
We are building a module which, among other things, needs to do a simple
HTTP GET (or HTTPS GET) from another website. Operationally this will be
very similar to what mod_proxy does, though our module serves a
completely different purpose.
My question is, in the Apache 2.x codebase, is there a simple API call,
in any of the utility files, which can make this easier for us?
e.g. an API call such as: "char* http_get(char* url)", which could be
invoked from any module...
Thank you,
Bryan
Re: Simple API for HTTP GET?
Posted by Lai Yiu Fai <cc...@ust.hk>.
Hi,
I have asked similar question before and looking for solution sticked with
Apache 2.x codebase only. Some replied to take a look at mod_proxy_http and
mod_include module as they do the exact thing. However, it is complicated
and hard to understand up to my knowledge about Apache internal.
I agree that these HTTP/HTTPS GET API are common in module writing and
should provide handy APIs for module developer. It should be glad if
someone can give more details about the solution.
-Fai
On Sun, Jul 09, 2006 at 06:54:19PM -0700, Paul Querna wrote:
> Bryan Field-Elliot wrote:
> >We are building a module which, among other things, needs to do a simple
> >HTTP GET (or HTTPS GET) from another website. Operationally this will be
> >very similar to what mod_proxy does, though our module serves a
> >completely different purpose.
> >
> >My question is, in the Apache 2.x codebase, is there a simple API call,
> >in any of the utility files, which can make this easier for us?
> >
> >e.g. an API call such as: "char* http_get(char* url)", which could be
> >invoked from any module...
>
> I recommend that you use Serf:
> http://svn.webdav.org/repos/projects/serf/trunk/
>
> *cough* Someone still needs to make a website for Serf, but as a library
> it works quite nicely.
>
> For an example of using serf inside a module, checkout mod_serf, which
> does reverse proxying:
> http://people.apache.org/~pquerna/serf-stuff/mod_serf.c
>
> Another option is libcurl:
> http://curl.haxx.se/libcurl/
>
> The curl_easy api is quite easy. If you just want simple GETs, it might
> be the smallest lines of code to implement.
>
> -Paul
Re: Simple API for HTTP GET?
Posted by Paul Querna <ch...@force-elite.com>.
Bryan Field-Elliot wrote:
> We are building a module which, among other things, needs to do a simple
> HTTP GET (or HTTPS GET) from another website. Operationally this will be
> very similar to what mod_proxy does, though our module serves a
> completely different purpose.
>
> My question is, in the Apache 2.x codebase, is there a simple API call,
> in any of the utility files, which can make this easier for us?
>
> e.g. an API call such as: "char* http_get(char* url)", which could be
> invoked from any module...
I recommend that you use Serf:
http://svn.webdav.org/repos/projects/serf/trunk/
*cough* Someone still needs to make a website for Serf, but as a library
it works quite nicely.
For an example of using serf inside a module, checkout mod_serf, which
does reverse proxying:
http://people.apache.org/~pquerna/serf-stuff/mod_serf.c
Another option is libcurl:
http://curl.haxx.se/libcurl/
The curl_easy api is quite easy. If you just want simple GETs, it might
be the smallest lines of code to implement.
-Paul