summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--lib/uri/rfc3986_parser.rb2
-rw-r--r--test/uri/test_generic.rb5
3 files changed, 13 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index a44f0ef3db..dc0c1aed39 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Wed Sep 17 23:12:36 2014 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * 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@trebex.net>
+ https://github.com/ruby/ruby/pull/718 fix GH-718
+
Wed Sep 17 16:22:58 2014 Eric Wong <e@80x24.org>
* ext/zlib/zlib.c (zlib_mem_alloc): check overflow
diff --git a/lib/uri/rfc3986_parser.rb b/lib/uri/rfc3986_parser.rb
index 1826397b90..965601c7b3 100644
--- a/lib/uri/rfc3986_parser.rb
+++ b/lib/uri/rfc3986_parser.rb
@@ -83,7 +83,7 @@ module URI
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
diff --git a/test/uri/test_generic.rb b/test/uri/test_generic.rb
index 72769add7e..0202008d44 100644
--- a/test/uri/test_generic.rb
+++ b/test/uri/test_generic.rb
@@ -730,6 +730,11 @@ class URI::TestGeneric < Test::Unit::TestCase
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