httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brian Pane <>
Subject Re: Counting bytes_sent in core output_filter Re: [PATCH: Apache 2.0] mod_log_config: input/output bytes
Date Wed, 21 Aug 2002 22:58:57 GMT wrote:

>The cleanest solution, is to move the bytes_sent to the conn_rec, but then
>it should really be per-connection, not per-request,  and we want it to be
>The other solution is to have the core figure out the correct amount of
>data in the core_output_filter, and then fill out the request_rec in a
>later hook, but that is also kind of bogus.
>Adding the request_rec to the bucket is a bad idea, because currently
>buckets have no concept of Apache internals, and I would prefer that they
>stay that way.

The trick is to not add the request_rec to the bucket: just add a
void* "client_data" field to the bucket, so that apr-util doesn't
have to know anything about the httpd.

However, we can avoid this altogether if the the alternative
described below works:

>Adding the request_rec to the CONNECTION filters is also a bad idea,
>because those filters really shouldn't _need_ anything from the request,
>and connections don't always have requests, especially not in all
>IMO, the best solution is to move the bytes_sent information to the
>conn_rec, and have the protocol module reset it whenever it wants to.  For
>backwards compat, it would be REALLY cool, if the r->bytes_sent could be
>linked to c->bytes_sent, but it can't, so oh well.

If we add c->bytes_sent but keep r->bytes_sent, I *think* we can
compute both.  The logic would look like:
  * In core_output_filter, update c->bytes_sent.  But count the
    bytes when we scan each bucket, rather than waiting until
    we actually send it.  (I.e., for keepalive responses, we need
    to update c->bytes_sent *before* we setaside any buckets.)
  * When creating a new request, make a note of its c->bytes_sent
    value.  At the end of that request's processing (as a "really_first"
    logger callback added to the core, I suppose), compute
    r->bytes_sent as the delta in c->bytes_sent since the start of
    the request.  Then any loggers that depend on r->bytes_sent can
    continue to use it.


View raw message