Subject: Cache-Control

From: "Joris Dobbelsteen" <[email-masked]>
Date: Mon, 14 Aug 2000 18:32:22 +0200

There was in 5-2000 a discussion about the cache-control header in HTTP/1.1.

My question is what should a proxy/user-agent do if it receives the request:

cache-control: private, public, max-age=180, s-maxage=120

According to my e-mail archive it was a discussion Koen Holtman participated
in.......
But I had some trouble and I suppose I didn't receive a lot of e-mails at
that time....

- Joris Dobbelsteen

---

From: Jeffrey Mogul <[email-masked]>
Date: Mon, 14 Aug 2000 11:24:18 -0700

My question is what should a proxy/user-agent do if it receives
   the request:

I'm going to assume that the word "request" in your email is
a mistake, and that you meant "response".  Three of the four
directives you listed are undefined for requests.  With
that in mind:

The answer is different for a (shared) proxy and for a (non-shared)
user-agent.

A user-agent (presumably with a "non-shared cache") should
ignore the "private" and "s-maxage" directives, and so
this is equivalent *FOR A NON-SHARED CACHE* to

	Cache-Control: max-age=180

A shared proxy cache, on the other hand, has no sensible
way to interpret this header field, because RFC2616 says:

   public
      Indicates that the response MAY be cached by any cache, even if it
      would normally be non-cacheable or cacheable only within a non-
      shared cache. (See also Authorization, section 14.8, for
      additional details.)

   private
      Indicates that all or part of the response message is intended for
      a single user and MUST NOT be cached by a shared cache. This
      allows an origin server to state that the specified parts of the
      response are intended for only one user and are not a valid
      response for requests by other users. A private (non-shared) cache
      MAY cache the response.

Given that the "private" directive in your example does NOT list
any specific parts of the response, it therefore must refer to
the entire response.  But this means that the "public" and
"private" directives are conflicting, and so the server that
sent the response has a bug.

As a general rule, I would recommend that if a received
response appears to be buggy, it is stupid to cache it.
(Another way to look at this: if the server implementor
appears to have misunderstood the HTTP caching specification,
then a cache implementor ought to protect the user from
that implementor's mistake.)  Don't cache responses if
they cannot unambiguously be cached with "semantic transparency"
(see RFC2616).

-Jeff

---

From: "Joris Dobbelsteen" <[email-masked]>
Date: Tue, 15 Aug 2000 15:33:15 +0200

> -----Original Message-----
> From: Jeffrey Mogul [mailto:[email-masked]]
> Sent: maandag 14 augustus 2000 20:24
> To: Joris Dobbelsteen
> Cc: [email-masked]
> Subject: Re: Cache-Control
>
>

I didn't see that at time I was writing the mail, but you are right,
I meant response instead of request.

> 	Cache-Control: max-age=180

What about "public"???

> sent the response has a bug.

Ok, that's true. That is why I send this example, to see how you (HTTP WG)
think how to handle this...

> they cannot unambiguously be cached with "semantic transparency"

Let's if I understand it right:
Meaning your recommendation whould be:

Private Cache (NON-SHARED)
    Cache it (max-age = 180)

Public Cache (SHARED)
    Don't cache it (conflicting cache-control)
    However on the other had, the server did send s-maxage=120,
    so it's caring for public caches.....

> -Jeff

- Joris

---

From: John Stracke <[email-masked]>
Date: Fri, 18 Aug 2000 12:00:47 -0400

> >       Cache-Control: max-age=180

Nobody else has access to that cache, so "public" can't mean anything.

>     so it's caring for public caches.....

Maybe.  Or maybe s-maxage crept in because of some memory trashing on the
server side.  Once you see that the server is buggy, you can't be sure what
it wants.

(Reminds me of a line from a Pratchett book: "Why is he *doing* this?" "That
is only a valid question if he is sane.  He may be doing it because the
little green pixies tell him to."  :-)

--
/==============================================================\
|John Stracke    | http://www.ecal.com |My opinions are my own.|
|Chief Scientist |=============================================|
|eCal Corp.      |Help stamp out vi in our lifetime!           |
[email-masked]|                                             |
\==============================================================/