diff options
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/CHANGELOG | 2 | ||||
-rwxr-xr-x | actionpack/lib/action_controller/request.rb | 3 | ||||
-rw-r--r-- | actionpack/test/controller/request_test.rb | 5 |
3 files changed, 9 insertions, 1 deletions
diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG index 3f46ecc1b4..bc7b169985 100644 --- a/actionpack/CHANGELOG +++ b/actionpack/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* More robust relative url root discovery for SCGI compatibility. This solves the 'SCGI routes problem' -- you no longer need to prefix all your routes with the name of the SCGI mountpoint. #3070 [Dave Ringoen] + * Fix docs for text_area_tag. #3083. [Christopher Cotton] * Change form_for and fields_for method signatures to take object name and object as separate arguments rather than as a Hash. [DHH] diff --git a/actionpack/lib/action_controller/request.rb b/actionpack/lib/action_controller/request.rb index 57b7eea366..7203f4b789 100755 --- a/actionpack/lib/action_controller/request.rb +++ b/actionpack/lib/action_controller/request.rb @@ -169,7 +169,8 @@ 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 ||= server_software == 'apache' ? File.dirname(env["SCRIPT_NAME"].to_s).gsub(/(^\.$|^\/$)/, '') : '' + @@relative_url_root ||= server_software == 'apache' ? env["SCRIPT_NAME"].to_s.sub(/\/dispatch\.(fcgi|rb|cgi)$/, '') : '' + 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 ecc056960c..f941857c48 100644 --- a/actionpack/test/controller/request_test.rb +++ b/actionpack/test/controller/request_test.rb @@ -100,6 +100,11 @@ class RequestTest < Test::Unit::TestCase @request.relative_url_root = nil @request.env['SCRIPT_NAME'] = "/collaboration/hieraki/dispatch.cgi" assert_equal "/collaboration/hieraki", @request.relative_url_root + + # apache/scgi case + @request.relative_url_root = nil + @request.env['SCRIPT_NAME'] = "/collaboration/hieraki" + assert_equal "/collaboration/hieraki", @request.relative_url_root end def test_request_uri |