summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorHiroshi SHIBATA <hsbt@ruby-lang.org>2025-02-21 16:29:36 +0900
committergit <svn-admin@ruby-lang.org>2025-02-26 07:08:44 +0000
commit57dcb4bb9bc44368db3a2ef908f1babc79ea5224 (patch)
tree7b3375402183e6888e591213d9abad9a9b3454dd /test
parent7d24e1d6552de494e0906809cf9658d2a96b5e71 (diff)
[ruby/uri] Truncate userinfo with URI#join, URI#merge and URI#+
https://github.com/ruby/uri/commit/3675494839
Diffstat (limited to 'test')
-rw-r--r--test/uri/test_generic.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/uri/test_generic.rb b/test/uri/test_generic.rb
index 8209363b82..4b04998490 100644
--- a/test/uri/test_generic.rb
+++ b/test/uri/test_generic.rb
@@ -175,6 +175,17 @@ class URI::TestGeneric < Test::Unit::TestCase
# must be empty string to identify as path-abempty, not path-absolute
assert_equal('', url.host)
assert_equal('http:////example.com', url.to_s)
+
+ # sec-2957667
+ url = URI.parse('http://user:pass@example.com').merge('//example.net')
+ assert_equal('http://example.net', url.to_s)
+ assert_nil(url.userinfo)
+ url = URI.join('http://user:pass@example.com', '//example.net')
+ assert_equal('http://example.net', url.to_s)
+ assert_nil(url.userinfo)
+ url = URI.parse('http://user:pass@example.com') + '//example.net'
+ assert_equal('http://example.net', url.to_s)
+ assert_nil(url.userinfo)
end
def test_parse_scheme_with_symbols