httpd-bugs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 41095] New: - File etag generation problem
Date Fri, 01 Dec 2006 14:41:15 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=41095>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=41095

           Summary: File etag generation problem
           Product: Apache httpd-2
           Version: 2.2.3
          Platform: Other
        OS/Version: Solaris
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Core
        AssignedTo: bugs@httpd.apache.org
        ReportedBy: christian_boitel@yahoo.fr


When moving from Apache 1.3 to Apache 2.2.3, we found that Etags being 
generated for static files changed, thus leading to an increase in the 
bandwidth usage.

We are configured to use only size and modified file time in etag generated 
("FileETag MTime Size" directive). Although file modification time and size 
hasn't changed, we found the etag was different. The size part of the Etag 
didn't change while the modified time did.

Investigating the difference in the code, i found that Apache 2.2.3 was using 
a file info structure returned by APR which keeps the file modified time in 
microseconds structure (64 bits wide) instead of the default Unix 
systemstructure being in seconds (32 bits wide). 

In modules/http/http_etag.c, Apache will cast the microseconds structure to a 
unsigned long before calling etag_ulong_to_hex
=> this will simply truncate value to the first 32 bits before hexadecimal 
conversion when Apache 2 is compiled in 32 bits mode (default)
=> some data is simply lost during this conversion and doesn't ensure Etag is 
different if modification time is.

Two possibilities:
-> implement an etag_aprtimet_to_hex function to be called
-> convert back to seconds (simply devides by APR_USEC_PER_SEC) before calling

Second solution makes sure that Etag caculation is identical between Apache 
1.3 and 2.0: when migrating, this doesn't generated different Etags.

Second solution patch (tested in my test environment):
--- http_etag.original.c        2006-07-12 05:38:44.000000000 +0200
+++ http_etag.c 2006-12-01 15:23:03.727393000 +0100
@@ -139,7 +139,7 @@
             if (bits_added != 0) {
                 *next++ = '-';
             }
-            next = etag_ulong_to_hex(next, (unsigned long)r->mtime);
+            next = etag_ulong_to_hex(next, (unsigned long)(r-
>mtime/APR_USEC_PER_SEC));
         }
         *next++ = '"';
         *next = '\0';

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


Mime
View raw message