def process(request, response)
env = {}.replace(request.params)
env.delete Merb::Const::HTTP_CONTENT_TYPE
env.delete Merb::Const::HTTP_CONTENT_LENGTH
env[Merb::Const::SCRIPT_NAME] = Merb::Const::EMPTY_STRING if env[Merb::Const::SCRIPT_NAME] == Merb::Const::SLASH
env.update({"rack.version" => [0,1],
"rack.input" => request.body || StringIO.new(""),
"rack.errors" => STDERR,
"rack.multithread" => true,
"rack.multiprocess" => false,
"rack.run_once" => false,
"rack.url_scheme" => "http"
})
env[Merb::Const::QUERY_STRING] ||= ""
env.delete Merb::Const::PATH_INFO if env[Merb::Const::PATH_INFO] == Merb::Const::EMPTY_STRING
status, headers, body = @app.call(env)
begin
response.status = status.to_i
headers.each { |k, vs|
vs.each { |v|
response.header[k] = v
}
}
body.each { |part|
response.body << part
}
response.finished
ensure
body.close if body.respond_to? :close
end
end