Bug 52578 - Wrong "bytes sent" logged when connection is closed prematurely
Summary: Wrong "bytes sent" logged when connection is closed prematurely
Status: REOPENED
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: mod_log_config (show other bugs)
Version: 2.2.17
Hardware: PC Linux
: P2 enhancement (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-02-02 09:41 UTC by Mark Jenkins
Modified: 2012-02-02 12:40 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Jenkins 2012-02-02 09:41:51 UTC
The log formats "%B" and "%b" log the full size of the file requested even if the client reads only a few kB and then closes the connection.

Using "%O" from mod_logio is not an option because it counts the headers too instead of just the payload.
Comment 1 Nick Kew 2012-02-02 10:49:34 UTC
You're asking for something non-meaningful.

At the network or connection level (%O) you can't distinguish between metadata (like the HTTP headers, and chunking information) and payload unless you re-parse the entire response - which would be a huge overhead.

At the request level (%[Bb]), if a request is aborted you can know how much data has been encoded for the connection level, but not how much of that has been sent down the wire.  The latter may also be affected by such things as SSL encryption.
Comment 2 Mark Jenkins 2012-02-02 12:31:27 UTC
The write() and sendfile() system calls do tell you how much data has been sent down the wire. Even at this level you can distinguish between headers and payload because Apache sends them separately.