Justin Erenkrantz wrote:
--On Monday, March 1, 2004 8:18 PM -0800 Stas Bekman <[EMAIL PROTECTED]> wrote:

Answering my own question, the solution is to use conn->keepalives counter
which is incremented at the end of each request. By storing the previous
count and comparing with the current count one can tell when a new request
is coming in over the keepalive connection. This technique is now documented
in the mod_perl land:


Sorry, but I think something is off here.

Why should a connection-level filter know about HTTP requests? -- justin

Because that's the only way to write a filter that processes HTTP headers only. See: http://search.cpan.org/dist/Apache-Filter-HTTPHeadersFixup/


There are quite a few people who need this functionality. And it takes a few lines perl of code to write a custom filter.

package MyFilter::in_append;

use base qw(Apache::Filter::HTTPHeadersFixup);

sub manip {
    my ($class, $ra_headers) = @_;

my $header = "Donkey: Monkey\n";

    push @$ra_headers, $header;
}

And you have a new header added. $ra_headers contains all the headers, so you can manipulate them as well.

People find it very handy with proxies when all they need is to add/remove/manipulate HTTP headers.

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

Reply via email to