[codesprints] Who knows about web browser caching?

Bill Fenner <fenner@fenron.net> Sun, 07 November 2010 07:17 UTC

Return-Path: <fenner@fenron.com>
X-Original-To: codesprints@core3.amsl.com
Delivered-To: codesprints@core3.amsl.com
Received: from localhost (localhost [127.0.0.1]) by core3.amsl.com (Postfix) with ESMTP id 5B1653A69CF for <codesprints@core3.amsl.com>; Sun, 7 Nov 2010 00:17:34 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -101.376
X-Spam-Level:
X-Spam-Status: No, score=-101.376 tagged_above=-999 required=5 tests=[BAYES_00=-2.599, FM_FORGED_GMAIL=0.622, J_CHICKENPOX_47=0.6, USER_IN_WHITELIST=-100, WEIRD_PORT=0.001]
Received: from mail.ietf.org ([64.170.98.32]) by localhost (core3.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id rsu0Ir7JPyUQ for <codesprints@core3.amsl.com>; Sun, 7 Nov 2010 00:17:33 -0700 (PDT)
Received: from mail-ww0-f44.google.com (mail-ww0-f44.google.com [74.125.82.44]) by core3.amsl.com (Postfix) with ESMTP id 187FA3A682D for <codesprints@ietf.org>; Sun, 7 Nov 2010 00:17:32 -0700 (PDT)
Received: by wwb39 with SMTP id 39so2704540wwb.13 for <codesprints@ietf.org>; Sun, 07 Nov 2010 00:17:50 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.216.7.194 with SMTP id 44mr3995799wep.7.1289114268218; Sun, 07 Nov 2010 00:17:48 -0700 (PDT)
Sender: fenner@fenron.com
Received: by 10.216.230.74 with HTTP; Sun, 7 Nov 2010 00:17:48 -0700 (PDT)
Date: Sun, 07 Nov 2010 15:17:48 +0800
X-Google-Sender-Auth: u4uGrlJ8o3etXkzWwrTuwwJe914
Message-ID: <AANLkTinVeLeso2vttskPjTmeyqyzkFAB+KmeincJAN2m@mail.gmail.com>
From: Bill Fenner <fenner@fenron.net>
To: codesprints@ietf.org
Content-Type: text/plain; charset="ISO-8859-1"
Subject: [codesprints] Who knows about web browser caching?
X-BeenThere: codesprints@ietf.org
X-Mailman-Version: 2.1.9
Precedence: list
List-Id: "List for coordinating \(and following up on\) codesprint activities" <codesprints.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/listinfo/codesprints>, <mailto:codesprints-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/codesprints>
List-Post: <mailto:codesprints@ietf.org>
List-Help: <mailto:codesprints-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/codesprints>, <mailto:codesprints-request@ietf.org?subject=subscribe>
X-List-Received-Date: Sun, 07 Nov 2010 07:17:34 -0000

Hey everyone,

  Does anyone know how to encourage a web browser (I'm testing with
Firefox) to validate the etag when clicking on a page?

  I've set USE_ETAGS=True in settings.py, which causes django to
create an etag for each page - and this works fine - here is Firefox
prefetching the history tab for a document:

GET /doc/draft-ietf-ipsecme-ikev2-redirect/history/ HTTP/1.1
Host: merlot.tools.ietf.org:31415
User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US;
rv:1.9.2.12) Gecko/20101026 Firefox/3.6.12
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 115
Connection: keep-alive
Referer: http://merlot.tools.ietf.org:31415/doc/draft-ietf-ipsecme-ikev2-redirect/
X-Moz: prefetch
Cookie: sessionid=6d82210d7761d52315fd2319be54a5e7

HTTP/1.0 200 OK
Server: WSGIServer/0.1 Python/2.6.6
Content-Length: 12210
Content-Encoding: gzip
Vary: Accept-Encoding, Cookie
Etag: "b33787a30797c25bd3c18f8d1d863ba4"
Date: Sun, 07 Nov 2010 06:36:59 GMT
Content-Type: text/html; charset=utf-8

However, I clicked on a direct link to the same URL, and Firefox
requested it again, without using If-None-Match:


GET /doc/draft-ietf-ipsecme-ikev2-redirect/history/ HTTP/1.1
Host: merlot.tools.ietf.org:31415
User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US;
rv:1.9.2.12) Gecko/20101026 Firefox/3.6.12
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 115
Connection: keep-alive
Referer: http://merlot.tools.ietf.org:31415/doc/draft-ietf-ipsecme-ikev2-redirect/
Cookie: sessionid=6d82210d7761d52315fd2319be54a5e7

HTTP/1.0 200 OK
Server: WSGIServer/0.1 Python/2.6.6
Content-Length: 12210
Content-Encoding: gzip
Vary: Accept-Encoding, Cookie
Etag: "ba02420d1da3a92ad8f80ce148edb72f"
Date: Sun, 07 Nov 2010 06:37:23 GMT
Content-Type: text/html; charset=utf-8


I also tried adding "Cache-control: private" headers, to try to
encourage Firefox to cache it, but that didn't help.  It does work for
the static files:

GET /css/base2.css HTTP/1.1
Host: merlot.tools.ietf.org:31415
User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US;
rv:1.9.2.12) Gecko/20101026 Firefox/3.6.12
Accept: text/css,*/*;q=0.1
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 115
Connection: keep-alive
Referer: http://merlot.tools.ietf.org:31415/doc/draft-ietf-ipsecme-ikev2-redirect/history/
Cookie: sessionid=6d82210d7761d52315fd2319be54a5e7
If-None-Match: "b73424ca331305280f9937208d73f862"

HTTP/1.0 304 NOT MODIFIED
Date: Sun, 07 Nov 2010 06:37:24 GMT
Server: WSGIServer/0.1 Python/2.6.6
Content-Length: 0
Content-Type: text/html; charset=utf-8


I realize that the fact that the Etag varies here is going to be a
problem (it's because the Etag is calculated after the gzip), but this
is a separate problem.

Anyone have any ideas?

Thanks,
  Bill