Re: Silly Newbie Question: cookies and such
On Tue, 13 Nov 2001 04:28, you wrote: > I need to make an Apache module (not a Registry script) which will: > > 1. Check for a cookie, and if not there, pushhandler to a module for > logging in (keeping the original request at hand for use after they > succeed in logging in). > 2. Extract data from the cookie (encrypted for security?) > 3. Based on data from both the query string ($r->args?) and from data in > the cookie, pushhandler to another module. > > I have looked at Apache::AuthCookie - it didn't seem to make much sense > to me. Apache::Session looks promising, but the instructions don't say > how to set up the mysql tables, etc. My worst problem is that I haven't > had occasion to deal with cookies much (setting, checking,etc.) in the > past and I know this is hampering my understanding. You should definately be using Auth::Cookie for this. I would give the docs another read. It took me a couple of tries to get it working successfully, but I have implemented it in about 4 or 5 applications, and it works flawlessly. With Auth::Cookie it will handle the cookies for you, it will do the redirection to your login page for you, and it can handle logouts as well (by expiring the cookie). As for Apache::Session, it is really just a keyed data store with expiry times. You give it some data, and it gives you a key. If you come back later and give it the same key, it gives you back your data. A lot of people use Auth::Cookie and Apache::Session together to build a session management system, but I prefer just using a ticket based system with Auth::Cookie alone (See the Eagle book on how to do ticket based authentication). I have included a sample Auth::Cookie implementation that might give you some ideas. It is not complete, but it might get you going (I have stripped out some of the irrelevant code, so it probably won't work out of the box). Also you will have to provide your own login.pl and logout.pl scripts (I would use the examples that come with Auth::Cookie until you get a working system, then you can look at building your own. > In conclusion: I'm making a system/site where no .html files even exist. > I need to handle security via a mysql db, and to push handlers based on > a part of the url and a piece of the cookie which identifies the user as > either a teacher, student, or parent (oops... I gave it away ;-) After Auth::Cookie has finished it's phase, it will set the REMOTE_USER environment variable to the user that logged in. You could just as easily set this to 'teacher' or whatever. Then your content handler can look at this variable and decide what to do. HTH Cees package My::Auth::AuthCookie; require 5.000; use strict; use Apache::AuthCookie; use My::Crypt; @My::Auth::AuthCookie::ISA = qw(Apache::AuthCookie); # ## # There are far more secure ways of handling the passphrase then keeping it in # the actual code, but this is by far the easiest... sub SECRET () { 'No one will ever guess this passphrase :)'; } my $CRYPTER ||= new My::Crypt; # This utility just uses the Crypt::CBC and # Storable modules to encrypt and decrypt perl # data structures. It also does an MD5 checksum sub authen_cred ($$\@) { my $self = shift; my $r = shift; my @creds = @_; # # get the entered details # my $email= $creds[0]; my $password = $creds[1]; # # ensure that the user is valid and authorized... # right now it accepts any email and password combo, # so obviously you would check this in a database or # something # if ($email && $password) { return $self->makeTicket($r, $email); } else { return; } } sub authen_ses_key ($$$) { my $self = shift; my $r = shift; my $ticket = shift; # # verify the ticket (to make sure no-one has tampered with it and it hasn't expired etc...) # my ($result, $message) = $self->verifyTicket($r, $ticket); # # Check the result and act appropriately... # if (!$result) { # $r->log->error("Browser returned bad cookie ($message)"); return undef; } else { # # Make and set a new cookie (so that the 'time' in the cookie is updated and expires # works as expected - since last access etc...) # my $new_ticket = $self->makeTicket($r, $message); $self->send_cookie($new_ticket); # # Return the 'message/string' which will be set in the environment # under REMOTE_USER (aka.. $ENV{REMOTE_USER}). In our case that is
Re: Apache::Sandwich, etc
On Mon, 12 Nov 2001, Mark Maunder wrote: > Jie Gao wrote: > > > Hi All, > > > > I am wondering if it is possible to add a footer to dynamic pages, > > server-wide, like the subject module does to static pages. > > > > One apparent way to me is to add another content handler, but > > I am not sure how that'll work. > > > > Any suggestion is appreciated. > > > > Jie > > When you say 'dynamic pages' what do you mean? Are you using standard > CGI scripts under Apache::Registry? Or have you written your app as > handlers? > > If you've written your app as a handler, then If you're going to use > Multiple handlers that each contribute content to the final document > (i.e. first hander processes the request and the second adds header and > footer info), you should check out Apache::Filter. On 12 Nov 2001, Vivek Khera wrote: > Date: 12 Nov 2001 12:26:41 -0500 > From: Vivek Khera <[EMAIL PROTECTED]> > To: [EMAIL PROTECTED] > Newsgroups: ml.apache.modperl > Subject: Re: Apache::Sandwich, etc > > > "JG" == Jie Gao <[EMAIL PROTECTED]> writes: > > JG> I am wondering if it is possible to add a footer to dynamic pages, > JG> server-wide, like the subject module does to static pages. > > Apache::Sandwich will work with whatever content handler you want, > including dynamic ones. See the docs. What I am trying to do is to add a footer to the _html_ output by perl scripts running under perl_run. After delving into the camel book, I found I could try "stacked handler pipelining". I need to find out first what content type the script output is, and if it is html, the footer will be added. I'll give the idea a go now. Thanks for the replies. Regards, Jie
Re: xml parsing under mod_perl segfaults
For the record, I was unsuccessful using Apache 1.3.22, configured to use the "system" expat library, with XML::Parser 2.30. In the end I switched to using XML::LibXML. Matthew H. Gerlach Matt Sergeant wrote: > > -Original Message- > > From: Artem Litvinovich [mailto:[EMAIL PROTECTED]] > > > > Please reply if you are aware of a fix for this problem or a > > workaround for > > parsing XML under mod_perl. (a fix that does not require > > apache recompilation > > would be ideal) > > 1) Use XML::LibXML > 2) Use XML::SAX::PurePerl (which is slower, but still works) > 3) Upgrade Apache to 1.3.22 and use XML::Parser 2.30 > > Unfortunately none of those yet support your SimpleObject, but I've sent a > patch/update of XML::Handler::Trees to Eric Bohlman, which will allow you to > use that. Email me if you want a copy that'll allow you to work with > XML::SAX::PurePerl. > > Matt. > > _ > This message has been checked for all known viruses by Star Internet > delivered through the MessageLabs Virus Scanning Service. For further > information visit http://www.star.net.uk/stats.asp or alternatively call > Star Internet for details on the Virus Scanning Service.
Re: [OT] dont understand mem-mapping
At 10:19 AM +0800 11/12/01, Stas Bekman wrote: > >2. apparently you have the same problem as 'too many connections' >problem, and therefore want to look at Apache::DBI for understanding >the problem and coming up with a similar solution for your problem. I had similar problems, and unforunatly couldn't use Apache::DBI (multiple databases and too many open connections), but Pools in apache/mod_perl 2.0 look like they might be the solution... even if they are a ways off... Good luck, Rob -- "Only two things are infinite: The universe, and human stupidity. And I'm not sure about the former." --Albert Einstein
Silly Newbie Question: cookies and such
Unfortunatly, I find myself with a silly newbie question: I need to make an Apache module (not a Registry script) which will: 1. Check for a cookie, and if not there, pushhandler to a module for logging in (keeping the original request at hand for use after they succeed in logging in). 2. Extract data from the cookie (encrypted for security?) 3. Based on data from both the query string ($r->args?) and from data in the cookie, pushhandler to another module. I have looked at Apache::AuthCookie - it didn't seem to make much sense to me. Apache::Session looks promising, but the instructions don't say how to set up the mysql tables, etc. My worst problem is that I haven't had occasion to deal with cookies much (setting, checking,etc.) in the past and I know this is hampering my understanding. Can anyone give me a general overview (use this module, this way, etc.)? I'm not totally new to Apache Modules, but my experience is gleaned from writing modules already pushed into the handler stack by PerlTransHandlers written by someone else. I don't want to use PerlTransHandler, just PerlHandler, so I can use in perl.conf. In conclusion: I'm making a system/site where no .html files even exist. I need to handle security via a mysql db, and to push handlers based on a part of the url and a piece of the cookie which identifies the user as either a teacher, student, or parent (oops... I gave it away ;-) Jonathon Robison
Re: Apache::Sandwich, etc
> "JG" == Jie Gao <[EMAIL PROTECTED]> writes: JG> I am wondering if it is possible to add a footer to dynamic pages, JG> server-wide, like the subject module does to static pages. Apache::Sandwich will work with whatever content handler you want, including dynamic ones. See the docs. -- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Vivek Khera, Ph.D.Khera Communications, Inc. Internet: [EMAIL PROTECTED] Rockville, MD +1-240-453-8497 AIM: vivekkhera Y!: vivek_khera http://www.khera.org/~vivek/
Re: open-source suggestion for a knowledge-base/search engine?
Grant Babb <[EMAIL PROTECTED]> wrote: >--=_3114418==_.ALT >Content-Type: text/plain; charset="us-ascii"; format=flowed > > >>all- >> >> In our migration to open-source solutions, I have been asked to >> suggest a solution for our knowledge base. We have found that a >> well-indexed text search is really a more effective way to go, but I was >> hoping for some suggestions from this list on some mod_perl based >> projects or apache modules that might do the the trick. PHP is OK too i >> guess, but when it comes to both fast lookups and text manipulation, >> mod_perl/mySQL seemed like the obvious way to go. You're welcome to look at (and contribute to :) the PerlKB project: http://sourceforge.net/projects/perlkb/ It's still in the fairly early stages right now - most work is on the data store/management than on a web interface. If you are interested, you might also want to look at the template toolkit documentation list - some of the discussion there may affect the PerlKB implementation. My current work on the PerlKB involves categorization of documents and presenting that to the user - should have more on that after next week (deadline for Usenix tech. conference submissions :). Neither of these are ready for production at this point. If you need something *now*, then I'd look elsewhere (not necessarily for non-mod_perl solutions, just not this one). -- James Smith <[EMAIL PROTECTED]>, 979-862-3725 Texas A&M CIS Operating Systems Group, Unix
Re: open-source suggestion for a knowledge-base/search engine?
If you may use PostgreSQL as a database engine, there is an OpenFTS (openfts.sourceforge.net). I'm one of the author, so I'm biased a little bit, but we have successfully use it in many projects with close integration with mod_perl (Mason). regards, Oleg On Mon, 12 Nov 2001, Grant Babb wrote: > > >all- > > > > In our migration to open-source solutions, I have been asked to > > suggest a solution for our knowledge base. We have found that a > > well-indexed text search is really a more effective way to go, but I was > > hoping for some suggestions from this list on some mod_perl based > > projects or apache modules that might do the the trick. PHP is OK too i > > guess, but when it comes to both fast lookups and text manipulation, > > mod_perl/mySQL seemed like the obvious way to go. > > > >thanks in advance for the input, > >grant > > > >Grant Babb Email: [EMAIL PROTECTED] > >Data Junction Corporation Phone: (512) 459-1308 > >2201 Northland Dr. Fax: (512) 459-1309 > >Austin, TX 78756-1117 Web: http://www.datajunction.com > > > > Grant Babb Email: [EMAIL PROTECTED] > Data Junction Corporation Phone: (512) 459-1308 > 2201 Northland Dr. Fax: (512) 459-1309 > Austin, TX 78756-1117 Web: http://www.datajunction.com > > > Regards, Oleg _ Oleg Bartunov, sci.researcher, hostmaster of AstroNet, Sternberg Astronomical Institute, Moscow University (Russia) Internet: [EMAIL PROTECTED], http://www.sai.msu.su/~megera/ phone: +007(095)939-16-83, +007(095)939-23-83
open-source suggestion for a knowledge-base/search engine?
all- In our migration to open-source solutions, I have been asked to suggest a solution for our knowledge base. We have found that a well-indexed text search is really a more effective way to go, but I was hoping for some suggestions from this list on some mod_perl based projects or apache modules that might do the the trick. PHP is OK too i guess, but when it comes to both fast lookups and text manipulation, mod_perl/mySQL seemed like the obvious way to go. thanks in advance for the input, grant Grant Babb Email: [EMAIL PROTECTED] Data Junction Corporation Phone: (512) 459-1308 2201 Northland Dr. Fax: (512) 459-1309 Austin, TX 78756-1117 Web: http://www.datajunction.com Grant Babb Email: [EMAIL PROTECTED] Data Junction Corporation Phone: (512) 459-1308 2201 Northland Dr. Fax: (512) 459-1309 Austin, TX 78756-1117 Web: http://www.datajunction.com
[OT] AxKit: We're Back!
-- Forwarded message -- Date: Mon, 12 Nov 2001 07:12:00 + (GMT) From: Matt Sergeant <[EMAIL PROTECTED]> To: AxKit Users Mailing List <[EMAIL PROTECTED]> Subject: [OT] AxKit: We're Back! Well, after around 12 or 13 weeks outage, axkit.org, axkit.com, and (less disconcerting) sergeant.org are now back, and alive and well. This means the axkit mailing lists are back. http://axkit.org/ PS: If you can't get there just yet, your DNS may not have propogated yet. It works from some places I've confirmed though, so it should be with you in 24 hours. To see the tale of what happened in all its glory, visit: http://axkit.org/cgi-bin/ezmlm-cgi?3:mss:2585:200111:oklpechdncnncgcbigoh -- /||** Founder and CTO ** ** http://axkit.com/ ** //||** AxKit.com Ltd ** ** XML Application Serving ** // ||** http://axkit.org ** ** XSLT, XPathScript, XSP ** // \\| // ** mod_perl news and resources: http://take23.org ** \\// //\\ // \\
Re: Internal server error on Refreshing mod_perl page ( Apache::ASP )
Thanks alot Joshua, You ar right, by turning off the PerlTaintCheck , PerlTaintCheck Off in my httpd.conf. It's fixed. >>My dev versions of Apache::ASP ( 2.29 ) & MLDBM::Sync ( .25 ) >>will be able to run under PerlTaintCheck On, let me know if you >>would like these pre release. And I would like to have the Apache::ASSP(2.29) &MLDBM::Sync(.25). because I want to work with Apache::ASP, by having the PerlTaintCheck On. Please give me guidance. Once again thanks. -SubbaReddy - Original Message - From: "Joshua Chamas" <[EMAIL PROTECTED]> To: "SubbaReddy M" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Saturday, November 10, 2001 2:24 PM Subject: Re: Internal server error on Refreshing mod_perl page ( Apache::ASP ) > > SubbaReddy M wrote: > > > > Hello Gurus, > > > > [Sat Nov 10 11:54:32 2001] [error] Insecure dependency in eval while running with -T switch at > > /usr/lib/perl5/site_perl/5.6.1/MLDBM/Serializer/Data/Dumper.pm line 51. > > MLDBM::Serializer::Data::Dumper::deserialize('MLDBM::Serializer::Data::Dumpe r=HASH(0x843bd20)', '$MlDbM{\'timeout\' => \'1005374203\'}') > > called at /usr/lib/perl5/site_perl/5.6.1/MLDBM.pm line 155 > > MLDBM::FETCH('MLDBM=HASH(0x843bd08)', '07abbd5f03d200c6bac27a861f47e35e') called at /usr/lib/perl5/site_perl/5.6.1/MLDBM/Sync.pm line 85 > > MLDBM::Sync::AUTOLOAD('MLDBM::Sync=HASH(0x843a838)', '07abbd5f03d200c6bac27a861f47e35e') called at > > > This error comes from the mod_perl config: PerlTaintCheck On > You can see more on this error at: > > http://www.apache-asp.org/faq.html#Insecure%20depec6cd400 > > I would not recommend trying to get Apache::ASP to run under > PerlTaintCheck as its been a while since the author ( me ) > has done so, so there will likely be other errors in doing so > than what's listed in the above FAQ item. So find the config > in your system *.conf files and turn it off for now. > > Future Apache::ASP support queries should be emailed to the > email list specific to it. You can subscribe to it at > > [EMAIL PROTECTED] > > --Josh > > _ > Joshua Chamas Chamas Enterprises Inc. > NodeWorks Founder Huntington Beach, CA USA > http://www.nodeworks.com1-714-625-4051 >
asp perl problem
Hi I am new to perl and would like to make a asp page with a script that will find all files in a given directory and create links to different files in another directory. The two sets of files are images (thumbnails and big pics) so I would also like to show the thumbnails on the page and have the links to the bigger pics. I already have all the images and do not need a thumbnail generator. I just want it so that when I add new images thats it. I am not asking for a complete answer only a pointer towards which functions would best do this job etc. Any help you can give would be great. Ju. This e-mail, and any attachment, is confidential. If you have received it in error, please delete it from your system, do not use or disclose the information in any way, and notify me immediately.
Apache::OutputChain vs. Apache::Filter
Just out of curiosity, which of these two modules are more popularly used? I have to make some sort of inline SSI processing in one of my modules, and am curious to know how other people do it... I know that different people will do different things depending on the situation, and that there's really no "Generic" answer, but am still curious to hear how others do this kind of thing... Issac Internet is a wonderful mechanism for making a fool ofyourself in front of a very large audience. --Anonymous Moving the mouse won't get you into trouble... Clicking it might. --Anonymous PGP Key 0xE0FA561B - Fingerprint:7E18 C018 D623 A57B 7F37 D902 8C84 7675 E0FA 561B
Re: dont understand mem-mapping
Peter Pilsl wrote: > I just cant get the following in my brain. I have a modules that is > started with apache using the PerlModule-directive in httpd.conf. > > This module defines a global pointer on startup that should be the > same in all sub-instances of httpd and really in the current > apache-session all instances print out : $g_ptr : HASH(0x8458a30) > > This hashpointer is later filled with different values (dbhandles, > filehandles ...) that should kept open over more calls. > > Now each session has the same pointer, but the content of the > anonymous hash its pointing too is different in each instance !! > > thread 1: > $g_ptr : HASH(0x8458a30) > $g_ptr->{counter} : SCALAR(0x85aa62c) > > thread 2: > $g_ptr : HASH(0x8458a30) > $g_ptr->{counter} : SCALAR(0x85f5e2c) > > A even more strange example is an anonmous array that has the same > adress, but different content too. > > The only explanation is that there is some mem-mapping for each > httpd-instance, but I dont know much about this. > > My problem now is, that each httpd-instance opens a lot of db-handles > and connections and I end up with system-errors 'to many files opened' > or such things. > > Is there any way to share handles between all instances (I guess not, > and I'm sure this mem-mapping has a deeper meaning too: if more than > one instance access the same adress at the same time there would be > lot of troubles and I'm even more sure that this has something to do > with the copy-on-write feature of fork(), but I'm just not good in > this things, so I'd like to have some comment to be sure that this is > a principal problem and not a problem of my module) Peter, in the future posts please consider the following: 1. in perl we don't have pointers, but references. I think you'll be more understood if you talk using the Perl terminology, rather than C. 2. it helps to diagnose a problem when a *short* (a few lines) code example is shown, rather than just describing the symptoms. This should give you directions to understanding your problem and solving it: 1. forked children share the same datastructure with a parent until they get modified. When this happens a copy on write occurs and the child process doesn't share the datastructure anymore. See: http://perl.apache.org/guide/performance.html#Know_Your_Operating_System 2. apparently you have the same problem as 'too many connections' problem, and therefore want to look at Apache::DBI for understanding the problem and coming up with a similar solution for your problem. _ Stas Bekman JAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide http://perl.apache.org/guide mailto:[EMAIL PROTECTED] http://ticketmaster.com http://apacheweek.com http://singlesheaven.com http://perl.apache.org http://perlmonth.com/
Can't install Apache::Request on Linux
I suspect all this is is a path problem, but I'm not sure where to stuff the appropriate line With: Linux 2.2.17 on x86 Apache 1.3.19 Perl 5.6.1 mod_perl 1.26 I can't install Apache::Request using either CPAN.pm or manually. Both give the error: Request.xs:40 mod_perl.h: No such file or directory just after attempting to compile Request.c mod_perl.h is present in /usr/local/apache/src/modules/perl/ Where do I need to stick the option to make the makefile include the correct paths? Thanks in advance.
Re: xml parsing under mod_perl segfaults
On Mon, 12 Nov 2001, Artem Litvinovich wrote: > Since my freeBSD setup is a "virtual private server" from verio I > cannot easily recompile+reinstall apache. I have a virtual private server account from Verio too. What you could do, is compile your own Apache and run it on a high port, then setup ProxyPass or RewriteRule [P] so that the Apache on port 80 (that you can't recompile) just proxies to the one on the high port. That's probably better from a performance point of view too - if you serve static content (e.g. JPG files) on your website, it costs less resources to have a non-mod_perl frontend to serve the graphics for you. (If your site doesn't get that much traffic it's not so important, of course.)
[OT] AxKit: Back online
This post doesn't seem to have hit the list: -- Forwarded message -- Date: Mon, 12 Nov 2001 07:12:00 + (GMT) From: Matt Sergeant <[EMAIL PROTECTED]> To: AxKit Users Mailing List <[EMAIL PROTECTED]> Subject: [OT] AxKit: We're Back! Well, after around 12 or 13 weeks outage, axkit.org, axkit.com, and (less disconcerting) sergeant.org are now back, and alive and well. This means the axkit mailing lists are back. http://axkit.org/ PS: If you can't get there just yet, your DNS may not have propogated yet. It works from some places I've confirmed though, so it should be with you in 24 hours. To see the tale of what happened in all its glory, visit: http://axkit.org/cgi-bin/ezmlm-cgi?3:mss:2585:200111:oklpechdncnncgcbigoh Matt. -- <:->Get a smart net _ This message has been checked for all known viruses by Star Internet delivered through the MessageLabs Virus Scanning Service. For further information visit http://www.star.net.uk/stats.asp or alternatively call Star Internet for details on the Virus Scanning Service.
RE: xml parsing under mod_perl segfaults
> -Original Message- > From: Artem Litvinovich [mailto:[EMAIL PROTECTED]] > > Please reply if you are aware of a fix for this problem or a > workaround for > parsing XML under mod_perl. (a fix that does not require > apache recompilation > would be ideal) 1) Use XML::LibXML 2) Use XML::SAX::PurePerl (which is slower, but still works) 3) Upgrade Apache to 1.3.22 and use XML::Parser 2.30 Unfortunately none of those yet support your SimpleObject, but I've sent a patch/update of XML::Handler::Trees to Eric Bohlman, which will allow you to use that. Email me if you want a copy that'll allow you to work with XML::SAX::PurePerl. Matt. _ This message has been checked for all known viruses by Star Internet delivered through the MessageLabs Virus Scanning Service. For further information visit http://www.star.net.uk/stats.asp or alternatively call Star Internet for details on the Virus Scanning Service.
xml parsing under mod_perl segfaults
Hello mod_perl gurus, I am trying to do some xml parsing under mod_perl. My script basically looks like this: #!/usr/bin/perl -w use strict; use CGI qw(:standard); use XML::Parser; use XML::SimpleObject; my $file="test.xml"; my $parser = XML::Parser->new(ErrorContext => 2, Style => "Tree"); my $xml = XML::SimpleObject->new($parser->parsefile($file)); # mod_perl killer print header(); ... When executed at command line and under handler cgi-script the script works fine. However, when run under mod_perl the Apache child segfaults with: [notice] child pid 16608 exit signal Segmentation fault (11) The problem occurs at line marked as the mod_perl killer when parser tries to parse $file. I have observed identical behavior under the following setups: [freeBSD] Apache/1.3.12 mod_perl/1.21 Perl 5.005_03 built for i386-freebsd [linux] Apache/1.3.19 mod_perl/1.24_01 Perl v5.6.0 built for i386-linux Searching through various mailing lists revealed there maybe conflicts w/ Apache's expat, with a solution being to recompile without it. Postings with this same problem date back to almost one year ago. Since my freeBSD setup is a "virtual private server" from verio I cannot easily recompile+reinstall apache. Please reply if you are aware of a fix for this problem or a workaround for parsing XML under mod_perl. (a fix that does not require apache recompilation would be ideal) Thanks, //Artem
Re: Apache::Sandwich, etc
Jie Gao wrote: > Hi All, > > I am wondering if it is possible to add a footer to dynamic pages, > server-wide, like the subject module does to static pages. > > One apparent way to me is to add another content handler, but > I am not sure how that'll work. > > Any suggestion is appreciated. > > Jie When you say 'dynamic pages' what do you mean? Are you using standard CGI scripts under Apache::Registry? Or have you written your app as handlers? If you've written your app as a handler, then If you're going to use Multiple handlers that each contribute content to the final document (i.e. first hander processes the request and the second adds header and footer info), you should check out Apache::Filter.