OpenSSL maybe aren't loaded in rubygems.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66400 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
naruse 2018-12-14 08:01:40 +00:00
Родитель 69ab98ffb5
Коммит 67f59eb4ab
2 изменённых файлов: 20 добавлений и 1 удалений

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

@ -274,7 +274,8 @@ class Gem::RemoteFetcher
raise
rescue Timeout::Error
raise UnknownHostError.new('timed out', uri.to_s)
rescue IOError, SocketError, SystemCallError, OpenSSL::SSL::SSLError => e
rescue IOError, SocketError, SystemCallError,
*(OpenSSL::SSL::SSLError if defined?(OpenSSL)) => e
if e.message =~ /getaddrinfo/
raise UnknownHostError.new('no such name', uri.to_s)
else

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

@ -516,6 +516,24 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
assert_equal url, e.uri
end
def test_fetch_path_openssl_ssl_sslerror
fetcher = Gem::RemoteFetcher.new nil
@fetcher = fetcher
def fetcher.fetch_http(uri, mtime = nil, head = nil)
raise OpenSSL::SSL::SSLError
end
url = 'http://example.com/uri'
e = assert_raises Gem::RemoteFetcher::FetchError do
fetcher.fetch_path url
end
assert_equal "OpenSSL::SSL::SSLError: OpenSSL::SSL::SSLError (#{url})", e.message
assert_equal url, e.uri
end
def test_fetch_path_unmodified
fetcher = Gem::RemoteFetcher.new nil
@fetcher = fetcher