Skip to content

Commit 03e3e77

Browse files
Do not cache range requests
Fixes video streaming on Chrome
1 parent 52021a9 commit 03e3e77

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/webrick/httpservlet/filehandler.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,12 @@ def do_GET(req, res)
4646
mtime = st.mtime
4747
res['etag'] = sprintf("%x-%x-%x", st.ino, st.size, st.mtime.to_i)
4848

49-
if not_modified?(req, res, mtime, res['etag'])
50-
res.body = ''
51-
raise HTTPStatus::NotModified
52-
elsif req['range']
49+
if req['range']
5350
make_partial_content(req, res, @local_path, st.size)
5451
raise HTTPStatus::PartialContent
52+
elsif not_modified?(req, res, mtime, res['etag'])
53+
res.body = ''
54+
raise HTTPStatus::NotModified
5555
else
5656
mtype = HTTPUtils::mime_type(@local_path, @config[:MimeTypes])
5757
res['content-type'] = mtype

0 commit comments

Comments
 (0)