httpwg / http-core

Core HTTP Specifications
https://httpwg.org/http-core/
470 stars 43 forks source link

Ben Kaduk's COMMENT on caching #913

Closed mnot closed 3 years ago

mnot commented 3 years ago

negative integer range. If a cache receives a delta-seconds value greater than the greatest integer it can represent, or if any of its subsequent calculations overflows, the cache MUST consider the value to be 2147483648 (2^31) or the greatest positive integer it can conveniently represent.

Is that a free choice, MIN, or MAX?


Caches MAY either store trailer fields separate from header fields, or discard them. Caches MUST NOT combine trailer fields with header fields.

IIRC, recipients are allowed to merge trailer fields into header fields in some situations (e.g., if explicitly allowed by the field definition). I'm not entirely sure how that allowance is intended to interact with this directive (perhaps that generic-recipient merging has already occurred before this point?).


A cache that does not have a clock available MUST NOT use stored responses without revalidating them upon every use.

(Are we using the same qualifications for what counts as a clock as specified in §10.2.2 of -semantics?)


The "must-revalidate" response directive indicates that once the response has become stale, a cache MUST NOT reuse that response to satisfy another request until it has been successfully validated by the origin, as defined by Section 4.3. [...] The must-revalidate directive also permits a shared cache to reuse a response to a request containing an Authorization header field (Section 11.6.2 of [Semantics]), subject to the above requirement on revalidation (Section 3.5).

It seems like the combination of these two behaviors would allow a shared cache to reuse a response to a request containing an Authorization header field without revalidation, provided it does so before the response has become stale. That seems surprising to me, though it's hard to pin down exactly why.

NITS

A response's age can be calculated in two entirely independent ways:

Just to confirm: this is something that could be said to be the "intrinsic age" or "initial age" of the response, corresponding to the age at the time it was generated/received, as distinct from the age at the time of the calculation? I wonder if adding an adjective would help clarify that.


The "public" and "private" cache directives were clarified, so that they do not make responses reusable under any condition. (Section 5.2.2)

I'm having a hard time figuring out what change this refers to.

mnot commented 3 years ago

(Are we using the same qualifications for what counts as a clock as specified in §10.2.2 of -semantics?)

Yes, that's implied. I don't think it's important enough to reference.

mnot commented 3 years ago

It seems like the combination of these two behaviors would allow a shared cache to reuse a response to a request containing an Authorization header field without revalidation, provided it does so before the response has become stale. That seems surprising to me, though it's hard to pin down exactly why.

That's correct.

mnot commented 3 years ago

I'm having a hard time figuring out what change this refers to.

E.g., private previously said:

A private cache MAY store the response and reuse it for later requests, even if the response would normally be non-cacheable.

... which can be read to allow reuse under any condition by private caches.

mnot commented 3 years ago

Just to confirm: this is something that could be said to be the "intrinsic age" or "initial age" of the response, corresponding to the age at the time it was generated/received, as distinct from the age at the time of the calculation? I wonder if adding an adjective would help clarify that.

No, this is the age of the response, as currently calculated. In the context of the text above, I think this is sufficiently clear.

mnot commented 3 years ago

Is that a free choice, MIN, or MAX?

As written, it's a free choice.

mnot commented 3 years ago

IIRC, recipients are allowed to merge trailer fields into header fields in some situations (e.g., if explicitly allowed by the field definition). I'm not entirely sure how that allowance is intended to interact with this directive (perhaps that generic-recipient merging has already occurred before this point?).

Caches don't convert trailers into headers (when allowed); recipients and/or senders do.