ruby-changes:66938
From: Benoit <ko1@a...>
Date: Wed, 28 Jul 2021 19:27:26 +0900 (JST)
Subject: [ruby-changes:66938] 59a65f2d24 (master): Update to latest uri
https://git.ruby-lang.org/ruby.git/commit/?id=59a65f2d24 From 59a65f2d2402e0d34d9232236f152d62e74f9483 Mon Sep 17 00:00:00 2001 From: Benoit Daloze <eregontp@g...> Date: Wed, 28 Jul 2021 12:26:31 +0200 Subject: Update to latest uri * https://github.com/ruby/uri/commit/bc47bf71df2b2e9cea09d0b2684ceac7355e42a0 * To include the fix from https://github.com/ruby/uri/pull/27 --- lib/uri/common.rb | 4 ++-- test/uri/test_generic.rb | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/uri/common.rb b/lib/uri/common.rb index 2bb13ad..26b179a 100644 --- a/lib/uri/common.rb +++ b/lib/uri/common.rb @@ -91,8 +91,8 @@ module URI https://github.com/ruby/ruby/blob/trunk/lib/uri/common.rb#L91 const_name = scheme.to_s.upcase uri_class = INITIAL_SCHEMES[const_name] - if !uri_class && !const_name.empty? && Schemes.const_defined?(const_name, false) - uri_class = Schemes.const_get(const_name, false) + uri_class ||= if /\A[A-Z]\w*\z/.match?(const_name) && Schemes.const_defined?(const_name, false) + Schemes.const_get(const_name, false) end uri_class ||= default diff --git a/test/uri/test_generic.rb b/test/uri/test_generic.rb index d122587..fdb405e 100644 --- a/test/uri/test_generic.rb +++ b/test/uri/test_generic.rb @@ -159,6 +159,13 @@ class URI::TestGeneric < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/uri/test_generic.rb#L159 assert_equal(nil, url.userinfo) end + def test_parse_scheme_with_symbols + # Valid schemes from https://www.iana.org/assignments/uri-schemes/uri-schemes.xhtml + assert_equal 'ms-search', URI.parse('ms-search://localhost').scheme + assert_equal 'microsoft.windows.camera', URI.parse('microsoft.windows.camera://localhost').scheme + assert_equal 'coaps+ws', URI.parse('coaps+ws:localhost').scheme + end + def test_merge u1 = URI.parse('http://foo') u2 = URI.parse('http://foo/') -- cgit v1.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/