* lib/uri/generic.rb (split_userinfo): should split ":pass" into ""

and "pass".  [ruby-dev:25667]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8020 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akira 2005-02-23 06:08:29 +00:00
Родитель de26996f0a
Коммит c36a0f0ec0
3 изменённых файлов: 22 добавлений и 9 удалений

Просмотреть файл

@ -1,3 +1,8 @@
Thu Feb 23 15:04:32 2005 akira yamada <akira@ruby-lang.org>
* lib/uri/generic.rb (split_userinfo): should split ":pass" into ""
and "pass". [ruby-dev:25667]
Wed Feb 23 01:53:29 2005 Shugo Maeda <shugo@ruby-lang.org>
* lib/net/imap.rb (initialize): handle certs correctly. Thanks,

Просмотреть файл

@ -343,14 +343,7 @@ module URI
def split_userinfo(ui)
return nil, nil unless ui
tmp = ui.index(':')
if tmp
user = ui[0..tmp - 1]
password = ui[tmp + 1..-1]
else
user = ui
password = nil
end
user, password = ui.split(/:/, 2)
return user, password
end

Просмотреть файл

@ -117,11 +117,26 @@ class TestGeneric < Test::Unit::TestCase
assert_raises(URI::InvalidURIError) { URI.parse('http://a_b/') }
# 8
# reporte by m_seki
# reported by m_seki
uri = URI.parse('file:///foo/bar.txt')
assert_kind_of(URI::Generic, url)
uri = URI.parse('file:/foo/bar.txt')
assert_kind_of(URI::Generic, url)
# 9
# [ruby-dev:25667]
url = URI.parse('ftp://:pass@localhost/')
assert_equal('', url.user)
assert_equal('pass', url.password)
assert_equal(':pass', url.userinfo)
url = URI.parse('ftp://user@localhost/')
assert_equal('user', url.user)
assert_equal(nil, url.password)
assert_equal('user', url.userinfo)
url = URI.parse('ftp://localhost/')
assert_equal(nil, url.user)
assert_equal(nil, url.password)
assert_equal(nil, url.userinfo)
end
def test_merge