httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Estrade Matthieu <>
Subject Problems with Filters and ErrorDocument
Date Fri, 28 Mar 2003 09:30:04 GMT

I'am coding a module for apache 2.0 in reverse proxy mode.
Inside this module, i have a post_read_request hook which return HTTP_OK 
or HTTP error codes like 403 or 500. For some reason, i have also error 
codes not for apache but for my log analyser, which are written in the 
error log.
for example,  3 or 4 same error codes, i will return an error 403. So 
the client will receive the same error page for all this internal error 

My aim is to insert my own document depending to the internal error code 
I coded a filter doing what follow:

Receiving the filename in f->ctx
Opening the file on hard drive.
Creating a file bucket and insert it in the HEAD of the brigade.
Creating an EOS bucket and insert it in the end of the brigade
Then, i remove my filter
pass the brigade to next filter
return status of ap_pass_brigade.

i declared this filter as an output filter, and declare it also as an 

Then i did a function to insert this filter when i encouter the internal 
error code, doing the following things:

ap_add_output_filter_handle (my error document filter handle);
creating a brigade
passing the empty brigade to the output filter.

( i looked how mod_cache do to insert the cached document).

So now, when my module is running:

in my post_read_request hook:

i see the internal error code, i launch the function inserting my custom 
error document.
Then i return the Apache error code (403).

The client receive my custom error document, and it seems to work ...
but if i do a refresh on the client browser, i will receive the apache 
error document for error 403.
So 1/2 times i receive the custom.

I think it's because when i return the 403 error code in my 
post_read_request hook, it's inserting another filter after my custom 
error document filter.
But it was really that, the client should receive the custom error 
document + apache error document both.

I also tryied to destroy the brigade received in my filter, and to 
create a new one with the file bucket and eos bucket i pass to the next 
filter. But the behaviour is the same.

Is there a way to cancel the error document filter inserting the apache 
error document ?
does somebody see what i could do and if it's possible to do what i want ?

Best regards,

Estrade Matthieu

GRAND JEU SMS : Pour gagner un NOKIA 7650, envoyez le mot IF au 61321
(prix d'un SMS + 0.35 euro). Un SMS vous dira si vous avez gagné.
Règlement :

View raw message