httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christian Verdelli <>
Subject Input Filter reading Body
Date Fri, 20 Oct 2006 15:03:04 GMT

-- Hi,

im writing my first simple input filters ; i need it to debug the  
request body (content of POST) coming to my Web Server before is handled
by a third party contect handler module (which corrupt data).
I simply want to print out the content of the body request sent by  
the client . I wrote this peace of code:

static int redirect_wmlInFilter (ap_filter_t* f, apr_bucket_brigade*  
ap_input_mode_t mode, apr_read_type_e block, apr_off_t readbytes) {

apr_bucket* bucket ;
apr_status_t ret ;

if ( ret = ap_get_brigade(f->next, brigade, mode, block, readbytes) ,
ret == APR_SUCCESS )
for ( bucket = APR_BRIGADE_FIRST(brigade) ;
bucket != APR_BRIGADE_SENTINEL(brigade) ;
bucket = APR_BUCKET_NEXT(bucket) )

char *data[bucket->length];
int len;
ap_log_perror(APLOG_MARK, APLOG_NOTICE, NULL, f->c->pool,
"(IN) %s %s: %d bytes - %s ", f->frec->name, t, bucket->length , data );

ap_log_perror(APLOG_MARK, APLOG_NOTICE, NULL, f->c->pool,
"(IN) %s: ap_get_brigade returned %d", f->frec->name, ret) ;

return ret ;

The filter is then registered as input filter in the  

static void redirect_wmlRegisterHooks(apr_pool_t *p) {
(webifilter,redirect_wmlInFilter,ifilter_init, AP_FTYPE_TRANSCODE );

To test it i simply post fake data with using curl : curl -v -d  

Looking at the logs the instead of seeing the content body  
nameb=valueb , here what i get :

[Fri Oct 20 00:42:40 2006] [notice] (IN)\twebicookiet20 bytes - \x01 

Maybe should i decode it before print it ??
Any suggestion will be appreciated


View raw message