remote_fetcher.rb: fix leaked FDs

* lib/rubygems/remote_fetcher.rb (request): close connections.

* lib/rubygems/request.rb (close): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46944 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2014-07-25 07:55:42 +00:00
parent 895c1ce477
commit a818740553
2 changed files with 8 additions and 0 deletions

View File

@ -337,6 +337,8 @@ class Gem::RemoteFetcher
request.fetch do |req|
yield req if block_given?
end
ensure
request.close if request
end
def https?(uri)

View File

@ -28,6 +28,12 @@ class Gem::Request
@env_no_proxy = get_no_proxy_from_env
end
def close
@connections.each_value do |conn|
conn.finish
end
end
def add_rubygems_trusted_certs(store)
pattern = File.expand_path("./ssl_certs/*.pem", File.dirname(__FILE__))
Dir.glob(pattern).each do |ssl_cert_file|