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