Skip to content
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

Add support for multipart/byterange responses #113

Closed
wants to merge 10 commits into from

Conversation

jcready
Copy link
Contributor

@jcready jcready commented Aug 2, 2016

Properly handles byte-range requests with multiple non-overlapping ranges by responding with a multipart/byterange response. For details on the specification for handling this type of request see RFC 7233

For example, a request looking like this:

GET /nums
Host: example.com
Range: bytes=0-1,3-3,5-6,7-8

Would generate a response like this:

HTTP/1.1 206 Partial Content
Accept-Ranges: bytes
ETag: W/"39aa72-153af0d74c0"
Content-Type: multipart/byteranges; boundary=BYTERANGE_1470163149308
Content-Disposition: attachment; filename="nums"
Date: Tue, 02 Aug 2016 18:39:09 GMT
Transfer-Encoding: chunked
Connection: close

--BYTERANGE_1470163149308
Content-Type: application/octet-stream
Content-Range: bytes 0-1/9

12
--BYTERANGE_1470163149308
Content-Type: application/octet-stream
Content-Range: bytes 3-3/9

4
--BYTERANGE_1470163149308
Content-Type: application/octet-stream
Content-Range: bytes 5-8/9

6789
--BYTERANGE_1470163149308--

@jcready jcready closed this Aug 4, 2016
@dougwilson dougwilson added the pr label Aug 14, 2016
@dougwilson dougwilson self-assigned this Aug 14, 2016
@dougwilson
Copy link
Contributor

Hi @jcready, sorry I haven't gotten around to looking at your PRs yet :) I see you closed this and opened #114 as an updated version of this PR, so I will make any comments over there (and linking them together for future reference).

@jcready
Copy link
Contributor Author

jcready commented Aug 21, 2016

@dougwilson no worries. I did close this one in favor of #114 since I had so many issues with getting the tests to pass in old versions of node on travis. Even using nvm to test old versions didn't seem to ensure they would also pass in travis (possible race condition issues when trying to simulate file stream errors).

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

Successfully merging this pull request may close these issues.

2 participants