diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG index 72193628851ad..c8c8000b91e09 100644 --- a/actionpack/CHANGELOG +++ b/actionpack/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* Cache parsed query parameters. #6559 [Stefan Kaes] + * Deprecate JavaScriptHelper#update_element_function, which is superseeded by RJS [Thomas Fuchs] * Fix invalid test fixture exposed by stricter Ruby 1.8.5 multipart parsing. #6524 [Bob Silva] diff --git a/actionpack/lib/action_controller/cgi_process.rb b/actionpack/lib/action_controller/cgi_process.rb index 50cf93defed39..10a3f08b919fb 100644 --- a/actionpack/lib/action_controller/cgi_process.rb +++ b/actionpack/lib/action_controller/cgi_process.rb @@ -8,13 +8,13 @@ class Base # sessions (large performance increase if sessions are not needed). The session_options are the same as for CGI::Session: # # * :database_manager - standard options are CGI::Session::FileStore, CGI::Session::MemoryStore, and CGI::Session::PStore - # (default). Additionally, there is CGI::Session::DRbStore and CGI::Session::ActiveRecordStore. Read more about these in + # (default). Additionally, there is CGI::Session::DRbStore and CGI::Session::ActiveRecordStore. Read more about these in # lib/action_controller/session. # * :session_key - the parameter name used for the session id. Defaults to '_session_id'. # * :session_id - the session id to use. If not provided, then it is retrieved from the +session_key+ parameter # of the request, or automatically generated for a new session. # * :new_session - if true, force creation of a new session. If not set, a new session is only created if none currently - # exists. If false, a new session is never created, and if none currently exists and the +session_id+ option is not set, + # exists. If false, a new session is never created, and if none currently exists and the +session_id+ option is not set, # an ArgumentError is raised. # * :session_expires - the time the current session expires, as a +Time+ object. If not set, the session will continue # indefinitely. @@ -22,10 +22,10 @@ class Base # server. # * :session_secure - if +true+, this session will only work over HTTPS. # * :session_path - the path for which this session applies. Defaults to the directory of the CGI script. - def self.process_cgi(cgi = CGI.new, session_options = {}) + def self.process_cgi(cgi = CGI.new, session_options = {}) new.process_cgi(cgi, session_options) end - + def process_cgi(cgi, session_options = {}) #:nodoc: process(CgiRequest.new(cgi, session_options), CgiResponse.new(cgi)).out end @@ -51,7 +51,7 @@ def query_string if (qs = @cgi.query_string) && !qs.empty? qs elsif uri = @env['REQUEST_URI'] - parts = uri.split('?') + parts = uri.split('?') parts.shift parts.join('?') else @@ -60,7 +60,8 @@ def query_string end def query_parameters - (qs = self.query_string).empty? ? {} : CGIMethods.parse_query_parameters(qs) + @query_parameters ||= + (qs = self.query_string).empty? ? {} : CGIMethods.parse_query_parameters(qs) end def request_parameters @@ -71,7 +72,7 @@ def request_parameters CGIMethods.parse_request_parameters(@cgi.params) end end - + def cookies @cgi.cookies.freeze end