Hey Experts,    User can write content handlers for the Apache response phase. 
My purpose is to write an Apache module to intervene all response right before 
the response write back to client. Here is an example how we can do this using 
mod_perl: sub handler { my $r = shift; my $footer = "something"; return 
DECLINED unless $r->content_type() eq 'text/html'; my $file = $r->filename; 
unless (-e $r->finfo) {  $r->log_error("File does not exist: $file");  return 
NOT_FOUND; } unless (-r _) {  $r->log_error("File permissions deny access: 
$file");  return FORBIDDEN; } unless ($fh = Apache::File->new($file)) {  
$r->log_error("Couldn't open $file for reading: $!");  return SERVER_ERROR; } 
$r->send_http_header; while (<$fh>) {  s!(</BODY>)!$footer$1!oi; } continue {  
$r->print($_); } return OK;} As you can see, I have to open the actual file 
before do anything. This approach doesn't work if the requested URI doesn't 
correspond to real file in the OS or the request file should be parsed before 
sending out, such as PHP source file. Is there a way to build such an Apache 
module which can intervene all response right before it being sent to client in 
any cases?    Any ideas are highly appreciated.  Thanks,Yushui
_________________________________________________________________
手机也能上 MSN 聊天了,快来试试吧!
http://mobile.msn.com.cn/

Reply via email to