diff options
author | why <why@19e92222-5c0b-0410-8929-a290d50e31e9> | 2006-04-11 00:00:52 +0000 |
---|---|---|
committer | why <why@19e92222-5c0b-0410-8929-a290d50e31e9> | 2006-04-11 00:00:52 +0000 |
commit | 3cf03ae9f3f12c5dd754f4d02cd9086fe804e0c2 (patch) | |
tree | 2446e1c29383603bb1fdc9d9c1d44990f421dfe2 /lib/mongrel/handlers.rb | |
parent | 894f4a0bd3407d99b779e739ef3c8c42c64bd4b1 (diff) | |
download | unicorn-3cf03ae9f3f12c5dd754f4d02cd9086fe804e0c2.tar.gz |
git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@155 19e92222-5c0b-0410-8929-a290d50e31e9
Diffstat (limited to 'lib/mongrel/handlers.rb')
-rw-r--r-- | lib/mongrel/handlers.rb | 23 |
1 files changed, 1 insertions, 22 deletions
diff --git a/lib/mongrel/handlers.rb b/lib/mongrel/handlers.rb index 6496d90..f9ad95f 100644 --- a/lib/mongrel/handlers.rb +++ b/lib/mongrel/handlers.rb @@ -1,12 +1,3 @@ -require 'rubygems' -begin - require 'sendfile' - $mongrel_has_sendfile = true - STDERR.puts "** You have sendfile installed, will use that to serve files." -rescue Object - $mongrel_has_sendfile = false -end - module Mongrel # You implement your application handler with this. It's very light giving @@ -188,22 +179,10 @@ module Mongrel response.send_header if not header_only - begin - if $mongrel_has_sendfile - File.open(req, "rb") { |f| response.socket.sendfile(f) } - else - File.open(req, "rb") { |f| response.socket.write(f.read) } - end - rescue EOFError,Errno::ECONNRESET,Errno::EPIPE,Errno::EINVAL,Errno::EBADF - # ignore these since it means the client closed off early - STDERR.puts "Client closed socket requesting file #{req}: #$!" - end - else - response.send_body # should send nothing + response.send_file(req) end end - # Process the request to either serve a file or a directory listing # if allowed (based on the listing_allowed paramter to the constructor). def process(request, response) |