You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Jeff Ambrosino <jb...@gmail.com> on 2005/09/01 15:03:12 UTC

get # of response bytes sent for large/streaming content?

I'm running a mod_perl cleanup handler from a reverse proxy 
($r->pool->cleanup_register), and
I need to know the total # of bytes sent in a response so I can store this 
info in a database.
A real-world example would be the end user (browser) streaming a Quicktime 
movie, and I want
to know how long this took, measured in bytes. Note the connection might be 
aborted at any
time, so the number may vary. Apache already logs this info (transfer log), 
so
it must be available, but how do I get at this information programmatically? 
FYI I'm running
mod_perl 1.99_16 on Apache 2.0.54...

thanks
JB

Re: get # of response bytes sent for large/streaming content?

Posted by Jeff Ambrosino <jb...@gmail.com>.
Yup, that works great.

thanks!
JB


On 9/1/05, Geoffrey Young <ge...@modperlcookbook.org> wrote:
> 
> 
> 
> Jeff Ambrosino wrote:
> > I'm running a mod_perl cleanup handler from a reverse proxy
> > ($r->pool->cleanup_register), and
> > I need to know the total # of bytes sent in a response so I can store 
> this
> > info in a database.
> > A real-world example would be the end user (browser) streaming a 
> Quicktime
> > movie, and I want
> > to know how long this took, measured in bytes. Note the connection might 
> be
> > aborted at any
> > time, so the number may vary. Apache already logs this info (transfer 
> log),
> > so
> > it must be available, but how do I get at this information 
> programmatically?
> 
> the transfer log uses two methods, the first of which is private to apache
> but the other is $r->bytes_sent(). so, the numbers might differ a bit from
> the transfer log, but they ought to be close.
> 
> HTH
> 
> --Geoff
>

Re: get # of response bytes sent for large/streaming content?

Posted by Geoffrey Young <ge...@modperlcookbook.org>.

Jeff Ambrosino wrote:
> I'm running a mod_perl cleanup handler from a reverse proxy 
> ($r->pool->cleanup_register), and
> I need to know the total # of bytes sent in a response so I can store this 
> info in a database.
> A real-world example would be the end user (browser) streaming a Quicktime 
> movie, and I want
> to know how long this took, measured in bytes. Note the connection might be 
> aborted at any
> time, so the number may vary. Apache already logs this info (transfer log), 
> so
> it must be available, but how do I get at this information programmatically? 

the transfer log uses two methods, the first of which is private to apache
but the other is $r->bytes_sent().  so, the numbers might differ a bit from
the transfer log, but they ought to be close.

HTH

--Geoff