You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Martin Høgedal <st...@itu.dk> on 2007/05/26 18:25:50 UTC

[users@httpd] Apache input filter

I am currently writing a Thesis with the pupose of constructing a security
module for the Apache Webserver based on information send by client
requests. To do this i need to acquire POST data when a POST request is
made, but still preserving the POST data for the content generator. I
decided to implement an input filter to carry out this task. Now the filter
is doing what is is suppose to do, but it does it at the wrong time. I seems
the filter is activated after the content generator (as an output filter)
and not before. So i tried constructing a simple input filter that in
reality does do anything. But it is still running as an outputfilter.
I made this simple input filter but the problem remains:


int do_nothing_input_filter(ap_filter_t *f, apr_bucket_brigade *bb,
ap_input_mode_t mode, apr_read_type_e block, apr_off_t readbytes){
                      request_rec *r = f->r;
                      int rv;
                      rv= ap_get_brigade(f->next,bb,mode,block,readbytes);
                      return rv;
}

static void RegisterHooks(apr_pool_t *p){
 ap_register_input_filter("do_nothing", do_nothing_input_filter, NULL,
AP_FTYPE_RESOURCE) ;
}



module AP_MODULE_DECLARE_DATA do_nothing_module = 
                      {
    STANDARD20_MODULE_STUFF,
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    RegisterHooks
};
}

(You might recognise the do_nothing_input_filter from Nick Kew’s Book).

Activating the module through httpd.conf:

SetInputFilter "do_nothing"

Writing to the log in the input filter and from the the PHP Content
generator shows that the content generator is activated before the input
filter. So how do you make an actual input filter?

Im using Apache 2.2.2 if this helps anyone.

I know this is probably a simple question for most of you but it seems tough
for me though.

This is my first try at mailinglists so hopefully I haven’t done anything
wrong.

Thank you fo your input.

Martin.




---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org