Update to latest uri

* bc47bf71df
* To include the fix from https://github.com/ruby/uri/pull/27
This commit is contained in:
Benoit Daloze 2021-07-28 12:26:31 +02:00
parent 71945ad827
commit 59a65f2d24
2 changed files with 9 additions and 2 deletions

View File

@ -91,8 +91,8 @@ module URI
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

View File

@ -159,6 +159,13 @@ class URI::TestGeneric < Test::Unit::TestCase
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/')