httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael VERGOZ" ...@binarysec.com>
Subject Re: Accessing POST request body from a module
Date Sat, 04 Feb 2006 10:24:48 GMT
Hi Phil,

At the request_handler time you may create the brigade with something like 
this :
<snip>
brigade = apr_brigade_create(r->pool, r->connection->bucket_alloc);
</snip>

----- Original Message ----- 
From: "Phil Endecott" <spam_from_apache_dev@chezphil.org>
To: <dev@httpd.apache.org>
Sent: Friday, February 03, 2006 9:26 PM
Subject: Re: Accessing POST request body from a module


> >> I am porting some CGI code to run as a module.  It is all pretty
> >> straightforward, except that I can't work out how to get at a POST
> >> request's body.
>
> Thanks to Michael for this:
>
> > while (ap_get_brigade(r->input_filters, brigade, AP_MODE_READBYTES,
> > APR_BLOCK_READ, len) == APR_SUCCESS) {
> >     apr_brigade_flatten(brigade, buf, &len);
> >     apr_brigade_cleanup(brigade);
> >     tlen += len;
> >     if (tlen == count_bytes || !len) {
> >         break;
> >     }
> >     buf += len;
> >     len = count_bytes - tlen;
> > }
>
> That looks good and I've tried something like it, but it seems to segfault 
> as soon as ap_get_brigade is called.  I'm guessing that I need to create 
> the brigade first, but apr_brigade_create has a second mysterious 
> parameter that I can't work out.  Michael, maybe you just need to post the 
> five lines before those??
>
> BTW, is there any better documentation for this than 
> http://docx.webperf.org/group__APR__Util__Bucket__Brigades.html?
>
> Nick Kew wrote:
>
> > If you had a usable-looking email address. I could reply with
> > exactly what you need
>
> I'm sorry that it doesn't look useable to you, but I can assure you that 
> it does work; it's not even filtered.  It would be quite hard to subscribe 
> to this list with a non-functioning address, I think.
>
> Regards,
>
> --Phil.
>
>
> 



Mime
View raw message