ruby-changes:37588
From: usa <ko1@a...>
Date: Sat, 21 Feb 2015 09:49:51 +0900 (JST)
Subject: [ruby-changes:37588] usa:r49669 (ruby_2_0_0): merge revision(s) 48666: [Backport #10873]
usa 2015-02-21 09:49:36 +0900 (Sat, 21 Feb 2015) New Revision: 49669 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=49669 Log: merge revision(s) 48666: [Backport #10873] * lib/uri/generic.rb (URI::Generic.build): use hostname= to detect and wrap IPv6 hosts. Build is accepting URI components and users may not expect that a host component needs to be wrapped with square brackets since it's not providing a URI. Note: initialize with arg_check => true does not wrap IPv6 hosts. by Joe Rafaniello <jrafanie@r...> https://github.com/ruby/ruby/pull/765 fix GH-765 * test/uri/test_generic.rb: Add more tests Modified directories: branches/ruby_2_0_0/ Modified files: branches/ruby_2_0_0/ChangeLog branches/ruby_2_0_0/lib/uri/generic.rb branches/ruby_2_0_0/test/uri/test_generic.rb branches/ruby_2_0_0/version.h Index: ruby_2_0_0/ChangeLog =================================================================== --- ruby_2_0_0/ChangeLog (revision 49668) +++ ruby_2_0_0/ChangeLog (revision 49669) @@ -1,3 +1,16 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/ChangeLog#L1 +Sat Feb 21 09:48:48 2015 NARUSE, Yui <naruse@r...> + + * lib/uri/generic.rb (URI::Generic.build): + use hostname= to detect and wrap IPv6 hosts. + Build is accepting URI components and users may not expect + that a host component needs to be wrapped with square brackets + since it's not providing a URI. + Note: initialize with arg_check => true does not wrap IPv6 hosts. + by Joe Rafaniello <jrafanie@r...> + https://github.com/ruby/ruby/pull/765 fix GH-765 + + * test/uri/test_generic.rb: Add more tests + Wed Feb 18 16:02:30 2015 Nobuyoshi Nakada <nobu@r...> * lib/resolv.rb (Resolv::DNS::Resource#==, #hash): elements Index: ruby_2_0_0/lib/uri/generic.rb =================================================================== --- ruby_2_0_0/lib/uri/generic.rb (revision 49668) +++ ruby_2_0_0/lib/uri/generic.rb (revision 49669) @@ -192,7 +192,7 @@ module URI https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/uri/generic.rb#L192 if arg_check self.scheme = scheme self.userinfo = userinfo - self.host = host + self.hostname = host self.port = port self.path = path self.query = query Index: ruby_2_0_0/version.h =================================================================== --- ruby_2_0_0/version.h (revision 49668) +++ ruby_2_0_0/version.h (revision 49669) @@ -1,10 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/version.h#L1 #define RUBY_VERSION "2.0.0" -#define RUBY_RELEASE_DATE "2015-02-18" -#define RUBY_PATCHLEVEL 634 +#define RUBY_RELEASE_DATE "2015-02-21" +#define RUBY_PATCHLEVEL 635 #define RUBY_RELEASE_YEAR 2015 #define RUBY_RELEASE_MONTH 2 -#define RUBY_RELEASE_DAY 18 +#define RUBY_RELEASE_DAY 21 #include "ruby/version.h" Index: ruby_2_0_0/test/uri/test_generic.rb =================================================================== --- ruby_2_0_0/test/uri/test_generic.rb (revision 49668) +++ ruby_2_0_0/test/uri/test_generic.rb (revision 49669) @@ -725,12 +725,26 @@ class URI::TestGeneric < Test::Unit::Tes https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/test/uri/test_generic.rb#L725 end def test_build - URI::Generic.build(['http', nil, 'example.com', 80, nil, '/foo', nil, nil, nil]) + u = URI::Generic.build(['http', nil, 'example.com', 80, nil, '/foo', nil, nil, nil]) + assert_equal('http://example.com:80/foo', u.to_s) + + u = URI::Generic.build(:scheme => "http", :host => "::1", :path => "/bar/baz") + assert_equal("http://[::1]/bar/baz", u.to_s) + assert_equal("[::1]", u.host) + assert_equal("::1", u.hostname) + + u = URI::Generic.build(:scheme => "http", :host => "[::1]", :path => "/bar/baz") + assert_equal("http://[::1]/bar/baz", u.to_s) + assert_equal("[::1]", u.host) + assert_equal("::1", u.hostname) end def test_build2 - URI::Generic.build2(path: "/foo bar/baz") - URI::Generic.build2(['http', nil, 'example.com', 80, nil, '/foo bar' , nil, nil, nil]) + u = URI::Generic.build2(path: "/foo bar/baz") + assert_equal('/foo%20bar/baz', u.to_s) + + u = URI::Generic.build2(['http', nil, 'example.com', 80, nil, '/foo bar' , nil, nil, nil]) + assert_equal('http://example.com:80/foo%20bar', u.to_s) end # 192.0.2.0/24 is TEST-NET. [RFC3330] Property changes on: ruby_2_0_0 ___________________________________________________________________ Modified: svn:mergeinfo Merged /trunk:r48666 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/