lib/regurgitator/local_file.rb in regurgitator-0.8.0 vs lib/regurgitator/local_file.rb in regurgitator-0.9.0
- old
+ new
@@ -19,14 +19,14 @@
modified_since?(modified_since, stat) or return
end
size = stat.size
headers = {
- "Content-Type" => "application/octet-stream", # always ".fid"
+ "Content-Type" => "application/octet-stream".freeze, # always ".fid"
"Content-Length" => size.to_s,
"Last-Modified" => stat.mtime.httpdate,
- "Accept-Ranges" => "bytes",
+ "Accept-Ranges" => "bytes".freeze,
}
@response = [ 200, headers ]
ranges = Rack::Utils.get_byte_ranges(env['HTTP_RANGE'], size)
if nil == ranges || ranges.size > 1
@@ -36,11 +36,11 @@
headers["Content-Range"] = "bytes #{@range.begin}-#{@range.end}/#{size}"
headers["Content-Length"] = (@range.end - @range.begin + 1).to_s
else
@response[0] = 416
headers["Content-Range"] = "bytes */#{size}"
- headers["Content-Length"] = '0'
+ headers["Content-Length"] = '0'.freeze
@response << []
return
end
case env["REQUEST_METHOD"]
@@ -70,9 +70,10 @@
else
while fp.read(0x4000, buf)
yield buf
end
end
+ buf.clear
end
end
def modified_since?(modified_since, stat)
begin