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:
parent
044965df97
commit
9dce4d52ca
3 changed files with 11 additions and 1 deletions
|
@ -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>
|
Thu Jan 22 16:29:50 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* lib/rubygems/installer.rb (Gem::Installer#initialize): fixed
|
* lib/rubygems/installer.rb (Gem::Installer#initialize): fixed
|
||||||
|
|
|
@ -339,6 +339,8 @@ class CGI
|
||||||
key, value = pairs.split('=',2).collect{|v| CGI::unescape(v) }
|
key, value = pairs.split('=',2).collect{|v| CGI::unescape(v) }
|
||||||
if key && value
|
if key && value
|
||||||
params.has_key?(key) ? params[key].push(value) : params[key] = [value]
|
params.has_key?(key) ? params[key].push(value) : params[key] = [value]
|
||||||
|
elsif key
|
||||||
|
params[key]=[]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
params.default=[].freeze
|
params.default=[].freeze
|
||||||
|
|
|
@ -31,7 +31,7 @@ class CGICoreTest < Test::Unit::TestCase
|
||||||
}
|
}
|
||||||
ENV.update(@environ)
|
ENV.update(@environ)
|
||||||
cgi = CGI.new
|
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"])
|
assert_equal("",cgi["d"])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue