Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Cache relative_url_root for all webservers, not just Apache #2193 [skae]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2246 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
commit e9504bb6f785a3e38788c9d787eef07d464fdd0c 1 parent b37d7a7
@dhh dhh authored
View
2  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]
View
2  actionpack/lib/action_controller/request.rb
@@ -166,7 +166,7 @@ def path
# 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.
View
3  actionpack/test/controller/request_test.rb
@@ -72,8 +72,9 @@ def test_port_string
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'
Please sign in to comment.
Something went wrong with that request. Please try again.