Skip to content

Do not cache range requests #169

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

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

Conversation

ThatHackerDudeFromCyberspace

File streaming, at least for videos is broken in the current version of Webrick
image

It seems that Chrome (and other browsers?) closes the initial Range request early, as such the server believes that the rest of the file is cached by the browser despite this not being the case.
As such, when the browser requests the rest of the file, the server responds with 304 - which causes streaming to fail

A simple fix for this is simply to not cache range requests

Fixes video streaming on Chrome
@jeremyevans
Copy link
Contributor

Can you check what headers the browser is sending? It looks like the if-range header is handled incorrectly by webrick (should return 206 and not 304 if there has been no modification).

I don't think this patch is correct, since the server should return 304 in the cases where if-modified-since/if-none-match is provided and there is no modification, even for range requests. Behavior should only be changed for if-range, I think. We should probably move the if-range handling out of not_modified? and put it directly in the elsif req['range'] block, fixing it to return 206 (no modification) or 200 (if modified).

Additionally, the patch should only include updated tests.

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

Successfully merging this pull request may close these issues.

2 participants