sendFilePart status code and Content-Length header

46 views
Skip to first unread message

Tero Laitinen

unread,
Jun 6, 2013, 4:09:27 AM6/6/13
to yeso...@googlegroups.com
I'm trying to get HTML5 audio seeking to work with range requests. 

I would like to use sendFilePart , but it seems to return always 200 OK as the response status code. In my use case, 206 Partial concent would be needed to implement streaming and seeking larger audio files.

Also, I'm unable to set "Content-Length" header with addHeader . 

An example illustrating the problem can be found at http://hpaste.org/89395 .

The response contains the following headers:

< HTTP/1.1 200 OK
< Date: Thu, 06 Jun 2013 07:56:34 GMT
< Server: Warp/1.3.8.1
< Content-Type: audio/mpeg
< Vary: Accept,Accept-Language
< Accept-Ranges: bytes
< Content-Range: bytes 0-100000/3733593
< Set-Cookie: _SESSION=h6/MhXFz+rrv3SIylOd33xQ9JuWJyYM/tmNlv1pTrd4Nfb6RARQ7S1i2W6Ev+lnim2y83j3exjYpHKGGysvooBceiPonugvnEDJSnU8eB1+6kahBnZDqrWIC2ZgCwn1mMrC2KJA8SrU=; Path=/; Expires=Tue, 11-Jun-2013 07:56:25 GMT; HttpOnly
< Transfer-Encoding: chunked




Tero Laitinen

unread,
Jun 6, 2013, 4:21:53 AM6/6/13
to yeso...@googlegroups.com
With sendWaiResponse I can set the status code, but content-length still seems to disappear  http://hpaste.org/89398  

Tero Laitinen

unread,
Jun 6, 2013, 5:53:27 AM6/6/13
to yeso...@googlegroups.com
HTML5 audio streaming and seeking seems to working without Content-Length. An example handler that also parses range request header is at http://hpaste.org/89401 . 

Michael Snoyman

unread,
Jun 6, 2013, 6:00:12 AM6/6/13
to yeso...@googlegroups.com
Strangely, in my local testing, the content-length header seems to get set. Perhaps you received a chunked response body?


--
You received this message because you are subscribed to the Google Groups "Yesod Web Framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to yesodweb+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Tero Laitinen

unread,
Jun 6, 2013, 6:03:55 AM6/6/13
to yeso...@googlegroups.com, mic...@snoyman.com
I get the following reply:

$ curl -v -H "Range: bytes=0-0" http://localhost:3001/
* About to connect() to localhost port 3001 (#0)
*   Trying 127.0.0.1... connected
> GET / HTTP/1.1
> User-Agent: curl/7.22.0 (x86_64-pc-linux-gnu) libcurl/7.22.0 OpenSSL/1.0.1 zlib/1.2.3.4 libidn/1.23 librtmp/2.3
> Host: localhost:3001
> Accept: */*
> Range: bytes=0-0

< HTTP/1.1 206 Partial Content
< Transfer-Encoding: chunked
< Server: Warp/1.3.8.1
< Accept-Ranges: bytes
< Content-Range: bytes 0-0/3733593

* Connection #0 to host localhost left intact
* Closing connection #0
Reply all
Reply to author
Forward
0 new messages