Filter to modify request headers

2011-01-25 Thread Jodi Bosa
Hi,

What would be a good early hook to modify request headers that is _AFTER_
mod_ssl is finished decrypting request?


When I do a ap_add_input_filter() from a ap_hook_insert_filter() seems to
trigger really late (e.g. after quick_handler, post_read, etc...).


Ideally, I would prefer working with the simpler request_rec (and headers
tables) but I suspect I need to work with bucket brigades to be able to
change/affect the actual header values for other filters/handlers and so
need to be earlier.

Thanks


Re: Filter to modify request headers

2011-01-25 Thread Ben Noordhuis
On Tue, Jan 25, 2011 at 23:22, Jodi Bosa jodib...@gmail.com wrote:
 What would be a good early hook to modify request headers that is _AFTER_
 mod_ssl is finished decrypting request?

 When I do a ap_add_input_filter() from a ap_hook_insert_filter() seems to
 trigger really late (e.g. after quick_handler, post_read, etc...).

post_read is a good place to tamper with headers, it's what mod_headers uses.

Unconditional filters should be registered with
ap_register_input_filter(), conditional filters with
ap_hook_insert_filter() and ap_hook_insert_error_filter()* +
ap_add_input_filter().

mod_ssl's input filter runs at AP_FTYPE_CONNECTION + 5 by the way, so
you're good to go if you hook at AP_FTYPE_CONNECTION + 4. But you
probably don't need to do that.

* Something of a misnomer - error_filter also runs for 204 and 3xx responses.