Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Request#env['SERVER_NAME'] does not contain port number

  • Loading branch information...
commit fec0ea9d6d4ca56a09e3e83002c38d69c8ad924e 1 parent c0c79f7
@lifo lifo authored
View
2  actionpack/lib/action_controller/request.rb
@@ -286,7 +286,7 @@ def raw_host_with_port
if forwarded = env["HTTP_X_FORWARDED_HOST"]
forwarded.split(/,\s?/).last
else
- env['HTTP_HOST'] || env['SERVER_NAME'] || "#{env['SERVER_ADDR']}:#{env['SERVER_PORT']}"
+ env['HTTP_HOST'] || "#{env['SERVER_NAME'] || env['SERVER_ADDR']}:#{env['SERVER_PORT']}"
end
end
View
6 actionpack/lib/action_controller/test_process.rb
@@ -33,11 +33,7 @@ class TestRequest < Request #:nodoc:
attr_accessor :host
def initialize
- env = Rack::MockRequest.env_for("/")
-
- # TODO: Fix Request to assume env['SERVER_ADDR'] doesn't contain port number
- env['SERVER_ADDR'] = env.delete("SERVER_NAME")
- super(env)
+ super(Rack::MockRequest.env_for("/"))
@query_parameters = {}
@session = TestSession.new
View
4 actionpack/test/controller/rack_test.rb
@@ -4,7 +4,7 @@ class BaseRackTest < Test::Unit::TestCase
def setup
@env = {
"HTTP_MAX_FORWARDS" => "10",
- "SERVER_NAME" => "glu.ttono.us:8007",
+ "SERVER_NAME" => "glu.ttono.us",
"FCGI_ROLE" => "RESPONDER",
"AUTH_TYPE" => "Basic",
"HTTP_X_FORWARDED_HOST" => "glu.ttono.us",
@@ -145,7 +145,7 @@ def test_cgi_environment_variables
assert_equal "kevin", @request.remote_user
assert_equal :get, @request.request_method
assert_equal "/dispatch.fcgi", @request.script_name
- assert_equal "glu.ttono.us:8007", @request.server_name
+ assert_equal "glu.ttono.us", @request.server_name
assert_equal 8007, @request.server_port
assert_equal "HTTP/1.1", @request.server_protocol
assert_equal "lighttpd", @request.server_software
Please sign in to comment.
Something went wrong with that request. Please try again.