joewalnes/webbit — Issue #49: Support HTTP partial content ranges
Author: joewalnes
Created: 2011-11-08 23:13:35+00:00
State: open

When the browser makes a request specifying the 'Range' header, Webbit should respond with HTTP 206 (Partial Content) instead of HTTP 200 and the appropriate Content-Range and Accept-Ranges headers.

At the moment, it doesn't and it manifests itself as a weird sound reliability bug. Chrome will make a Range request for specific types of media - such as audio and video. It appears to serve the content correctly, but attempting to play() the media a second time fails. I've verified (using Apache HTTPD) that this is not an issue if HTTP Range is implemented correctly.

----

Here's a TCP dump of a conversation between Chrome and the webserver for loading a sound via the tag. The first version is with Webbit, the second with Apache HTTPD.

Webbit:

GET /foo.wav HTTP/1.1
Host: localhost
Connection: keep-alive
Cache-Control: max-age=0
Accept-Encoding: identity;q=1, *;q=0
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/14.0.816.0 Safari/535.1
Accept: */*
Accept-Language: en-US,en;q=0.8
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
Range: bytes=0-

HTTP/1.1 200 OK
Server: Webbit
Content-Length: 46198

blahblahblah...

Apache:

GET /foo.wav HTTP/1.1
Host: localhost
Connection: keep-alive
Cache-Control: max-age=0
Accept-Encoding: identity;q=1, *;q=0
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/14.0.816.0 Safari/535.1
Accept: */*
Accept-Language: en-US,en;q=0.8
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
Range: bytes=0-

HTTP/1.1 206 Partial Content
Server: Apache-Coyote/1.1
Accept-Ranges: bytes
ETag: W/"184364-1320695950000"
Last-Modified: Mon, 07 Nov 2011 19:59:10 GMT
Content-Range: bytes 0-184363/184364
Content-Type: audio/x-wav
Content-Length: 46198
Date: Tue, 08 Nov 2011 23:00:47 GMT

blahblahblah...