-
Notifications
You must be signed in to change notification settings - Fork 342
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
Some servers seem to expect 'Accept-Encoding : identity' to serve Range requests #747
Comments
Isn't |
That's true, service workers shouldn't affect this. That would be a layering bug in WebKit and worth testing for if we don't test that already. What exactly we have to define as far as |
I'll do some research. It would be good to explicitly add |
What browsers seem to send along with ranged requests:
In terms of "I don't want any encoding", Chrome's value seems redundant compared to Safari's. Firefox's lack of header seems risky. Edge's is the least unusual vs other requests. I haven't tested whether Edge & Firefox actually accept encoded data. It seems really unusual that a server would require @youennf is this something you've seen a lot of servers require, or is it just the case in https://bugs.webkit.org/show_bug.cgi?id=184447? |
I did not make a lot of testing, SW+Media loading is currently broken in WebKit due to the stripping of the Range header. This is very visible in Safari since media loading will fail if not receiving a 206 response. Firefox and Edge might accept 200 responses even if they sent range requests. I guess that some let-s-try-to-serve-compressed-content server logic might kick in and drop the Range header information, even though in the end, the media content is served as is since already compressed. |
If we make spec changes due to this issue, it'd impact all range requests, not just ones going via a service worker. Unless a notable number of servers require this header in order to serve ranged responses, I'm fine with the differences between browsers here (provided they support those encodings), although I'd encourage Chrome to align with Safari.
Tangent: I'm planning to spec that range-requesting APIs should accept 200 responses, and somehow mark the resource as no-range-capable, so it doesn't try to make further range requests. This would apply for media and downloads. If you aren't happy with this, let me know and we can figure something out.
Good theory. I'll see if there's a way for us to get a representative sample to test. |
If WebKit is not aligned with this for downloads, I think we will be happy to align there. |
I'm going through some URLs, and yes, there are some that will only return a range if However, there are some URLs that do the opposite. https://www.narita-airport.jp/files/bg.mp4 will send back a 200 unless |
Hmm, I was hoping to try and align browsers when it comes to media. Is this because Safari uses a different stack it doesn't control? |
Ok, I have done research! I took all the URLs from HTTP Archive's latest crawl that end in Accuracy warning: A lot of these URLs seem to return different results each time. I think it can depend on whether the resource is cached by a CDN. Repo: /~https://github.com/jakearchibald/accept-encoding-range-test. Results: https://jakearchibald.github.io/accept-encoding-range-test/ (Chrome only due to transform streams). 3.21% of fetches fail to return a 206 response, specifically if there's a non-identity encoding specified. 0.36% of fetches fail to return a 206 response, specifically if the identity encoding is specified, or no encoding is provided. A few of these look like one-time errors, but some are reproducible. Based on that, it seems like Safari, Firefox, & Chrome are doing something right. If we spec any of them, it should be The repo includes a command to rerun the test for a particular URL if you want. @annevk Should this kind of weirdness be written into the spec? 3% is a lot. |
Yes, otherwise it's hard for Servo and similar such projects to compete. Ideally when you implement standards correctly, the web works. |
Ok, the spec change should be pretty small. If there's a range header, set Tests for this sort of stuff are a pain, but I should be able to reuse the stuff I created for the range tests I wrote recently. |
Reading the html version of the spec, we are currently appending 'identity' to Accept-Encoding header value. |
@youennf there cannot be a header named |
I understand this is a layering violation, and that theoretically, set and append in that case should give the exact same value. |
If you blindly implemented all specifications that would not happen, but I see how it can happen if you do it for one, but not the other. I think in that case it's fair that you're on your own though. You're always allowed to implement things in whatever way you want, as long as it's black box indistinguishable. And the tests will help you with such setups. |
Looking at the spec, 'set' is used in three places in the spec (preflight and Fetch API Response.redirect), where append could probably be used instead. |
As part of https://bugs.webkit.org/show_bug.cgi?id=184447, it seems https://test.shhnjk.com/media_test.html server is requiring 'Accept-Encoding : identity' to be in a request to serve range responses.
That might create some issues with multimedia loads intercepted by service workers.
The text was updated successfully, but these errors were encountered: