# File lib/mongrel/rails.rb, line 42
42:   def process(request, response)
43:     return if response.socket.closed?
44: 
45:     path_info = request.params[Mongrel::Const::PATH_INFO]
46:     page_cached = request.params[Mongrel::Const::PATH_INFO] + ".html"
47: 
48:     if @files.can_serve(path_info)
49:       # File exists as-is so serve it up
50:       @files.process(request,response)
51:     elsif @files.can_serve(page_cached)
52:       # possible cached page, serve it up      
53:       request.params[Mongrel::Const::PATH_INFO] = page_cached
54:       @files.process(request,response)
55:     else
56:       begin
57:         cgi = Mongrel::CGIWrapper.new(request, response)
58:         cgi.handler = self
59: 
60:         @guard.synchronize do
61:           # Rails is not thread safe so must be run entirely within synchronize 
62:           Dispatcher.dispatch(cgi, ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS, response.body)
63:         end
64: 
65:         # This finalizes the output using the proper HttpResponse way
66:         cgi.out {""}
67:       rescue Errno::EPIPE
68:         # ignored
69:       rescue Object => rails_error
70:         STDERR.puts "Error calling Dispatcher.dispatch #{rails_error.inspect}"
71:         STDERR.puts rails_error.backtrace.join("\n")
72:       end
73:     end
74:   end