diff options
author | knu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-12-14 01:11:28 +0000 |
---|---|---|
committer | knu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-12-14 01:11:28 +0000 |
commit | b53ec390d18e573a4c8192ab6615c881aed95574 (patch) | |
tree | 086880e77cbc13daa1b12cd83b4e55c6f30fc003 /test/uri | |
parent | f5090e2f5ca5d5e0353659bdcba3c0a09e908178 (diff) | |
download | ruby-b53ec390d18e573a4c8192ab6615c881aed95574.tar.gz |
Allow empty path components in a URI [Bug #8352]
* generic.rb (URI::Generic#merge, URI::Generic#route_to): Fix a bug
where a sequence of slashes in the path part gets collapsed to a
single slash. According to the relevant RFCs and WHATWG URL
Standard, empty path components are simply valid and there is no
special treatment defined for them, so we just keep them as they
are.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61218 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/uri')
-rw-r--r-- | test/uri/test_generic.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/test/uri/test_generic.rb b/test/uri/test_generic.rb index b77717f949..7e428aa849 100644 --- a/test/uri/test_generic.rb +++ b/test/uri/test_generic.rb @@ -208,6 +208,9 @@ class URI::TestGeneric < Test::Unit::TestCase assert(nil != u.merge!("../baz")) assert_equal('http://foo/baz', u.to_s) + url = URI.parse('http://a/b//c') + 'd//e' + assert_equal('http://a/b//d//e', url.to_s) + u0 = URI.parse('mailto:foo@example.com') u1 = URI.parse('mailto:foo@example.com#bar') assert_equal(uri_to_ary(u0 + '#bar'), uri_to_ary(u1), "[ruby-dev:23628]") @@ -265,6 +268,9 @@ class URI::TestGeneric < Test::Unit::TestCase url = URI.parse('http://hoge/b').route_to('http://hoge/b:c') assert_equal('./b:c', url.to_s) + url = URI.parse('http://hoge/b//c').route_to('http://hoge/b/c') + assert_equal('../c', url.to_s) + url = URI.parse('file:///a/b/').route_to('file:///a/b/') assert_equal('', url.to_s) url = URI.parse('file:///a/b/').route_to('file:///a/b') |