New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Verify that fetch API force-cache
and only-if-cached
respect no-s…
#10094
base: master
Are you sure you want to change the base?
Conversation
…tore/no-cache headers.
Build PASSEDStarted: 2018-03-19 14:40:40 View more information about this build on: |
state: "stale", | ||
cache_control: "no-store", | ||
pragma: "no-cache", | ||
request_cache: ["default", "force-cache"], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The case stale/no-store/default is probably already covered in fetch/api/request/request-cache-default.html.
We probably can remove it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The purpose of this added test case is that force-cache
does not override the browsers behavior of suppressing no-store responses that may be hanging around in the browser. For example, the browser may still have this data resident to support devtools viewsource, etc. Setting force-cache
should not allow content to observe these no-store
responses.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, instead of request_cache: ["default", "force-cache"], request_cache: ["force-cache"] should be sufficient.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't I need the "default" there so that the http cache has a chance to see the no-store response? Or does the test infrastructure prime cache in some other way? Thanks.
state: "stale", | ||
cache_control: "no-store", | ||
pragma: "no-cache", | ||
request_cache: ["default", "only-if-cached"], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto here
@@ -75,7 +79,7 @@ function make_url(uuid, id, value, content, info) { | |||
"&content=" + content + | |||
"&" + id + "=" + value + | |||
"&expires=" + dates[info.state] + | |||
vary + cache_control + ignore_request_headers; | |||
vary + cache_control + pragma + ignore_request_headers; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is not clear to me what you are trying to do here with Pragma.
cache.py is grabbing the Pragma request header and storing it in its state so that it can later be validated by the JS test. Adding it in the URL should not change anything.
We are adding Cache-Control in the URL so that the response will contain Cache-Control header value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was my understanding that to get a response to be consistently ignored by browser caches you needed to set both of these headers:
cache-control: no-store
pragma: no-cache
This diff hunk was about getting the pragma header set on the response toward this end.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. In that case, cache.py would need to be updated to add Pragma as a response header baed on the request URL parameters, like already done for Expires for instance.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I see. I saw that pragma was being read from the request in cache.py
and I guess I thought it was reflected back.
Since the test is adequate to cover the situation I'm trying to test without the pragma stuff actually working, then I guess I'll just remove it. Looking closer, it seems its fine for a server to simply return cache-control: no-store
in the response header.
…tore/no-cache headers.