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

ruby-changes:35532

From: naruse <ko1@a...>
Date: Wed, 17 Sep 2014 23:15:19 +0900 (JST)
Subject: [ruby-changes:35532] naruse:r47614 (trunk): * lib/uri/rfc3986_parser.rb: specify a regexp for :OPAQUE; generic.rb

naruse	2014-09-17 23:15:03 +0900 (Wed, 17 Sep 2014)

  New Revision: 47614

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

  Log:
    * lib/uri/rfc3986_parser.rb: specify a regexp for :OPAQUE; generic.rb
      assumes it is present, and will refuse all values otherwise.
      by Matthew Draper <matthew@t...>
      https://github.com/ruby/ruby/pull/718 fix GH-718

  Modified files:
    trunk/ChangeLog
    trunk/lib/uri/rfc3986_parser.rb
    trunk/test/uri/test_generic.rb
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 47613)
+++ ChangeLog	(revision 47614)
@@ -1,3 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Wed Sep 17 23:12:36 2014  NARUSE, Yui  <naruse@r...>
+
+	* lib/uri/rfc3986_parser.rb: specify a regexp for :OPAQUE; generic.rb
+	  assumes it is present, and will refuse all values otherwise.
+	  by Matthew Draper <matthew@t...>
+	  https://github.com/ruby/ruby/pull/718 fix GH-718
+
 Wed Sep 17 16:22:58 2014  Eric Wong  <e@8...>
 
 	* ext/zlib/zlib.c (zlib_mem_alloc): check overflow
Index: lib/uri/rfc3986_parser.rb
===================================================================
--- lib/uri/rfc3986_parser.rb	(revision 47613)
+++ lib/uri/rfc3986_parser.rb	(revision 47614)
@@ -83,7 +83,7 @@ module URI https://github.com/ruby/ruby/blob/trunk/lib/uri/rfc3986_parser.rb#L83
         REL_PATH: /\A(?:%\h\h|[!$&-.0-;=@-Z_a-z~])+(?:\/(?:%\h\h|[!$&-.0-;=@-Z_a-z~])*)*\z/,
         QUERY: /\A(?:%\h\h|[!$&-.0-;=@-Z_a-z~\/?])*\z/,
         FRAGMENT: /\A(?:%\h\h|[!$&-.0-;=@-Z_a-z~\/?])*\z/,
-        OPAQUE: nil,
+        OPAQUE: /\A(?:[^\/].*)?\z/,
         PORT: /\A[\x09\x0a\x0c\x0d ]*\d*[\x09\x0a\x0c\x0d ]*\z/,
       }
     end
Index: test/uri/test_generic.rb
===================================================================
--- test/uri/test_generic.rb	(revision 47613)
+++ test/uri/test_generic.rb	(revision 47614)
@@ -730,6 +730,11 @@ class URI::TestGeneric < Test::Unit::Tes https://github.com/ruby/ruby/blob/trunk/test/uri/test_generic.rb#L730
     assert_raise(URI::InvalidURIError) { uri.port = 'bar' }
     assert_raise(URI::InvalidURIError) { uri.path = 'bar' }
     assert_raise(URI::InvalidURIError) { uri.query = 'bar' }
+
+    uri = URI.parse('foo:bar')
+    assert_raise(URI::InvalidComponentError) { uri.opaque = '/baz' }
+    uri.opaque = 'xyzzy'
+    assert_equal('foo:xyzzy', uri.to_s)
   end
 
   def test_set_scheme

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

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