diff options
Diffstat (limited to 'lib/rainbows')
-rw-r--r-- | lib/rainbows/dev_fd_response.rb | 2 | ||||
-rw-r--r-- | lib/rainbows/response/body.rb | 2 | ||||
-rw-r--r-- | lib/rainbows/sendfile.rb | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/lib/rainbows/dev_fd_response.rb b/lib/rainbows/dev_fd_response.rb index b2367d7..ba1fdaa 100644 --- a/lib/rainbows/dev_fd_response.rb +++ b/lib/rainbows/dev_fd_response.rb @@ -31,7 +31,7 @@ class Rainbows::DevFdResponse < Struct.new(:app) return response if STATUS_WITH_NO_ENTITY_BODY.include?(status) io = body.to_io if body.respond_to?(:to_io) - io ||= File.open(body.to_path, 'rb') if body.respond_to?(:to_path) + io ||= File.open(body.to_path) if body.respond_to?(:to_path) return response if io.nil? headers = HeaderHash.new(headers) diff --git a/lib/rainbows/response/body.rb b/lib/rainbows/response/body.rb index e399df7..0a2bb5d 100644 --- a/lib/rainbows/response/body.rb +++ b/lib/rainbows/response/body.rb @@ -41,7 +41,7 @@ module Rainbows::Response::Body # :nodoc: # try to take advantage of Rainbows::DevFdResponse, calling File.open # is a last resort path = body.to_path - path =~ %r{\A/dev/fd/(\d+)\z} ? IO.new($1.to_i) : File.open(path, 'rb') + path =~ %r{\A/dev/fd/(\d+)\z} ? IO.new($1.to_i) : File.open(path) end end diff --git a/lib/rainbows/sendfile.rb b/lib/rainbows/sendfile.rb index c2e63be..2804217 100644 --- a/lib/rainbows/sendfile.rb +++ b/lib/rainbows/sendfile.rb @@ -65,7 +65,7 @@ class Rainbows::Sendfile < Struct.new(:app) # fallback in case our +to_path+ doesn't get handled for whatever reason def each(&block) buf = '' - File.open(to_path, 'rb') do |fp| + File.open(to_path) do |fp| yield buf while fp.read(0x4000, buf) end end |