diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2007-01-12 07:01:39 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2007-01-12 07:01:39 +0000 |
commit | fe736a54f914b7cf406988f42df6c5c129d821a5 (patch) | |
tree | 2ff6867d89630f13f674f0f76498a978e6a99ecf /actionpack/lib | |
parent | 89b472aa0cba44aa908348769abcde74025f6ec4 (diff) | |
download | rails-fe736a54f914b7cf406988f42df6c5c129d821a5.tar.gz rails-fe736a54f914b7cf406988f42df6c5c129d821a5.tar.bz2 rails-fe736a54f914b7cf406988f42df6c5c129d821a5.zip |
Set request.env['REQUEST_URI'] when absent.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5895 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib')
-rwxr-xr-x | actionpack/lib/action_controller/request.rb | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/actionpack/lib/action_controller/request.rb b/actionpack/lib/action_controller/request.rb index 8c21adb8df..62ce9929da 100755 --- a/actionpack/lib/action_controller/request.rb +++ b/actionpack/lib/action_controller/request.rb @@ -145,19 +145,21 @@ module ActionController @env['RAW_POST_DATA'] end - # Returns the request URI correctly, taking into account the idiosyncracies - # of the various servers. + # Return the request URI, accounting for server idiosyncracies. + # WEBrick includes the full URL. IIS leaves REQUEST_URI blank. def request_uri if uri = @env['REQUEST_URI'] - (%r{^\w+\://[^/]+(/.*|$)$} =~ uri) ? $1 : 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 + # Remove domain, which webrick puts into the request_uri. + (%r{^\w+\://[^/]+(/.*|$)$} =~ uri) ? $1 : uri + else + # Construct IIS missing REQUEST_URI from SCRIPT_NAME and PATH_INFO. script_filename = @env['SCRIPT_NAME'].to_s.match(%r{[^/]+$}) uri = @env['PATH_INFO'] uri = uri.sub(/#{script_filename}\//, '') unless script_filename.nil? unless (env_qs = @env['QUERY_STRING']).nil? || env_qs.empty? uri << '?' << env_qs end - uri + @env['REQUEST_URI'] = uri end end |