You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modules-dev@httpd.apache.org by David Wortham <dj...@gmail.com> on 2007/02/23 01:15:20 UTC

Sending a POST request and handling the response from a module

Module Gurus,

My module does (among many other things) HTTP POSTs to another webserver.  I
was just told that I will have to be able to read (and deal with) data in
the response of a POST.  I believe I will only need to regurgitate the
results of the response (without the headers) into the module's/filter's
output.

My existing POST code was borrowed from ApacheBench (ab.c), which does not
appear to handle any of the response and is now much less useful to me.
Does anyone know of code that will allow me to both POST request and handle
the response data (and uses the APR libs)?

A quick search on Google Codesearch revealed that Nick (Kew) wrote a
HTTPClient.(c|h) library (used with mod_validator and possibly with
others).  Will this code do what I want?



Thanks,
David Wortham

Re: Sending a POST request and handling the response from a module

Posted by Nick Kew <ni...@webthing.com>.
On Thu, 22 Feb 2007 17:15:20 -0700
"David Wortham" <dj...@gmail.com> wrote:

> Module Gurus,
> 
> My module does (among many other things) HTTP POSTs to another
> webserver.  I was just told that I will have to be able to read (and
> deal with) data in the response of a POST.  I believe I will only
> need to regurgitate the results of the response (without the headers)
> into the module's/filter's output.
> 
> My existing POST code was borrowed from ApacheBench (ab.c), which
> does not appear to handle any of the response and is now much less
> useful to me. Does anyone know of code that will allow me to both
> POST request and handle the response data (and uses the APR libs)?
> 
> A quick search on Google Codesearch revealed that Nick (Kew) wrote a
> HTTPClient.(c|h) library (used with mod_validator and possibly with
> others).  Will this code do what I want?

Um, that's a quick&dirty hack, and likely to require significantly
more work to re-use an AN Other context.

If I were rewriting that now, I think I'd base it around a mod_proxy
subrequest instead.


-- 
Nick Kew

Application Development with Apache - the Apache Modules Book
http://www.apachetutor.org/

Re: Sending a POST request and handling the response from a module

Posted by David Wortham <dj...@gmail.com>.
While I really like Nick's response (regarding creating a subrequest through
mod_proxy), one of my supervisors doesn't like the fact that we require
mod_proxy to be installed for my module to work (took me a couple of
searches on some newsgroups to get it compiled/installed/activated myself).

I will look into Serf, but I'm not sure that I will like the results (seeing
that it is still in its infancy stages).

Thanks for the responses guys!

Regards,
Dave




Response from Nick Kew:
--
Um, that's a quick&dirty hack, and likely to require significantly
more work to re-use an AN Other context.

If I were rewriting that now, I think I'd base it around a mod_proxy
subrequest instead.
--

Response from Joachim:
--
http://code.google.com/p/serf/

might do that. Stumpled across it some days ago.
--

Re: Sending a POST request and handling the response from a module

Posted by Joachim Zobel <jz...@heute-morgen.de>.
Am Donnerstag, den 22.02.2007, 17:15 -0700 schrieb David Wortham:
> My existing POST code was borrowed from ApacheBench (ab.c), which does not
> appear to handle any of the response and is now much less useful to me.
> Does anyone know of code that will allow me to both POST request and handle
> the response data (and uses the APR libs)?

http://code.google.com/p/serf/

might do that. Stumpled across it some days ago.

Sincerely,
Joachim