lib/falcon/server.rb in falcon-0.8.0 vs lib/falcon/server.rb in falcon-0.9.0
- old
+ new
@@ -32,15 +32,17 @@
Async.logger
end
def handle_request(request, peer, address)
request_path, query_string = request.path.split('?', 2)
- server_name, server_port = request.headers.fetch('HTTP_HOST', '').split(':', 2)
+ server_name, server_port = (request.authority || '').split(':', 2)
input = StringIO.new(request.body || '')
input.set_encoding(Encoding::BINARY)
+ headers = request.headers.to_http_hash
+
env = {
'rack.version' => [2, 0, 0],
'rack.input' => input,
'rack.errors' => $stderr,
@@ -66,10 +68,10 @@
'rack.url_scheme' => 'http',
# I'm not sure what sane defaults should be here:
'SERVER_NAME' => server_name || '',
'SERVER_PORT' => server_port || '',
- }.merge(request.headers)
+ }.merge(headers)
env['rack.hijack?'] = true
env['rack.hijack'] = lambda do
env['rack.hijack_io'] = peer
end