diff options
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/CHANGELOG | 2 | ||||
-rwxr-xr-x | actionpack/lib/action_controller/request.rb | 2 | ||||
-rw-r--r-- | actionpack/test/controller/request_test.rb | 3 |
3 files changed, 5 insertions, 2 deletions
diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG index 21d8145ff1..d625d0afaf 100644 --- a/actionpack/CHANGELOG +++ b/actionpack/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* Cache relative_url_root for all webservers, not just Apache #2193 [skae] + * Speed up cookie use by decreasing string copying #2194 [skae] * Fixed access to "Host" header with requests made by crappy old HTTP/1.0 clients #2124 [Marcel Molina] diff --git a/actionpack/lib/action_controller/request.rb b/actionpack/lib/action_controller/request.rb index c3d440d815..00f411e7be 100755 --- a/actionpack/lib/action_controller/request.rb +++ b/actionpack/lib/action_controller/request.rb @@ -166,7 +166,7 @@ module ActionController # Returns the path minus the web server relative installation directory. # This method returns nil unless the web server is apache. def relative_url_root - @@relative_url_root ||= File.dirname(env["SCRIPT_NAME"].to_s).gsub(/(^\.$|^\/$)/, '') if server_software == 'apache' + @@relative_url_root ||= server_software == 'apache' ? File.dirname(env["SCRIPT_NAME"].to_s).gsub(/(^\.$|^\/$)/, '') : '' end # Returns the port number of this request as an integer. diff --git a/actionpack/test/controller/request_test.rb b/actionpack/test/controller/request_test.rb index 5bb5bc3469..2aeff279be 100644 --- a/actionpack/test/controller/request_test.rb +++ b/actionpack/test/controller/request_test.rb @@ -72,8 +72,9 @@ class RequestTest < Test::Unit::TestCase end def test_relative_url_root + @request.env['SCRIPT_NAME'] = "/hieraki/dispatch.cgi" @request.env['SERVER_SOFTWARE'] = 'lighttpd/1.2.3' - assert_nil @request.relative_url_root, "relative_url_root should be disabled on lighttpd" + assert_equal '', @request.relative_url_root, "relative_url_root should be disabled on lighttpd" @request.env['SERVER_SOFTWARE'] = 'apache/1.2.3 some random text' |