Re: bytes_received?
[prev]
[thread]
[next]
[Date index for 2004/12/09]
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):
>>http://perl.apache.org/docs/2.0/user/handlers/filters.html#Connection_Input
>>_Filters
>
>
> 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:
http://perl.apache.org/docs/2.0/user/handlers/filters.html#Connection_Filters_over_KeepAlive_Connections
> 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. :-)
Excellent!
--
__________________________________________________________________
Stas Bekman JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:stas@xxxxxx.xxx http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org http://ticketmaster.com
--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html