You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
655 B
Ruby
17 lines
655 B
Ruby
# Dev-server-only fix: WEBrick's FileHandler#not_modified? treats a Range
|
|
# request's If-Range header the same as If-None-Match, replying 304 (no body)
|
|
# instead of 206 with the requested bytes. Browsers rely on ranged requests
|
|
# (with If-Range) to fetch a video's trailing moov atom when seeking/loading
|
|
# metadata, so this breaks video playback under `jekyll serve`.
|
|
# See https://github.com/ruby/webrick/blob/master/lib/webrick/httpservlet/filehandler.rb
|
|
#
|
|
require 'webrick'
|
|
|
|
module WebrickRangeFix
|
|
def not_modified?(req, res, mtime, etag)
|
|
req['Range'] ? false : super
|
|
end
|
|
end
|
|
|
|
WEBrick::HTTPServlet::DefaultFileHandler.prepend(WebrickRangeFix)
|