-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
WIP #27272
base: master
Are you sure you want to change the base?
WIP #27272
Conversation
You mentioned putting JSON in the URL, which seems like a good idea: {
"responses": [
{ "redirect": "same-origin" },
{ "range": [0, 400] },
{ "range": [400, 500] },
{ "redirect": "same-origin" },
],
} …where "responses" details what each response in the sequence should be. If putting this in the URL becomes an issue, it could be sent to another endpoint, which stashes it, and returns a lookup token. The lookup token would go on the URL.
It might be easier to make the wav much shorter, and use progress events and I was surprised to hear that the error event wasn't working. I wonder if that's because any data after the wav header is valid, so browsers don't see it as a problem if it ends abruptly. Maybe a more complex format would help? |
I found out that Chrome seems to use the |
@jakearchibald @padenot @dalecurtis @youennf I would really appreciate it if you could take a look at this work in progress locally and tell me what else I should be poking at. Context here is whatwg/fetch#145 and annevk/orb#16, and eventually whatwg/html#2814. I would like us to find out how much we can restrict no-cors range requests from media elements. |
Is there a specific question you're looking for an answer too? I'm not really familiar with the tool or what you want to do here. |
@dalecurtis I would really like to know the exact details of Chrome's range request fetches when CORS is not involved. A specific question might be, why do I get the |
I don't recall all the particulars off hand, but here's the code: Low level cache structure for data from network: HTTP Response processor. Overall coordinator for network reads: Main WebMediaPlayer which constructs MultiBufferDataSource and uses it to feed ffmpeg and handle tainting: |
Anne, are you sure your modifications to long-wav.py are working correctly? Running the wpt server and using the following curl command w/o any modifications downloads quite a bit of data: curl -v -L -r 0- 'http://127.0.0.1:8001/fetch/range/resources/long-wav.py?chunked&source-key=6acb51e9-7a21-4b24-9f3f-7420f31c6891&scenario=redirect-second-request' --output file.bin However after making your modifications it only downloads 2048 bytes -- which is the same the Chrome loader gets. (Make sure to update the source-key between runs) |
@dalecurtis that's intentional, to encourage the browser to keep making range requests for subsequent blocks of data. If the redirect isn't there you'll see that Chrome ends up doing a lot of range requests, equivalent to other browsers. The discovery is that adding the redirect to the mix seems to prevent subsequent requests somehow (if the redirect was done in response to the second range request), though the redirect is first followed. @jakearchibald could you double check the Python for me just in case? |
@annevk I don't think that's working as intended, otherwise you'd expect curl to keep downloading? It's always possible curl and chrome have the same bug, but seems unlikely given the different code bases. |
Well, Firefox and Safari do keep fetching. Does |
-r 0- specifies the range request, -L means follow links. It's possible I've done something wrong though. |
I tried this locally and |
Thanks, sorry for the confusion on my part. I found the issue in Chrome. We were assigning content length to the pre-redirect data structure instead of the post-redirect one. Fix here: https://chromium-review.googlesource.com/c/chromium/src/+/2823523 Thanks for digging into this and revealing this issue in Chrome! |
@dalecurtis well, as discussed above and over email, perhaps this should not be fixed and instead be enshrined? That we don't follow redirects for subsequent media element range fetches? |
Happy to consider that after the fact, but the way this was broken probably has undesirable side effects -- even if they've gone unnoticed. The fix has landed on canary where I'll watch metrics to see the outcome, if all looks unchanged we can consider breaking this properly with an error instead of a hang. |
At least on canary there doesn't appear to be any changes from that fix, will check back after beta/dev. Then we can make a call on disabling it. https://bugs.chromium.org/p/chromium/issues/detail?id=1184798#c4 |
Appreciate the updates @dalecurtis! |
@jakearchibald this is the playground I used to inspect various behaviors in browsers. To test scenarios such as how browsers validate 206 responses, how they deal with cross-origin redirects after the initial 206 response, etc. I need some way to describe these scenarios and get
long-wav.py
to handle them. Hardcoding it all would work, but that does not seem exactly elegant. Was wondering if you had ideas.Also with respect to what to observe on the media element side for success. Or would success mean that it either continues or doesn't continue making requests?