diff options
-rw-r--r-- | lib/rainbows/response.rb | 5 | ||||
-rw-r--r-- | lib/rainbows/sync_close.rb | 8 |
2 files changed, 5 insertions, 8 deletions
diff --git a/lib/rainbows/response.rb b/lib/rainbows/response.rb index 8d0de1d..b7b6aa8 100644 --- a/lib/rainbows/response.rb +++ b/lib/rainbows/response.rb @@ -128,6 +128,11 @@ module Rainbows::Response unless IO.method_defined?(:trysendfile) module CopyStream def write_body_file(body, range) + # ensure sendfile gets used for SyncClose objects: + if !body.kind_of?(IO) && body.respond_to?(:to_path) + body = body.to_path + end + range ? COPY_STREAM.copy_stream(body, self, range[1], range[0]) : COPY_STREAM.copy_stream(body, self) end diff --git a/lib/rainbows/sync_close.rb b/lib/rainbows/sync_close.rb index 8738cae..999f003 100644 --- a/lib/rainbows/sync_close.rb +++ b/lib/rainbows/sync_close.rb @@ -16,14 +16,6 @@ class Rainbows::SyncClose @body.respond_to?(m) end - def readpartial(*args) - @body.readpartial(*args) - end - - def read(*args) - @body.read(*args) - end - def to_path @body.to_path end |