Skip to content
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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

wanderview
Copy link
Member

@wanderview wanderview commented Mar 19, 2018

…tore/no-cache headers.

@w3c-bots
Copy link

w3c-bots commented Mar 19, 2018

Build PASSED

Started: 2018-03-19 14:40:40
Finished: 2018-03-19 14:54:25

View more information about this build on:

state: "stale",
cache_control: "no-store",
pragma: "no-cache",
request_cache: ["default", "force-cache"],
Copy link
Contributor

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.

Copy link
Member Author

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.

Copy link
Contributor

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.

Copy link
Member Author

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"],
Copy link
Contributor

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;
Copy link
Contributor

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.

Copy link
Member Author

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.

Copy link
Contributor

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.

Copy link
Member Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants