diff --git a/lib/protocol/http1/connection.rb b/lib/protocol/http1/connection.rb index 9332b98..65b6232 100644 --- a/lib/protocol/http1/connection.rb +++ b/lib/protocol/http1/connection.rb @@ -136,8 +136,14 @@ def close end def write_request(authority, method, path, version, headers) + host = authority + if headers.include?("host") + host = headers["host"] + headers.delete "host" + end + @stream.write("#{method} #{path} #{version}\r\n") - @stream.write("host: #{authority}\r\n") + @stream.write("host: #{host}\r\n") write_headers(headers) end