[前][次][番号順一覧][スレッド一覧]

ruby-changes:38456

From: naruse <ko1@a...>
Date: Tue, 19 May 2015 11:34:57 +0900 (JST)
Subject: [ruby-changes:38456] naruse:r50537 (trunk): * lib/uri/rfc2396_parser.rb (initialize_pattern):

naruse	2015-05-19 11:34:47 +0900 (Tue, 19 May 2015)

  New Revision: 50537

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=50537

  Log:
    * lib/uri/rfc2396_parser.rb (initialize_pattern):
      URI::Generic.build should accept port as a string.
      pattern[:PORT] is not defined for long.
      by Dave Slutzkin <daveslutzkin@f...>
      https://github.com/ruby/ruby/pull/804 fix GH-804

  Modified files:
    trunk/ChangeLog
    trunk/lib/uri/rfc2396_parser.rb
    trunk/test/uri/test_generic.rb
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 50536)
+++ ChangeLog	(revision 50537)
@@ -1,3 +1,11 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Tue May 19 11:22:28 2015  NARUSE, Yui  <naruse@r...>
+
+	* lib/uri/rfc2396_parser.rb (initialize_pattern):
+	  URI::Generic.build should accept port as a string.
+	  pattern[:PORT] is not defined for long.
+	  by Dave Slutzkin <daveslutzkin@f...>
+	  https://github.com/ruby/ruby/pull/804 fix GH-804
+
 Tue May 19 11:18:46 2015  Nobuyoshi Nakada  <nobu@r...>
 
 	* include/ruby/ruby.h (rb_data_typed_object_alloc),
Index: lib/uri/rfc2396_parser.rb
===================================================================
--- lib/uri/rfc2396_parser.rb	(revision 50536)
+++ lib/uri/rfc2396_parser.rb	(revision 50537)
@@ -401,7 +401,7 @@ module URI https://github.com/ruby/ruby/blob/trunk/lib/uri/rfc2396_parser.rb#L401
       # host          = hostname | IPv4address | IPv6reference (RFC 2732)
       ret[:HOST] = host = "(?:#{hostname}|#{ipv4addr}|#{ipv6ref})"
       # port          = *digit
-      port = '\d*'
+      ret[:PORT] = port = '\d*'
       # hostport      = host [ ":" port ]
       ret[:HOSTPORT] = hostport = "#{host}(?::#{port})?"
 
Index: test/uri/test_generic.rb
===================================================================
--- test/uri/test_generic.rb	(revision 50536)
+++ test/uri/test_generic.rb	(revision 50537)
@@ -761,6 +761,10 @@ class URI::TestGeneric < Test::Unit::Tes https://github.com/ruby/ruby/blob/trunk/test/uri/test_generic.rb#L761
     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(:port => "5432")
+    assert_equal(":5432", u.to_s)
+    assert_equal(5432, u.port)
+
     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)

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]