diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-04-18 15:43:07 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-04-18 15:43:07 +0000 |
commit | 3b9bf64130df2512d058d841341d9a082493141e (patch) | |
tree | 4003e2fc24ca5ae11c41a29087665eef2eb1e4d6 /actionpack/lib/action_controller | |
parent | c1611a703c5366d7a85a5283ba1d721cfb5be43a (diff) | |
download | rails-3b9bf64130df2512d058d841341d9a082493141e.tar.gz rails-3b9bf64130df2512d058d841341d9a082493141e.tar.bz2 rails-3b9bf64130df2512d058d841341d9a082493141e.zip |
Added support for web servers that use PATH_INFO instead of REQUEST_URI like IIS #1014 [BradG/Nicholas Seckar]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1211 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib/action_controller')
-rw-r--r-- | actionpack/lib/action_controller/cgi_process.rb | 6 | ||||
-rwxr-xr-x | actionpack/lib/action_controller/request.rb | 12 |
2 files changed, 15 insertions, 3 deletions
diff --git a/actionpack/lib/action_controller/cgi_process.rb b/actionpack/lib/action_controller/cgi_process.rb index 4e3a1d270c..fb46c6d353 100644 --- a/actionpack/lib/action_controller/cgi_process.rb +++ b/actionpack/lib/action_controller/cgi_process.rb @@ -48,7 +48,11 @@ module ActionController #:nodoc: def query_string return @cgi.query_string unless @cgi.query_string.nil? || @cgi.query_string.empty? - parts = env['REQUEST_URI'].split('?') + unless env['REQUEST_URI'].nil? + parts = env['REQUEST_URI'].split('?') + else + return env['QUERY_STRING'] || '' + end parts.shift return parts.join('?') end diff --git a/actionpack/lib/action_controller/request.rb b/actionpack/lib/action_controller/request.rb index 032b19d6eb..f16a109cc7 100755 --- a/actionpack/lib/action_controller/request.rb +++ b/actionpack/lib/action_controller/request.rb @@ -74,8 +74,16 @@ module ActionController end def request_uri - (%r{^\w+\://[^/]+(/.*|$)$} =~ env['REQUEST_URI']) ? $1 : env['REQUEST_URI'] # Remove domain, which webrick puts into the request_uri. - end + unless env['REQUEST_URI'].nil? + (%r{^\w+\://[^/]+(/.*|$)$} =~ env['REQUEST_URI']) ? $1 : env['REQUEST_URI'] # Remove domain, which webrick puts into the request_uri. + else # REQUEST_URI is blank under IIS - get this from PATH_INFO and SCRIPT_NAME + script_filename = env["SCRIPT_NAME"].to_s.match(%r{[^/]+$}) + request_uri = env["PATH_INFO"] + request_uri.sub!(/#{script_filename}\//, '') unless script_filename.nil? + request_uri += '?' + env["QUERY_STRING"] unless env["QUERY_STRING"].nil? || env["QUERY_STRING"].empty? + return request_uri + end + end def protocol env["HTTPS"] == "on" ? 'https://' : 'http://' |