httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stas Bekman <s...@stason.org>
Subject Re: how to tell one request from another inside a connection filter over keep-alive connection
Date Tue, 02 Mar 2004 04:18:53 GMT
Stas Bekman wrote:
> If I'm inside an input connection filter and want to be able to tell one 
> HTTP request from another what should I do? Counting Content-length is 
> ineffective, and a won't work if C-L header is wrong.
> 
> I can tell the end of HTTP headers section from the request body, by 
> matching /^[\r\n]$/ while reading HTTP headers. But I see no token that 
> tells me that the body is done. Any filter examples I can look at?
> 
> Also, why there is no EOS token in connection level filters? if you had 
> some data buffered how do you know when to flush it?
> 
> With Keep-Alive requests I get some IMMORTAL bucket after the last 
> request. Not sure what it is. At the moment just snooping on the traffic.

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:
http://perl.apache.org/docs/2.0/user/handlers/filters.html#Connection_Filters_over_KeepAlive_Connections

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

Mime
View raw message