New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 610725 link

Starred by 2 users

Issue metadata

Status: WontFix
Owner:
Email to this user bounced
Closed: May 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 3
Type: Bug



Sign in to add a comment

POST cached requests are just sitting, useless

Project Member Reported by gabadie@chromium.org, May 10 2016

Issue description

The HTTP cache assign the primary key of a cached resource as the URL. But the if the requests upload some data such as a file or a requests POST, then the this URL is prefixed with the upload stream unique identifier.

https://code.google.com/p/chromium/codesearch#chromium/src/net/http/http_cache.cc&sq=package:chromium&type=cs&l=541&rcl=1462864689

But this unique identifier is unique across sessions, meaning the cache entry of that resource will never get used again. The bug is these entries are not removed once the tab close or so and might be just sitting here until they eventually get garbage collected.

https://code.google.com/p/chromium/codesearch#chromium/src/net/base/upload_data_stream.h&l=30&cl=GROK&gsn=identifier
 
Labels: -Pri-3 Pri-2
Status: Available (was: Untriaged)
Labels: -Pri-2 Pri-3
Should try to keep this at P3 unless this is tied to a particular milestone.

Comment 3 by pasko@chromium.org, May 11 2016

seems like cacheable POST responses would silently avoid POST-ing, but only within a browsing session.

gavinp: do you think it is an extension of the spec that all browsers use? or maybe it is by the spec, and just my reading of the spec is wrong? or maybe my reading of the code is wrong?
One place I have seen this is used is if there is a Save-As behavior to prevent having to repost or go over the network. Not sure about extension to spec though.

Comment 5 by gavinp@chromium.org, May 11 2016

The spec is pretty clear, POST responses are cacheable. In RFC 2616, it required explicit cache control https://tools.ietf.org/html/rfc2616#section-9.5 :

   Responses to this method are not cacheable, unless the response
   includes appropriate Cache-Control or Expires header fields. However,
   the 303 (See Other) response can be used to direct the user agent to
   retrieve a cacheable resource.

RFC 7231 goes into much more detail:

   Responses to POST requests are only cacheable when they include
   explicit freshness information (see Section 4.2.1 of [RFC7234]).
   However, POST caching is not widely implemented.  For cases where an
   origin server wishes the client to be able to cache the result of a
   POST in a way that can be reused by a later GET, the origin server
   MAY send a 200 (OK) response containing the result and a
   Content-Location header field that has the same value as the POST's
   effective request URI (Section 3.1.4.2).

So, I don't think we're out of spec to store POST responses, although if we're using heuristic freshness, we sure are. I can't imagine that we would cache POST requests across sessions; that would require figuring out if the upload data streams were identical, and that's hard.

As to whether it conforms to spec to store POST responses that lack explicit freshness in the cache, I really don't know. It hinges on your interpretation of RFC 7234 3., which in part says:

   A cache MUST NOT store a response to any request, unless:

   o  The request method is understood by the cache and defined as being
      cacheable, and
   ...

And since the language there doesn't talk about the response despite the definition of POST talking about it... So I guess we're nonconformant. But I am not sad about it, isn't it only history navigation that's going to be affected?

I think even "reload" creates a distinct upload identifier, but I'm not sure.
Status: Fixed (was: Available)
Status: Available (was: Fixed)
Oups, wrong bug.

Comment 8 by mmenke@chromium.org, May 12 2016

Does "not caching POST requests across sessions" include session restore, and navigating back in history to a POST?

Comment 9 by mmenke@chromium.org, May 27 2016

Status: WontFix (was: Available)
As no one else has chimed in otherwise, going to mark this WontFix - cached POSTs are used for history navigations, save-as, and (presumably) session restore.

Sign in to add a comment