Subject: Unifying & standardizing X-Moz & X-Purpose headers

From: Gavin Peters (蓋文彼德斯) <[email-masked]>
Date: Thu, 23 Sep 2010 14:56:51 -0400

Hi,

I'm experimenting with prefetching in chrome & webkit, and I have some
concerns I wanted to bring to the attention of the HTTP wg.
Right now the prefetch feature in Firefox adds a nonstandard header:

  X-Moz: prefetch

to requests that originate either from <link> elements or the Link: header.

Safari generates previews of web pages for its startup page and new
tab page. =C2=A0The requests that generate that view are a full page load
- Hide quoted text -
(javascript is run, subresources are loaded...), and it includes the
header:

  X-Purpose: preview

Chrome dev channel and beta right now include an experimental
implementation of prefetching, which partially follows on the WebKit
implementation of prefetching.  The WebKit prefetching actually puts
no extra headers at all in its requests.

Some google searching reveals that some webmasters use these request
headers to do things like 404 prefetching requests (a pretty
legitimate thing to do), and to serve pages without analytics to
Safari previews.

Given that http requests are already happening with these markers, and
that there's three incompatible & inconsistant practices for
specifying this activity,
how should we proceed?  I think it would be best if there was one
header for conveying purposes such as prefetch, preview, etc....
Immediately, I think a variation on the Safari practice, and a header
such as:

  Purpose: preview

or

  Purpose: prefetch

Is likely to best serve everybody's interest.

Do we agree that this is a useful thing to specify, and if so, what is
the best way to proceed if we agree?

- Gavin

---

From: Adam Barth <[email-masked]>
Date: Thu, 23 Sep 2010 12:23:09 -0700

WebKit would have implemented "X-Moz: prefetch" along with the
prefetch feature if the header didn't have such a Mozilla-specific
name.

Adam

---

From: "Roy T. Fielding" <[email-masked]>
Date: Thu, 23 Sep 2010 16:23:37 -0700

> the best way to proceed if we agree?

Yes.  For example, I put in waka

    messageType  = "Q"        ; active request
                 | "q"        ; passive request
                 | "f"        ; prefetch request
                 | "P"        ; active test-probe
                 | "p"        ; passive test-probe
                 ...

Which would translate into

   (default no header = active)
   Purpose: passive   (inline image, stylesheet, etc.)
   Purpose: prefetch  (what you describe for cache or preview)

I am assuming that the preview function also populates the cache
and acts as a prefetch.  If not, then you might want to distinguish
them as separate purposes.

....Roy