From 9159489872a1dd2038888b72b6990484a24ccad8 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Sat, 23 Jun 2007 00:13:40 +0000 Subject: [PATCH] Don't mistakenly interpret the request uri as the query string. Closes #8731. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7084 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/CHANGELOG | 2 ++ actionpack/lib/action_controller/cgi_process.rb | 4 ++-- actionpack/test/controller/cgi_test.rb | 5 +++++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG index 85d0a6f541..bff0c2868e 100644 --- a/actionpack/CHANGELOG +++ b/actionpack/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* Don't mistakenly interpret the request uri as the query string. #8731 [lifofifo, Jeremy Kemper] + * Make ActionView#view_paths an attr_accessor for real this time. Also, don't perform an unnecessary #compact on the @view_paths array in #initialize. Closes #8582 [dasil003, julik, rick] * Tolerate missing content type on multipart file uploads. Fix for Safari 3. [Jeremy Kemper] diff --git a/actionpack/lib/action_controller/cgi_process.rb b/actionpack/lib/action_controller/cgi_process.rb index edb7fb38d8..fa7afd4197 100644 --- a/actionpack/lib/action_controller/cgi_process.rb +++ b/actionpack/lib/action_controller/cgi_process.rb @@ -47,11 +47,11 @@ module ActionController #:nodoc: end def query_string - qs = @cgi.query_string + qs = @cgi.query_string if @cgi.respond_to?(:query_string) if !qs.blank? qs elsif uri = @env['REQUEST_URI'] - uri.split('?', 2).last + uri.split('?', 2)[1] || '' else @env['QUERY_STRING'] || '' end diff --git a/actionpack/test/controller/cgi_test.rb b/actionpack/test/controller/cgi_test.rb index da3ca245e1..a5b24ebcd4 100755 --- a/actionpack/test/controller/cgi_test.rb +++ b/actionpack/test/controller/cgi_test.rb @@ -67,6 +67,11 @@ class CgiRequestParamsParsingTest < BaseCgiTest @request.env['RAW_POST_DATA'] = data assert_equal({"flamenco"=> "love"}, @request.request_parameters) end + + def test_doesnt_interpret_request_uri_as_query_string_when_missing + @request.env['REQUEST_URI'] = 'foo' + assert_equal({}, @request.query_parameters) + end end