mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* lib/rubygems: Import RubyGems from master as of commit b165260
* test/rubygems: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42124 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
66cc0fa4ab
commit
4c2304f000
34 changed files with 1169 additions and 597 deletions
|
@ -1,4 +1,5 @@
|
|||
require 'net/http'
|
||||
require 'thread'
|
||||
require 'time'
|
||||
require 'rubygems/user_interaction'
|
||||
|
||||
|
@ -14,6 +15,7 @@ class Gem::Request
|
|||
@last_modified = last_modified
|
||||
@requests = Hash.new 0
|
||||
@connections = {}
|
||||
@connections_mutex = Mutex.new
|
||||
@user_agent = user_agent
|
||||
|
||||
@proxy_uri =
|
||||
|
@ -82,8 +84,11 @@ class Gem::Request
|
|||
end
|
||||
|
||||
connection_id = [Thread.current.object_id, *net_http_args].join ':'
|
||||
@connections[connection_id] ||= Net::HTTP.new(*net_http_args)
|
||||
connection = @connections[connection_id]
|
||||
|
||||
connection = @connections_mutex.synchronize do
|
||||
@connections[connection_id] ||= Net::HTTP.new(*net_http_args)
|
||||
@connections[connection_id]
|
||||
end
|
||||
|
||||
if https?(uri) and not connection.started? then
|
||||
configure_connection_for_https(connection)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue