diff options
author | Michael Grosser <michael@grosser.it> | 2015-08-06 17:22:22 -0700 |
---|---|---|
committer | Michael Grosser <michael@grosser.it> | 2015-08-06 17:33:32 -0700 |
commit | a278630f5f1312f6986a866d3bc455c1056e554e (patch) | |
tree | fe573f71b243371cc701dbfbd55eadcb282c1de7 /actionpack/lib/action_dispatch/testing | |
parent | 07b2ff03d04656faccc68c83541b06e318a36ed7 (diff) | |
download | rails-a278630f5f1312f6986a866d3bc455c1056e554e.tar.gz rails-a278630f5f1312f6986a866d3bc455c1056e554e.tar.bz2 rails-a278630f5f1312f6986a866d3bc455c1056e554e.zip |
do not add common ports to HTTP_HOST
- webservers do not do it
- it makes redirect urls ugly when request.host is used for redirection
Diffstat (limited to 'actionpack/lib/action_dispatch/testing')
-rw-r--r-- | actionpack/lib/action_dispatch/testing/integration.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/actionpack/lib/action_dispatch/testing/integration.rb b/actionpack/lib/action_dispatch/testing/integration.rb index 0298962409..06605f5b33 100644 --- a/actionpack/lib/action_dispatch/testing/integration.rb +++ b/actionpack/lib/action_dispatch/testing/integration.rb @@ -325,7 +325,11 @@ module ActionDispatch if path =~ %r{://} location = URI.parse(path) https! URI::HTTPS === location if location.scheme - host! "#{location.host}:#{location.port}" if location.host + if url_host = location.host + default = Rack::Request::DEFAULT_PORTS[location.scheme] + url_host += ":#{location.port}" if default != location.port + host! url_host + end path = location.query ? "#{location.path}?#{location.query}" : location.path end |