# File lib/mongrel/camping.rb, line 46
      def process(request, response)
        if response.socket.closed?
          return
        end

        controller = nil
        @guard.synchronize {
          controller = @klass.run(request.body, request.params)
        }

        sendfile, clength = nil
        response.status = controller.status
        controller.headers.each do |k, v|
          if k =~ /^X-SENDFILE$/i
            sendfile = v
          elsif k =~ /^CONTENT-LENGTH$/i
            clength = v.to_i
          else
            [*v].each do |vi|
              response.header[k] = vi
            end
          end
        end

        if sendfile
          request.params[Mongrel::Const::PATH_INFO] = sendfile
          @files.process(request, response)
        elsif controller.body.respond_to? :read
          response.send_status(clength)
          response.send_header
          while chunk = controller.body.read(16384)
            response.write(chunk)
          end
          if controller.body.respond_to? :close
            controller.body.close
          end
        else
          body = controller.body.to_s
          response.send_status(body.length)
          response.send_header
          response.write(body)
        end
      end