# File lib/mongrel/rails.rb, line 51
51:       def process(request, response)
52:         if response.socket.closed?
53:           return
54:         end
55:         path_info = request.params[Mongrel::Const::PATH_INFO]
56:         path_info << $1 if request.params[Mongrel::Const::REQUEST_URI] =~ /^#{Regexp.escape path_info}(;[^\?]+)/
57:         page_cached = path_info + ActionController::Base.page_cache_extension
58:         get_or_head = @@file_only_methods.include? request.params[Mongrel::Const::REQUEST_METHOD]
59: 
60:         if get_or_head and @files.can_serve(path_info)
61:           # File exists as-is so serve it up
62:           @files.process(request,response)
63:         elsif get_or_head and @files.can_serve(page_cached)
64:           # Possible cached page, serve it up
65:           request.params[Mongrel::Const::PATH_INFO] = page_cached
66:           @files.process(request,response)
67:         else
68:           begin
69:             cgi = Mongrel::CGIWrapper.new(request, response)
70:             cgi.handler = self
71:             # We don't want the output to be really final until we're out of the lock
72:             cgi.default_really_final = false
73: 
74:             log_threads_waiting_for(@active_request_path || request.params[Mongrel::Const::PATH_INFO]) if $mongrel_debug_client
75: 
76:             @guard.synchronize {
77:               @active_request_path = request.params[Mongrel::Const::PATH_INFO] 
78:               Dispatcher.dispatch(cgi, ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS, response.body)
79:               @active_request_path = nil
80:             }
81: 
82:             # This finalizes the output using the proper HttpResponse way
83:             cgi.out("text/html",true) {""}
84:           rescue Errno::EPIPE
85:             response.socket.close
86:           rescue Object => rails_error
87:             STDERR.puts "#{Time.now}: Error calling Dispatcher.dispatch #{rails_error.inspect}"
88:             STDERR.puts rails_error.backtrace.join("\n")
89:           end
90:         end
91:       end