httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brian McQueen" <>
Subject Re: the request_rec structure in c plugins
Date Fri, 08 Sep 2006 15:43:53 GMT
Use apreq.  It reads it all in and parses it and provides the parms in
a table.  It saves you from having to writer a parser.  Its part of
the apache project too:

Here is a pseudocode sample of how to use it:

apreq_handle_t *aph;
ap_setup_client_block...error checking
ap_should_client_block...error checking

aph = apreq_handle_apache2(req);

//triggers parsing of the request body
apreq_body(aph, &body_args);

 // like a perl hash
fname_parm = apreq_param(aph, "fname");

//for an upload there is a bucket brigade full of your uploaded data
ready for you
apreq_brigade_fwrite(saved_file_handle, &bytes, fname_parm->upload);

There are many useful function in there.  Download it and check it
out.  It will make your job much easier!  apreq has its own mailing
list which is mentioned on the web site.

Brian McQueen

On 9/8/06, Sivadoss, Pradosh <> wrote:
> You can read the body data using the apache method "ap_get_client_block"
> -----Original Message-----
> From: toni pérez []
> Sent: Friday, September 08, 2006 10:42 AM
> To:
> Subject: the request_rec structure in c plugins
> hello list,
> I'm building a C plugin for apache and, I need acces to the POST DATA in the request.
> I not found which structure contains the POST DATA in the request_rec structure.
> There is the args field that contains the query string, but is for GET method, I need
the same for the POST method.
> In the headers space there are the headers fields and the post data that I need separated
by 2 enters.
> example capture by ethereal :
> ----------------------------------------------------------------------------------------------------
> POST /ejemplo.html HTTP/1.1
> Host: localhost
> User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:
> Gecko/20060523 Ubuntu/dapper Firefox/
> Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
> Accept-Language: en-us,en;q=0.5
> Accept-Encoding: gzip,deflate
> Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
> Keep-Alive: 300
> Connection: keep-alive
> Referer: http://localhost/ejemplo.html
> Content-Type: text/plain
> Content-Length: 51
> name=yourname
> mail=yourmail
> comment=yourcomment
> ------------------------------------------------------------------------------------------------
> How I can obtain the 3 fields (name,mail,comment) send by the form ?
> thanks,
> This e-mail and any attachment is for authorised use by the intended recipient(s) only.
It may contain proprietary material, confidential information and/or be subject to legal privilege.
It should not be copied, disclosed to, retained or used by, any other party. If you are not
an intended recipient then please promptly delete this e-mail and any attachment and all copies
and inform the sender. Thank you.

View raw message