aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorNicholas Seckar <nseckar@gmail.com>2005-09-08 11:28:54 +0000
committerNicholas Seckar <nseckar@gmail.com>2005-09-08 11:28:54 +0000
commit689cca132a7da77c80637a938740f40277384fe9 (patch)
tree8f3a0745c7d2e59313e1de1ee61eaf6dbe60515e /actionpack
parent7b235f0213599c4c20966f89889baba3b8ad7006 (diff)
downloadrails-689cca132a7da77c80637a938740f40277384fe9.tar.gz
rails-689cca132a7da77c80637a938740f40277384fe9.tar.bz2
rails-689cca132a7da77c80637a938740f40277384fe9.zip
Performance improvements to CGI methods. Closes #1980
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2151 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/CHANGELOG2
-rwxr-xr-xactionpack/lib/action_controller/cgi_ext/cgi_methods.rb18
-rw-r--r--actionpack/lib/action_controller/cgi_process.rb4
3 files changed, 15 insertions, 9 deletions
diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG
index bb721d40dc..b53aceccb5 100644
--- a/actionpack/CHANGELOG
+++ b/actionpack/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*
+* Performance improvements to CGI methods. Closes #1980 [Skaes]
+
* Added :post option to UrlHelper#link_to that makes it possible to do POST requests through normal ahref links using Javascript
* Fixed overwrite_params
diff --git a/actionpack/lib/action_controller/cgi_ext/cgi_methods.rb b/actionpack/lib/action_controller/cgi_ext/cgi_methods.rb
index d922e48b10..3a14311acf 100755
--- a/actionpack/lib/action_controller/cgi_ext/cgi_methods.rb
+++ b/actionpack/lib/action_controller/cgi_ext/cgi_methods.rb
@@ -17,13 +17,17 @@ class CGIMethods #:nodoc:
k = CGI.unescape(k) if k
v = CGI.unescape(v) if v
- keys = split_key(k)
- last_key = keys.pop
- last_key = keys.pop if (use_array = last_key.empty?)
- parent = keys.inject(parsed_params) {|h, k| h[k] ||= {}}
-
- if use_array then (parent[last_key] ||= []) << v
- else parent[last_key] = v
+ unless k.include?(?[)
+ parsed_params[k] = v
+ else
+ keys = split_key(k)
+ last_key = keys.pop
+ last_key = keys.pop if (use_array = last_key.empty?)
+ parent = keys.inject(parsed_params) {|h, k| h[k] ||= {}}
+
+ if use_array then (parent[last_key] ||= []) << v
+ else parent[last_key] = v
+ end
end
}
diff --git a/actionpack/lib/action_controller/cgi_process.rb b/actionpack/lib/action_controller/cgi_process.rb
index d1d8a660c7..e9e539cfdc 100644
--- a/actionpack/lib/action_controller/cgi_process.rb
+++ b/actionpack/lib/action_controller/cgi_process.rb
@@ -125,11 +125,11 @@ module ActionController #:nodoc:
private
def new_session
- CGI::Session.new(@cgi, session_options_with_string_keys.merge("new_session" => true))
+ CGI::Session.new(@cgi, session_options_with_string_keys.update("new_session" => true))
end
def session_options_with_string_keys
- DEFAULT_SESSION_OPTIONS.merge(@session_options).inject({}) { |options, pair| options[pair.first.to_s] = pair.last; options }
+ DEFAULT_SESSION_OPTIONS.merge(@session_options).inject({}) { |options, (k,v)| options[k.to_s] = v; options }
end
end