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

Incorrect range Headers and missing partial content implementation #2310

Closed
kahwee opened this issue Aug 15, 2016 · 1 comment · Fixed by karronoli/redpen#10 · May be fixed by Omrisnyk/npm-lockfiles#122 or Omrisnyk/npm-lockfiles#132

Comments

@kahwee
Copy link
Contributor

kahwee commented Aug 15, 2016

206 Partial Content is incorrectly implemented causing some video files (MP4) to fail. This is caused by the introduction of range headers in a567b6f in issue #2140

Expected behavior

According to RFC 2616, the byte-range-resp-spec should be (first-byte-pos "-" last-byte-pos).

For example, if the resource is of length 1234 and the range request is for bytes 500-, the range should be 500-1233/1234

If my resource is 229,255 bytes and I request it with:

Range: bytes=0-

I expect:

HTTP/1.1 206 Partial Content
Accept-Ranges: bytes
Content-Range: bytes 0-229254/229255
Content-Length: 229255

Actual behavior

Currently, when my resource is 229,255 bytes and I request it with karma v1.2.0:

Range: bytes=0-

I am receiving:

HTTP/1.1 206 Partial Content
Content-Range: bytes 0-229255/229255

Few things are wrong here:

  • Content-Range should be bytes 0-229254/229255 instead of 0-229255/229255
  • Should return Accept-Ranges
  • We should return Content-Length since it's recommended for application to implement according to RFC 2616.

Also I recommend we use range-parser for this.

Environment Details

Introduced in Karma v1.2.0. In v1.1.2, this is fine.

Fails in Chrome 52 and Chrome 53, in Mac OS X, Windows and Ubuntu.

Steps to reproduce the behaviour

  1. Use files to serve a small MP4 asset in Chrome 52 or Chrome 53.
  2. Asset will not load as range headers are wrong, this causes video not to play
@kahwee
Copy link
Contributor Author

kahwee commented Aug 16, 2016

@dignifiedquire I'll take this.

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