Skip to content

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

Merged
annevk merged 3 commits into
masterfrom
accept-encoding-range
Jun 6, 2018
Merged

annevk merged 3 commits into
masterfrom
accept-encoding-range

Conversation

@jakearchibald

@jakearchibald jakearchibald commented Jun 1, 2018 •

Copy link
Copy Markdown
Collaborator

@jakearchibald

Copy link
Copy Markdown
Collaborator Author

Tests: web-platform-tests/wpt#11291

@jakearchibald

jakearchibald commented Jun 1, 2018 •

Copy link
Copy Markdown
Collaborator Author

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

youennf commented Jun 1, 2018

Copy link
Copy Markdown
Contributor

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

jakearchibald commented Jun 1, 2018 •

Copy link
Copy Markdown
Collaborator Author

@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?

@domfarolino domfarolino left a comment

Copy link
Copy Markdown
Member

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
Copy Markdown
Collaborator Author

@annevk annevk left a comment

Copy link
Copy Markdown
Member

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.

Comment thread 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
Copy Markdown
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.

Comment thread fetch.bs Outdated
`<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
Copy Markdown
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

jakearchibald commented Jun 4, 2018 •

Copy link
Copy Markdown
Collaborator Author

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

Comment thread 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
Copy Markdown
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
Copy Markdown
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

annevk commented Jun 4, 2018

Copy link
Copy Markdown
Member

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

@jakearchibald

jakearchibald commented Jun 6, 2018 •

Copy link
Copy Markdown
Collaborator Author

@annevk

annevk commented Jun 6, 2018

Copy link
Copy Markdown
Member

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
dheiberg pushed a commit to dheiberg/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
jwidar pushed a commit to jwidar/LatencyZeroGithub that referenced this pull request Sep 16, 2025
…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
jwidar pushed a commit to jwidar/LatencyZeroGithub that referenced this pull request Sep 16, 2025
…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
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