Re: [mp2] Problems with $r->bytes_sent and $r->status in log handler

[prev] [thread] [next] [Date index for 2005/04/18]

From: Stas Bekman
Subject: Re: [mp2] Problems with $r->bytes_sent and $r->status in log handler
Date: 20:57 on 18 Apr 2005
Markus Wichitill wrote:
> Hi,
> 
> I have a log handler that is supposed to log whether certain 
> HTTP-authenticated customers were able to completely download their 
> digital deliveries. The mod_perl 1.x version works just fine.
> 
> Now under SuSE Linux 9.2/Apache 2.0.53/mod_perl 2.0 RC4, $r->bytes_sent 
> seems to always contain the full size of the file resource, not the 
> bytes really sent to the client on an interrupted download. Unless it's 
> a byte range request, in which case it contains the full size of the 
> range. Does anybody know whether this is perhaps expected behaviour 
> under Apache2, maybe a result of its fancy filter architecture? Could it 
> be a mod_perl bug,  or is mod_perl only a thin wrapper around the C 
> structures in this case, and therefore most likely innocent?

It's not even a wrapper in mp2, it's just an accessor to the r->bytes_sent 
record entry:

apr_off_t
bytes_sent(obj, val=0)
     Apache2::RequestRec obj
     apr_off_t val

     PREINIT:
     /*nada*/


     CODE:
     RETVAL = (apr_off_t) obj->bytes_sent;

     if (items > 1) {

          obj->bytes_sent = (apr_off_t) val;
     }

     OUTPUT:
     RETVAL

So you should probably ask at httpd-dev, Markus.

> If I add mod_ssl to the mix, $r->status acts wonky, too. When it should 
> be 200 (and $r->status_line contains the correct "200 OK"), it's the 
> apparently nonsensical 104. When it should be 206 for a byte range 
> request (and $r->status_line contains the correct "206 Partial 
> Content"), it's 200. Other people with the same user agent managed to 
> produce other combinations, though. Any ideas?

Same here:

int
status(obj, val=0)
     Apache2::RequestRec obj
     int val

     PREINIT:
     /*nada*/


     CODE:
     RETVAL = (int) obj->status;

     if (items > 1) {

          obj->status = (int) val;
     }

     OUTPUT:
     RETVAL


        -- 
        __________________________________________________________________
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

Re: [mp2] Problems with $r->bytes_sent and $r->status in log handler
Stas Bekman 20:57 on 18 Apr 2005

Generated at 09:30 on 27 Apr 2005 by mariachi v0.52