1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* lib/cgi/core.rb (CGI.parse): generate only key on params hash

if request have only key uri parameters.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21739 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
xibbar 2009-01-22 08:25:44 +00:00
parent 044965df97
commit 9dce4d52ca
3 changed files with 11 additions and 1 deletions

View file

@ -1,3 +1,11 @@
Thu Jan 22 17:12:37 2009 Takeyuki FUJIOKA <xibbar@ruby-lang.org>
* lib/cgi/core.rb (CGI.parse): generate only key on params hash
if request have only key uri parameters.
(ex. index.cgi?aaa&bbb=1 # params=>{:aaa=>[],:bbb=>["1"]})
* test/cgi/test_cgi_core.rb: fix test for key only params.
Thu Jan 22 16:29:50 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
* lib/rubygems/installer.rb (Gem::Installer#initialize): fixed

View file

@ -339,6 +339,8 @@ class CGI
key, value = pairs.split('=',2).collect{|v| CGI::unescape(v) }
if key && value
params.has_key?(key) ? params[key].push(value) : params[key] = [value]
elsif key
params[key]=[]
end
end
params.default=[].freeze

View file

@ -31,7 +31,7 @@ class CGICoreTest < Test::Unit::TestCase
}
ENV.update(@environ)
cgi = CGI.new
assert_equal(["a","b","d"],cgi.keys.sort) if RUBY_VERSION>="1.9"
assert_equal(["a","b","c","d"],cgi.keys.sort) if RUBY_VERSION>="1.9"
assert_equal("",cgi["d"])
end