From 8a3c3b9c95955bba7f143c44136a043568d88b94 Mon Sep 17 00:00:00 2001 From: naruse Date: Fri, 9 Apr 2010 11:58:20 +0000 Subject: * lib/uri/common.rb (decode_www_form): don't ignore leading '?'. [ruby-dev:40938] * lib/uri/common.rb (decode_www_form): check whether argument is valid application/x-www-form-urlencoded data. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27270 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/uri/test_common.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'test/uri') diff --git a/test/uri/test_common.rb b/test/uri/test_common.rb index 9f39e843d3..5e575e21a6 100644 --- a/test/uri/test_common.rb +++ b/test/uri/test_common.rb @@ -86,7 +86,13 @@ class TestCommon < Test::Unit::TestCase def test_decode_www_form assert_equal([%w[a 1], %w[a 2]], URI.decode_www_form("a=1&a=2")) assert_equal([%w[a 1], ["\u3042", "\u6F22"]], - URI.decode_www_form("a=1&%E3%81%82=%E6%BC%A2")) + URI.decode_www_form("a=1;%E3%81%82=%E6%BC%A2")) + assert_equal([%w[?a 1], %w[a 2]], URI.decode_www_form("?a=1&a=2")) + assert_raise(ArgumentError){URI.decode_www_form("%=1")} + assert_raise(ArgumentError){URI.decode_www_form("a=%")} + assert_raise(ArgumentError){URI.decode_www_form("a=1&%=2")} + assert_raise(ArgumentError){URI.decode_www_form("a=1&b=%")} + assert_raise(ArgumentError){URI.decode_www_form("a&b")} end end -- cgit v1.2.3