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

Specify identity encoding for range requests. Fixes #747. #751

Merged
merged 3 commits into from
Jun 6, 2018

Conversation

jakearchibald
Copy link
Collaborator

@jakearchibald jakearchibald commented Jun 1, 2018

@jakearchibald
Copy link
Collaborator Author

Tests: web-platform-tests/wpt#11291

@jakearchibald
Copy link
Collaborator Author

jakearchibald commented Jun 1, 2018

This is different to what browser appear to implement. Chrome and Safari seem to special-case media, and they add the Accept-Encoding header before the service worker (although Safari then filters it before the service worker).

This PR adds Accept-Encoding: identity for all requests with a Range header, regardless of source, and adds the header after the service worker (where Accept-Encoding is usually added).

I'm confident these differences are justified. If this is a weirdness for range requests, we should fix all range requests, and since the developer doesn't receive the encoded bytes, Accept-Encoding should be after the service worker.

@youennf
Copy link
Collaborator

youennf commented Jun 1, 2018

The PR looks good to me.

I wonder what is the fetch spec policy regarding external links like https://jakearchibald.github.io/accept-encoding-range-test/.
It does not seem to work in Safari for instance and my locally installed Chrome bails out because of TransformStream not being present.
Maybe a snapshot of the results could be hosted somewhere (whatwg owned maybe) and would link to that particular URL for fresher results.

This PR adds Accept-Encoding: identity for all requests with a Range header, regardless of source, and adds the header after the service worker (where Accept-Encoding is usually added).

That makes sense to me. This is simple to implement, will simplify range requests authoring, including when intercepted by service workers. There seems to be no justification for making Accept-Encoding a special privileged header at the moment.

@jakearchibald
Copy link
Collaborator Author

jakearchibald commented Jun 1, 2018

@youennf

It does not seem to work in Safari for instance and my locally installed Chrome bails out because of TransformStream not being present.

I reckon I can make it work in the latest versions of Safari, Chrome, Firefox, & Edge. The TransformStream stuff is just a performance enhancement, and mostly just me taking the opportunity to play with some new stuff.

could be hosted somewhere (whatwg owned maybe)

I've got no problem with moving it. @annevk, any preferences?

Copy link
Member

@domfarolino domfarolino left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good to me. Regarding the external URL, FWIW I know we make official references to triple-underscore translations (like https://triple-underscore.github.io/Streams-ja.html and https://triple-underscore.github.io/console-ja.html) which are of course hosted on non-whatwg owned properties. But yeah I'll defer to Anne for final call.

@jakearchibald
Copy link
Collaborator Author

FWIW https://jakearchibald.github.io/accept-encoding-range-test/ now works across Safari, Chrome, Firefox & Edge.

Copy link
Member

@annevk annevk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Historically WHATWG standards have included non-normative external links when they add a lot of background information, so this seems fine.

I think for certain canvas algorithms we might still normatively refer to books, even, which feels much worse and not a precedent I'd be happy with following.

fetch.bs Outdated
<a for=request>header list</a>.

<p class="note no-backref">
<a href="https://jakearchibald.github.io/accept-encoding-range-test/">Many servers</a>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You cannot have a newline before <a here. We only allow whitespace at the end of paragraphs.

fetch.bs Outdated
@@ -3661,7 +3671,7 @@ Range Requests</cite>. [[HTTP-RANGE]] However, this is not widely supported by b
`<code>Connection</code>`,
`<code>DNT</code>`, and
`<code>Host</code>`,
are to be <a for="header list">appended</a> if necessary.
are to be <a for="header list">appended</a> if necessary, unless already specified.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be part of the normative requirement, no?

Modify httpRequest's header list per HTTP, except for headers already appended prior to this step.

@jakearchibald
Copy link
Collaborator Author

jakearchibald commented Jun 4, 2018

@annevk I've tried to make the text normative, although it's a bit clunky.

fetch.bs Outdated
<a for=request>header list</a>.

<p class="note no-backref"><a href="https://jakearchibald.github.io/accept-encoding-range-test/">Many
servers</a> mistakenly ignore `<code>Range</code>` headers if a non-identity encoding is
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No newline here. Only HTML allows newlines in inlines. I can fix this up for you before landing though.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I thought the fetch rule was only for references. Fixed.

@annevk
Copy link
Member

annevk commented Jun 4, 2018

With browser bugs this can land I think. I'll leave things another day for @youennf to comment.

@jakearchibald
Copy link
Collaborator Author

jakearchibald commented Jun 6, 2018

Chrome: https://bugs.chromium.org/p/chromium/issues/detail?id=849952

WebKit: https://bugs.webkit.org/show_bug.cgi?id=186335 (@youennf I couldn't find a general 'fetch' component for this to go in, so it may need triaged).

Firefox: https://bugzilla.mozilla.org/show_bug.cgi?id=1467010 (@annevk can you triage? The 'component' drop down seems to only contain irrelevant stuff these days).

Edge: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/17784386/

@annevk
Copy link
Member

annevk commented Jun 6, 2018

Thanks! I think WebKit doesn't really use components and for Firefox you want to use the Core product. The Firefox product is the frontend, mostly (similar to Blink/Chromium).

@annevk annevk merged commit 2f3d04d into master Jun 6, 2018
@annevk annevk deleted the accept-encoding-range branch June 6, 2018 07:26
annevk pushed a commit to web-platform-tests/wpt that referenced this pull request Jun 6, 2018
dhdavvie pushed a commit to dhdavvie/wpt that referenced this pull request Jun 7, 2018
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this pull request Jun 27, 2018
…s, a=testonly

Automatic update from web-platform-testsFetch: test identity encoding for range requests

For whatwg/fetch#751.
--

wpt-commits: 1421a4a976d4d8263bde4864a1ce412eba106d39
wpt-pr: 11291
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this pull request Jun 28, 2018
…s, a=testonly

Automatic update from web-platform-testsFetch: test identity encoding for range requests

For whatwg/fetch#751.
--

wpt-commits: 1421a4a976d4d8263bde4864a1ce412eba106d39
wpt-pr: 11291
kdashg pushed a commit to kdashg/gecko-cinn that referenced this pull request Jun 30, 2018
…s, a=testonly

Automatic update from web-platform-testsFetch: test identity encoding for range requests

For whatwg/fetch#751.
--

wpt-commits: 1421a4a976d4d8263bde4864a1ce412eba106d39
wpt-pr: 11291
kdashg pushed a commit to kdashg/gecko-cinn that referenced this pull request Jun 30, 2018
…s, a=testonly

Automatic update from web-platform-testsFetch: test identity encoding for range requests

For whatwg/fetch#751.
--

wpt-commits: 1421a4a976d4d8263bde4864a1ce412eba106d39
wpt-pr: 11291
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this pull request Oct 3, 2019
…s, a=testonly

Automatic update from web-platform-testsFetch: test identity encoding for range requests

For whatwg/fetch#751.
--

wpt-commits: 1421a4a976d4d8263bde4864a1ce412eba106d39
wpt-pr: 11291

UltraBlame original commit: febbc42c7d8f857afb981fa2d2958f5976a47729
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this pull request Oct 3, 2019
…s, a=testonly

Automatic update from web-platform-testsFetch: test identity encoding for range requests

For whatwg/fetch#751.
--

wpt-commits: 1421a4a976d4d8263bde4864a1ce412eba106d39
wpt-pr: 11291

UltraBlame original commit: 954f7290ff43966a30c2ab2806e6841ab3618059
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this pull request Oct 3, 2019
…s, a=testonly

Automatic update from web-platform-testsFetch: test identity encoding for range requests

For whatwg/fetch#751.
--

wpt-commits: 1421a4a976d4d8263bde4864a1ce412eba106d39
wpt-pr: 11291

UltraBlame original commit: febbc42c7d8f857afb981fa2d2958f5976a47729
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this pull request Oct 3, 2019
…s, a=testonly

Automatic update from web-platform-testsFetch: test identity encoding for range requests

For whatwg/fetch#751.
--

wpt-commits: 1421a4a976d4d8263bde4864a1ce412eba106d39
wpt-pr: 11291

UltraBlame original commit: 954f7290ff43966a30c2ab2806e6841ab3618059
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this pull request Oct 3, 2019
…s, a=testonly

Automatic update from web-platform-testsFetch: test identity encoding for range requests

For whatwg/fetch#751.
--

wpt-commits: 1421a4a976d4d8263bde4864a1ce412eba106d39
wpt-pr: 11291

UltraBlame original commit: febbc42c7d8f857afb981fa2d2958f5976a47729
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this pull request Oct 3, 2019
…s, a=testonly

Automatic update from web-platform-testsFetch: test identity encoding for range requests

For whatwg/fetch#751.
--

wpt-commits: 1421a4a976d4d8263bde4864a1ce412eba106d39
wpt-pr: 11291

UltraBlame original commit: 954f7290ff43966a30c2ab2806e6841ab3618059
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants