ruby-changes:36853
From: naruse <ko1@a...>
Date: Tue, 23 Dec 2014 22:11:50 +0900 (JST)
Subject: [ruby-changes:36853] naruse:r48934 (trunk): * lib/uri/generic.rb (URI::Generic#query=): don't escape [\]^
naruse 2014-12-23 22:11:43 +0900 (Tue, 23 Dec 2014) New Revision: 48934 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=48934 Log: * lib/uri/generic.rb (URI::Generic#query=): don't escape [\]^ on both rfc2396 and rfc3986. [Bug #10619] Modified files: trunk/ChangeLog trunk/lib/uri/generic.rb trunk/test/uri/test_generic.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 48933) +++ ChangeLog (revision 48934) @@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Tue Dec 23 22:04:38 2014 NARUSE, Yui <naruse@r...> + + * lib/uri/generic.rb (URI::Generic#query=): don't escape [\]^ + on both rfc2396 and rfc3986. [Bug #10619] + Tue Dec 23 16:03:35 2014 Nobuyoshi Nakada <nobu@r...> * ext/win32/lib/win32/registry.rb (Win32::Registry::Error#initialize): Index: lib/uri/generic.rb =================================================================== --- lib/uri/generic.rb (revision 48933) +++ lib/uri/generic.rb (revision 48934) @@ -851,7 +851,7 @@ module URI https://github.com/ruby/ruby/blob/trunk/lib/uri/generic.rb#L851 v.encode!(Encoding::UTF_8) rescue nil v.delete!("\t\r\n") v.force_encoding(Encoding::ASCII_8BIT) - v.gsub!(/(?!%\h\h|[!$-&(-;=?-Z_a-~])./n.freeze){'%%%02X'.freeze % $&.ord} + v.gsub!(/(?!%\h\h|[!$-&(-;=?-_a-~])./n.freeze){'%%%02X'.freeze % $&.ord} v.force_encoding(Encoding::US_ASCII) @query = v end Index: test/uri/test_generic.rb =================================================================== --- test/uri/test_generic.rb (revision 48933) +++ test/uri/test_generic.rb (revision 48934) @@ -714,9 +714,9 @@ class URI::TestGeneric < Test::Unit::Tes https://github.com/ruby/ruby/blob/trunk/test/uri/test_generic.rb#L714 assert_equal('b123', uri.fragment = 'b123') assert_equal('http://foo:bar@zab:8080/?a=1#b123', uri.to_s) assert_equal('a[]=1', uri.query = 'a[]=1') - assert_equal('http://foo:bar@zab:8080/?a%5B%5D=1#b123', uri.to_s) + assert_equal('http://foo:bar@zab:8080/?a[]=1#b123', uri.to_s) uri = URI.parse('http://foo:bar@zab:8080/?a[]=1#b123') - assert_equal('http://foo:bar@zab:8080/?a%5B%5D=1#b123', uri.to_s) + assert_equal('http://foo:bar@zab:8080/?a[]=1#b123', uri.to_s) uri = URI.parse('http://example.com') assert_raise(URI::InvalidURIError) { uri.password = 'bar' } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/