diff --git a/actionpack/lib/action_dispatch/testing/integration.rb b/actionpack/lib/action_dispatch/testing/integration.rb index 84039c06ab4c0..404b6185c2574 100644 --- a/actionpack/lib/action_dispatch/testing/integration.rb +++ b/actionpack/lib/action_dispatch/testing/integration.rb @@ -257,19 +257,19 @@ def process(method, path, parameters = nil, rack_environment = nil) end end - port = host.split(':')[1] + hostname, port = host.split(':') env = { :method => method, :params => parameters, - "SERVER_NAME" => host.split(':')[0], + "SERVER_NAME" => hostname, "SERVER_PORT" => (port ? port : (https? ? "443" : "80")), "HTTPS" => https? ? "on" : "off", "rack.url_scheme" => https? ? "https" : "http", "REQUEST_URI" => path, - "HTTP_HOST" => [host, port].compact.join(':'), + "HTTP_HOST" => host, "REMOTE_ADDR" => remote_addr, "CONTENT_TYPE" => "application/x-www-form-urlencoded", "HTTP_ACCEPT" => accept