diff options
author | zedshaw <zedshaw@19e92222-5c0b-0410-8929-a290d50e31e9> | 2006-09-03 19:47:53 +0000 |
---|---|---|
committer | zedshaw <zedshaw@19e92222-5c0b-0410-8929-a290d50e31e9> | 2006-09-03 19:47:53 +0000 |
commit | 17a3d3d4a9a56a55c18f39518134701a92f9a2a8 (patch) | |
tree | 67a4626be1e14546fc3909c8c41d61997e57bf50 /lib/mongrel | |
parent | 60364dd75416e42e090917eabe77993117a07abb (diff) | |
download | unicorn-17a3d3d4a9a56a55c18f39518134701a92f9a2a8.tar.gz |
git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@341 19e92222-5c0b-0410-8929-a290d50e31e9
Diffstat (limited to 'lib/mongrel')
-rw-r--r-- | lib/mongrel/handlers.rb | 2 | ||||
-rw-r--r-- | lib/mongrel/rails.rb | 12 |
2 files changed, 8 insertions, 6 deletions
diff --git a/lib/mongrel/handlers.rb b/lib/mongrel/handlers.rb index 3bf8d08..4d36e8b 100644 --- a/lib/mongrel/handlers.rb +++ b/lib/mongrel/handlers.rb @@ -234,7 +234,7 @@ module Mongrel response.send_header if not header_only - response.send_file(req_path) + response.send_file(req_path, stat.size < Const::CHUNK_SIZE * 2) end end end diff --git a/lib/mongrel/rails.rb b/lib/mongrel/rails.rb index 5dcbf7f..ca430d5 100644 --- a/lib/mongrel/rails.rb +++ b/lib/mongrel/rails.rb @@ -56,7 +56,9 @@ module Mongrel # * If it exists at PATH_INFO+".html" exists then serve that. # * Finally, construct a Mongrel::CGIWrapper and run Dispatcher.dispatch to have Rails go. def process(request, response) - return if response.socket.closed? + if response.socket.closed? + return + end path_info = request.params[Mongrel::Const::PATH_INFO] page_cached = path_info + ".html" @@ -66,7 +68,7 @@ module Mongrel # File exists as-is so serve it up @files.process(request,response) elsif get_or_head and @files.can_serve(page_cached) - # possible cached page, serve it up + # possible cached page, serve it up request.params[Mongrel::Const::PATH_INFO] = page_cached @files.process(request,response) else @@ -76,7 +78,7 @@ module Mongrel # we don't want the output to be really final until we're out of the lock cgi.default_really_final = false - log_threads_waiting_for(request.params["PATH_INFO"]) + log_threads_waiting_for(request.params["PATH_INFO"]) if $mongrel_debug_client @guard.synchronize(:EX) { Dispatcher.dispatch(cgi, ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS, response.body) @@ -85,7 +87,7 @@ module Mongrel # This finalizes the output using the proper HttpResponse way cgi.out("text/html",true) {""} rescue Errno::EPIPE - # ignored + response.socket.close rescue Object => rails_error STDERR.puts "#{Time.now}: Error calling Dispatcher.dispatch #{rails_error.inspect}" STDERR.puts rails_error.backtrace.join("\n") @@ -94,7 +96,7 @@ module Mongrel end def log_threads_waiting_for(event) - if $mongrel_debug_client and (Time.now - @tick > 10) + if Time.now - @tick > 10 STDERR.puts "#{Time.now}: #{@guard.sync_waiting.length} threads sync_waiting for #{event}, #{self.listener.workers.list.length} still active in mongrel." @tick = Time.now end |