mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Removed the reliance on PATH_INFO as it was causing problems for caching and inhibited the new non-vhost support #822 [Nicholas Seckar]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@901 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
parent
9982578efb
commit
193edfbfdb
3 changed files with 3 additions and 16 deletions
|
@ -1,5 +1,7 @@
|
||||||
*SVN*
|
*SVN*
|
||||||
|
|
||||||
|
* Removed the reliance on PATH_INFO as it was causing problems for caching and inhibited the new non-vhost support #822 [Nicholas Seckar]
|
||||||
|
|
||||||
* Added assigns shortcut for @response.template.assigns to controller test cases [bitsweat]. Example:
|
* Added assigns shortcut for @response.template.assigns to controller test cases [bitsweat]. Example:
|
||||||
|
|
||||||
Before:
|
Before:
|
||||||
|
|
|
@ -77,10 +77,6 @@ module ActionController
|
||||||
(%r{^\w+\://[^/]+(/.*|$)$} =~ env['REQUEST_URI']) ? $1 : env['REQUEST_URI'] # Remove domain, which webrick puts into the request_uri.
|
(%r{^\w+\://[^/]+(/.*|$)$} =~ env['REQUEST_URI']) ? $1 : env['REQUEST_URI'] # Remove domain, which webrick puts into the request_uri.
|
||||||
end
|
end
|
||||||
|
|
||||||
def path_info
|
|
||||||
(/^(.*)\.html$/ =~ env['PATH_INFO']) ? $1 : env['PATH_INFO']
|
|
||||||
end
|
|
||||||
|
|
||||||
def protocol
|
def protocol
|
||||||
env["HTTPS"] == "on" ? 'https://' : 'http://'
|
env["HTTPS"] == "on" ? 'https://' : 'http://'
|
||||||
end
|
end
|
||||||
|
@ -90,7 +86,7 @@ module ActionController
|
||||||
end
|
end
|
||||||
|
|
||||||
def path
|
def path
|
||||||
(path_info && !path_info.empty?) ? path_info : (request_uri ? request_uri.split('?').first : '')
|
request_uri ? request_uri.split('?').first : ''
|
||||||
end
|
end
|
||||||
|
|
||||||
def port
|
def port
|
||||||
|
|
|
@ -54,17 +54,6 @@ class RequestTest < Test::Unit::TestCase
|
||||||
assert_equal "/", @request.path
|
assert_equal "/", @request.path
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_path_info
|
|
||||||
@request.env["PATH_INFO"] = "/path/of/some/uri"
|
|
||||||
assert_equal "/path/of/some/uri", @request.path_info
|
|
||||||
assert_equal "/path/of/some/uri", @request.path
|
|
||||||
|
|
||||||
# PATH_INFO actually has a .html suffix on many servers. But we don't want Rails to see the .html part.
|
|
||||||
@request.env["PATH_INFO"] = "/path/of/some/uri.html"
|
|
||||||
assert_equal "/path/of/some/uri", @request.path_info
|
|
||||||
assert_equal "/path/of/some/uri", @request.path
|
|
||||||
end
|
|
||||||
|
|
||||||
def test_host_with_port
|
def test_host_with_port
|
||||||
@request.env['HTTP_HOST'] = "rubyonrails.org:8080"
|
@request.env['HTTP_HOST'] = "rubyonrails.org:8080"
|
||||||
assert_equal "rubyonrails.org:8080", @request.host_with_port
|
assert_equal "rubyonrails.org:8080", @request.host_with_port
|
||||||
|
|
Loading…
Reference in a new issue