Issues with range requests on Safari/iOS #549
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR Closes #277 and tries to fix issues with media streaming on Safari/iOS. Safari/iOS handles http2 response headers more strictly.
Changes
The spec states the http range requests can return a content-length header but this header should contain the length of the range being requested. To ensure this is the case the code no longer sends a content-length header by default when doing streaming requests, this header would contain the complete length of the file and that goes against the spec.
Safari sends an initial 0-1/xxxx range request to test if the server can handle range requests correctly. It seems that if the response to this request contains a content-length Safari will not accept the response.
Its unclear if this is a Safari issue, or a more broader http2 issue. This problem can also be tested when using curl:
curl --range 0-1 "http://example.com/file" -o /dev/null
Before the changes this request results into a
curl: (92) HTTP/2 stream 0 was not closed cleanly: PROTOCOL_ERROR (err 1)
error, while after the changed the request completes without errors.