[Webkit-unassigned] [Bug 17998] New: WebKit seems to ignore Expire / ETag headers nullifying cache
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Fri Mar 21 18:31:10 PDT 2008
http://bugs.webkit.org/show_bug.cgi?id=17998
Summary: WebKit seems to ignore Expire / ETag headers nullifying
cache
Product: WebKit
Version: 525.x (Safari 3.1)
Platform: Macintosh Intel
OS/Version: Mac OS X 10.5
Status: UNCONFIRMED
Severity: Major
Priority: P2
Component: WebCore Misc.
AssignedTo: webkit-unassigned at lists.webkit.org
ReportedBy: mark.hughes at green-ant.com
Overview:
---------
After much research, WebKit seems to ignore Expire / ETag headers in a
response, either for static or dynamic content. Using Apache's mod_expires as a
basis point, WebKit/Safari seems unable to understand server-side caching
headers, and caching accordingly.
Ultimately, this is bad on its face, but especially bad for low bandwidth, high
latency, and/or resource-limited situations, such as dial-up users or the
iPhone.
Steps to Reproduce:
-------------------
1) Using Mac OS X builtin web sharing, configure my userdir.conf file (under
10.5/Intel)
shell> sudo vi /etc/apache2/users/mhughes.conf
<Directory "/Users/mhughes/Sites">
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
ExpiresActive On
ExpiresDefault "access plus 7 days"
</Directory>
2) Restart Apache
shell> sudo apachectl graceful
--or--
"System Preferences" > "Sharing" > Uncheck "Web Sharing" > Wait a few
seconds for it to shutdown > Re-check "Web Sharing"
** Confirm the restart by opening http://localhost/~mhughes/ - you should see
"Your website here" and such.
3) Confirm Expires and ETag are being sent properly by the webserver (Apache
2.2). Open your terminal window and issue the following command:
shell> curl -i --head http://localhost/~mhughes/images/macosxlogo.gif
Result should look similar to below:
[antbox:~] mhughes% curl -i --head
http://localhost/~mhughes/images/macosxlogo.gif
HTTP/1.1 200 OK
Date: Sat, 22 Mar 2008 00:12:40 GMT
Server: Apache/2.2.6 (Unix) mod_ssl/2.2.6 OpenSSL/0.9.7l DAV/2 PHP/5.2.4
Last-Modified: Sat, 03 Nov 2007 20:12:50 GMT
ETag: "52b87-b0d-43e0be8509480"
Accept-Ranges: bytes
Content-Length: 2829
Cache-Control: max-age=604800
Expires: Sat, 29 Mar 2008 00:12:40 GMT
Content-Type: image/gif
** Note the ETag, Cache-Control, and Expires headers being returned.
3) Open Terminal.app and run the following:
shell> sudo tail -n 0 -f /var/log/apache2/access_log | grep macosxlogo
## The -n 0 will ensure no unwelcome previous access lines
4) Open Safari to http://localhost/~mhughes/
5) Return to your terminal window. Results should look similar to below:
::1 - - [21/Mar/2008:17:06:40 -0700] "GET /~mhughes/images/macosxlogo.gif
HTTP/1.1" 200 2829
** Request return with a 200 response code. This is fine.
6) Return to Safari and reload the page.
7) Return to your terminal window. Results should look similar to below:
::1 - - [21/Mar/2008:17:06:48 -0700] "GET /~mhughes/images/macosxlogo.gif
HTTP/1.1" 200 2829
** Request still have a 200 response code, not 304 (Not Modified) as expected.
Expected Results:
-----------------
All static content should have, upon subsequent load, been cached via the
numerous caching headers.
Actual Results:
---------------
All content, regardless of cache headers from the server, is re-requested and
retransferred from the server. This causes much more bandwidth to be used,
which should also increase local resource usage and cache churning.
Products affected:
------------------
Safari Version 3.1 (5525.13) 10.5 / Intel
Safari Version 3.0.4 (523.15) WinXP SP2
WebKit r31114 10.5 / Intel
Additional Builds and Platforms:
--------------------------------
Other major browsers, by comparison, perform as expected (below are the Apache
logs for relevant browsers)
Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1.12) Gecko/20080201
Firefox/2.0.0.12 <---- Running on 10.5.2 / Intel
First request: 127.0.0.1 - - [21/Mar/2008:17:13:58 -0700] "GET
/~mhughes/images/macosxlogo.gif HTTP/1.1" 200 2829
Second request: 127.0.0.1 - - [21/Mar/2008:17:14:04 -0700] "GET
/~mhughes/images/macosxlogo.gif HTTP/1.1" 304 -
Opera/9.24 (Macintosh; Intel Mac OS X; U; en) <---- Running on 10.5.2 / Intel
First request: 127.0.0.1 - - [21/Mar/2008:17:18:15 -0700] "GET
/~mhughes/images/macosxlogo.gif HTTP/1.1" 200 2829
Second request: 127.0.0.1 - - [21/Mar/2008:17:18:31 -0700] "GET
/~mhughes/images/macosxlogo.gif HTTP/1.1" 304 -
Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en; rv:1.8.1.14pre) Gecko/20080321
Camino/1.6b3pre (like Firefox/2.0.0.14pre) <---- (Camino nightly) Running on
10.5.2 / Intel
First request: 127.0.0.1 - - [21/Mar/2008:17:20:04 -0700] "GET
/~mhughes/images/macosxlogo.gif HTTP/1.1" 200 2829
Second request: 127.0.0.1 - - [21/Mar/2008:17:20:08 -0700] "GET
/~mhughes/images/macosxlogo.gif HTTP/1.1" 304 -
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1) <---- Running on WinXP SP2
First request: 10.50.3.140 - - [21/Mar/2008:17:24:53 -0700] "GET
/~mhughes/images/macosxlogo.gif HTTP/1.1" 200 2829
Second request: 10.50.3.140 - - [21/Mar/2008:17:25:05 -0700] "GET
/~mhughes/images/macosxlogo.gif HTTP/1.1" 304 -
Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1) <---- Running on WinXP SP2
First request: 10.50.3.140 - - [21/Mar/2008:17:28:47 -0700] "GET
/~mhughes/images/macosxlogo.gif HTTP/1.1" 200 2829
Second request: 10.50.3.140 - - [21/Mar/2008:17:28:49 -0700] "GET
/~mhughes/images/macosxlogo.gif HTTP/1.1" 304 -
Additional information:
-----------------------
I am not familiar with the core of the engine enough to point blame, but I did
notice that even with returning:
...
Last-Modified: Sat, 03 Nov 2007 20:12:50 GMT
ETag: "52b87-b0d-43e0be8509480"
...
Cache-Control: max-age=604800
Expires: Sat, 29 Mar 2008 00:12:40 GMT
...
The subsequent request(s) from WebKit/Safari will show (by using the web
inspector to dump headers):
>>> request headers >>>
Cache-Control max-age=0
Referer http://localhost/~mhughes/
User-Agent Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_2;
en-us) AppleWebKit/526.1+ (KHTML, like Gecko) Version/3.0.4 Safari/523.15
<<< request headers <<<
>>> response headers >>>
Accept-Ranges bytes
Cache-Control max-age=604800
Connection Keep-Alive
Content-Length 2829
Content-Type image/gif
Date Sat, 22 Mar 2008 00:33:41 GMT
Etag "52b87-b0d-43e0be8509480"
Expires Sat, 29 Mar 2008 00:33:41 GMT
Keep-Alive timeout=5, max=98
Last-Modified Sat, 03 Nov 2007 20:12:50 GMT
Server Apache/2.2.6 (Unix) mod_ssl/2.2.6 OpenSSL/0.9.7l DAV/2
PHP/5.2.4
<<< response headers <<<
Of note is that no matter how many cache cleans or reloads, the request always
seems to contain:
Cache-Control max-age=0
A good example to test with:
----------------------------
* http://www.apple.com/startpage/
Clear cache > Open Inspector > Load Page.
*** According to network panel, all of the resources total ~770KB.
Reload page leaving inspector open.
*** Same transfer of data. A sampling of the requests show all as pulling
max-age=0 and retransferring.
Note: As a point of comparison, repeat the same thing in FireFox with FireBug
installed. On reload, ONLY the HTML page is reloaded from the network. All
other pages trust their cached copies, even though they do confirm with the
server that their copies are good.
--
Configure bugmail: http://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
More information about the webkit-unassigned
mailing list