perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stas Bekman <>
Subject Re: bytes_received?
Date Thu, 09 Dec 2004 23:51:50 GMT
Malcolm J Harwood wrote:

>>I see. That should be relatively use to calculate with modperl2's input
>>connection filter (not w/o a small overhead of course):
> Assuming I've understood the docs, something like:
> sub handler : FilterConnectionHandler {
>       my($f, $bb, $mode, $block, $readbytes) = @_;
>       my $rv = $f->next->get_brigade($bb, $mode, $block, $readbytes);
>       return $rv unless $rv == APR::SUCCESS;
> 	$r->pnotes("size"=> $bb->length);
> }

Malcolm, you probably need to read the rest of the doc. Your code sammple 
will get only a little chunk of the input.

> Though I'm not sure how you'd get hold of $r in that context. 

You can't and you shouldn't. You could use $c->notes though. In fact it's 
very tricky if you have KeepAlive. It's sort of explained/coded in:

> Is that likely 
> to be more or less overhead than the above? (I know, benchmark it to find 
> out. Which I'll do when I get the chance).

Once it's written correctly, yes.

> It's occurred to me that as the application in question is using mod_deflate 
> and mod_ssl that the actual data over the network is not going to match the 
> size of the request. So I'm curious if there's a way to get the size at 
> different stages. mod_deflate logs the before and after so it at least knows 
> internally. (If the answer is "you can't", that's fine I'm just curious).

By inserting your filters before and after those other filters. the 
filters doc talks about this.

>>yup... if he's running mp2 :)
> Which I am. :-)


Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker     mod_perl Guide --->

Report problems:
Mail list info:
List etiquette:

View raw message