Applied rake vendor:install
This commit is contained in:
parent
cc3d304b47
commit
f855bcc6b2
@ -43,9 +43,8 @@ autoload :OpenSSL, 'openssl'
|
|||||||
# # perform the POST, the Gem::URI is always required
|
# # perform the POST, the Gem::URI is always required
|
||||||
# response http.request post_uri, post
|
# response http.request post_uri, post
|
||||||
#
|
#
|
||||||
# Note that for GET, HEAD and other requests that do not have a body you want
|
# ⚠ Note that for GET, HEAD and other requests that do not have a body,
|
||||||
# to use Gem::URI#request_uri not Gem::URI#path. The request_uri contains the query
|
# it uses Gem::URI#request_uri as default to send query params
|
||||||
# params which are sent in the body for other requests.
|
|
||||||
#
|
#
|
||||||
# == TLS/SSL
|
# == TLS/SSL
|
||||||
#
|
#
|
||||||
@ -61,6 +60,7 @@ autoload :OpenSSL, 'openssl'
|
|||||||
# #ca_path :: Directory with certificate-authorities
|
# #ca_path :: Directory with certificate-authorities
|
||||||
# #cert_store :: An SSL certificate store
|
# #cert_store :: An SSL certificate store
|
||||||
# #ciphers :: List of SSl ciphers allowed
|
# #ciphers :: List of SSl ciphers allowed
|
||||||
|
# #extra_chain_cert :: Extra certificates to be added to the certificate chain
|
||||||
# #private_key :: The client's SSL private key
|
# #private_key :: The client's SSL private key
|
||||||
# #reuse_ssl_sessions :: Reuse a previously opened SSL session for a new
|
# #reuse_ssl_sessions :: Reuse a previously opened SSL session for a new
|
||||||
# connection
|
# connection
|
||||||
@ -177,7 +177,7 @@ class Gem::Net::HTTP::Persistent
|
|||||||
##
|
##
|
||||||
# The version of Gem::Net::HTTP::Persistent you are using
|
# The version of Gem::Net::HTTP::Persistent you are using
|
||||||
|
|
||||||
VERSION = '4.0.4'
|
VERSION = '4.0.6'
|
||||||
|
|
||||||
##
|
##
|
||||||
# Error class for errors raised by Gem::Net::HTTP::Persistent. Various
|
# Error class for errors raised by Gem::Net::HTTP::Persistent. Various
|
||||||
@ -268,6 +268,11 @@ class Gem::Net::HTTP::Persistent
|
|||||||
|
|
||||||
attr_reader :ciphers
|
attr_reader :ciphers
|
||||||
|
|
||||||
|
##
|
||||||
|
# Extra certificates to be added to the certificate chain
|
||||||
|
|
||||||
|
attr_reader :extra_chain_cert
|
||||||
|
|
||||||
##
|
##
|
||||||
# Sends debug_output to this IO via Gem::Net::HTTP#set_debug_output.
|
# Sends debug_output to this IO via Gem::Net::HTTP#set_debug_output.
|
||||||
#
|
#
|
||||||
@ -588,6 +593,21 @@ class Gem::Net::HTTP::Persistent
|
|||||||
reconnect_ssl
|
reconnect_ssl
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if Gem::Net::HTTP.method_defined?(:extra_chain_cert=)
|
||||||
|
##
|
||||||
|
# Extra certificates to be added to the certificate chain.
|
||||||
|
# It is only supported starting from Gem::Net::HTTP version 0.1.1
|
||||||
|
def extra_chain_cert= extra_chain_cert
|
||||||
|
@extra_chain_cert = extra_chain_cert
|
||||||
|
|
||||||
|
reconnect_ssl
|
||||||
|
end
|
||||||
|
else
|
||||||
|
def extra_chain_cert= _extra_chain_cert
|
||||||
|
raise "extra_chain_cert= is not supported by this version of Gem::Net::HTTP"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
# Creates a new connection for +uri+
|
# Creates a new connection for +uri+
|
||||||
|
|
||||||
@ -606,47 +626,49 @@ class Gem::Net::HTTP::Persistent
|
|||||||
|
|
||||||
connection = @pool.checkout net_http_args
|
connection = @pool.checkout net_http_args
|
||||||
|
|
||||||
http = connection.http
|
begin
|
||||||
|
http = connection.http
|
||||||
|
|
||||||
connection.ressl @ssl_generation if
|
connection.ressl @ssl_generation if
|
||||||
connection.ssl_generation != @ssl_generation
|
connection.ssl_generation != @ssl_generation
|
||||||
|
|
||||||
if not http.started? then
|
if not http.started? then
|
||||||
ssl http if use_ssl
|
ssl http if use_ssl
|
||||||
start http
|
start http
|
||||||
elsif expired? connection then
|
elsif expired? connection then
|
||||||
reset connection
|
reset connection
|
||||||
|
end
|
||||||
|
|
||||||
|
http.keep_alive_timeout = @idle_timeout if @idle_timeout
|
||||||
|
http.max_retries = @max_retries if http.respond_to?(:max_retries=)
|
||||||
|
http.read_timeout = @read_timeout if @read_timeout
|
||||||
|
http.write_timeout = @write_timeout if
|
||||||
|
@write_timeout && http.respond_to?(:write_timeout=)
|
||||||
|
|
||||||
|
return yield connection
|
||||||
|
rescue Errno::ECONNREFUSED
|
||||||
|
if http.proxy?
|
||||||
|
address = http.proxy_address
|
||||||
|
port = http.proxy_port
|
||||||
|
else
|
||||||
|
address = http.address
|
||||||
|
port = http.port
|
||||||
|
end
|
||||||
|
|
||||||
|
raise Error, "connection refused: #{address}:#{port}"
|
||||||
|
rescue Errno::EHOSTDOWN
|
||||||
|
if http.proxy?
|
||||||
|
address = http.proxy_address
|
||||||
|
port = http.proxy_port
|
||||||
|
else
|
||||||
|
address = http.address
|
||||||
|
port = http.port
|
||||||
|
end
|
||||||
|
|
||||||
|
raise Error, "host down: #{address}:#{port}"
|
||||||
|
ensure
|
||||||
|
@pool.checkin net_http_args
|
||||||
end
|
end
|
||||||
|
|
||||||
http.keep_alive_timeout = @idle_timeout if @idle_timeout
|
|
||||||
http.max_retries = @max_retries if http.respond_to?(:max_retries=)
|
|
||||||
http.read_timeout = @read_timeout if @read_timeout
|
|
||||||
http.write_timeout = @write_timeout if
|
|
||||||
@write_timeout && http.respond_to?(:write_timeout=)
|
|
||||||
|
|
||||||
return yield connection
|
|
||||||
rescue Errno::ECONNREFUSED
|
|
||||||
if http.proxy?
|
|
||||||
address = http.proxy_address
|
|
||||||
port = http.proxy_port
|
|
||||||
else
|
|
||||||
address = http.address
|
|
||||||
port = http.port
|
|
||||||
end
|
|
||||||
|
|
||||||
raise Error, "connection refused: #{address}:#{port}"
|
|
||||||
rescue Errno::EHOSTDOWN
|
|
||||||
if http.proxy?
|
|
||||||
address = http.proxy_address
|
|
||||||
port = http.proxy_port
|
|
||||||
else
|
|
||||||
address = http.address
|
|
||||||
port = http.port
|
|
||||||
end
|
|
||||||
|
|
||||||
raise Error, "host down: #{address}:#{port}"
|
|
||||||
ensure
|
|
||||||
@pool.checkin net_http_args
|
|
||||||
end
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
@ -954,7 +976,8 @@ class Gem::Net::HTTP::Persistent
|
|||||||
end
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
# Shuts down all connections
|
# Shuts down all connections. Attempting to checkout a connection after
|
||||||
|
# shutdown will raise an error.
|
||||||
#
|
#
|
||||||
# *NOTE*: Calling shutdown for can be dangerous!
|
# *NOTE*: Calling shutdown for can be dangerous!
|
||||||
#
|
#
|
||||||
@ -965,6 +988,17 @@ class Gem::Net::HTTP::Persistent
|
|||||||
@pool.shutdown { |http| http.finish }
|
@pool.shutdown { |http| http.finish }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
##
|
||||||
|
# Discard all existing connections. Subsequent checkouts will create
|
||||||
|
# new connections as needed.
|
||||||
|
#
|
||||||
|
# If any thread is still using a connection it may cause an error! Call
|
||||||
|
# #reload when you are completely done making requests!
|
||||||
|
|
||||||
|
def reload
|
||||||
|
@pool.reload { |http| http.finish }
|
||||||
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
# Enables SSL on +connection+
|
# Enables SSL on +connection+
|
||||||
|
|
||||||
@ -1022,6 +1056,10 @@ application:
|
|||||||
connection.key = @private_key
|
connection.key = @private_key
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if defined?(@extra_chain_cert) and @extra_chain_cert
|
||||||
|
connection.extra_chain_cert = @extra_chain_cert
|
||||||
|
end
|
||||||
|
|
||||||
connection.cert_store = if @cert_store then
|
connection.cert_store = if @cert_store then
|
||||||
@cert_store
|
@cert_store
|
||||||
else
|
else
|
||||||
|
@ -63,7 +63,8 @@ class Gem::Net::HTTP::Persistent::TimedStackMulti < Bundler::ConnectionPool::Tim
|
|||||||
if @created >= @max && @enqueued >= 1
|
if @created >= @max && @enqueued >= 1
|
||||||
oldest, = @lru.first
|
oldest, = @lru.first
|
||||||
@lru.delete oldest
|
@lru.delete oldest
|
||||||
@ques[oldest].pop
|
connection = @ques[oldest].pop
|
||||||
|
connection.close if connection.respond_to?(:close)
|
||||||
|
|
||||||
@created -= 1
|
@created -= 1
|
||||||
end
|
end
|
||||||
|
38
lib/rubygems/vendor/net-http/lib/net/http.rb
vendored
38
lib/rubygems/vendor/net-http/lib/net/http.rb
vendored
@ -46,7 +46,7 @@ module Gem::Net #:nodoc:
|
|||||||
# == Strategies
|
# == Strategies
|
||||||
#
|
#
|
||||||
# - If you will make only a few GET requests,
|
# - If you will make only a few GET requests,
|
||||||
# consider using {OpenURI}[rdoc-ref:OpenURI].
|
# consider using {OpenURI}[https://docs.ruby-lang.org/en/master/OpenURI.html].
|
||||||
# - If you will make only a few requests of all kinds,
|
# - If you will make only a few requests of all kinds,
|
||||||
# consider using the various singleton convenience methods in this class.
|
# consider using the various singleton convenience methods in this class.
|
||||||
# Each of the following methods automatically starts and finishes
|
# Each of the following methods automatically starts and finishes
|
||||||
@ -108,7 +108,7 @@ module Gem::Net #:nodoc:
|
|||||||
# It consists of some or all of: scheme, hostname, path, query, and fragment;
|
# It consists of some or all of: scheme, hostname, path, query, and fragment;
|
||||||
# see {URI syntax}[https://en.wikipedia.org/wiki/Uniform_Resource_Identifier#Syntax].
|
# see {URI syntax}[https://en.wikipedia.org/wiki/Uniform_Resource_Identifier#Syntax].
|
||||||
#
|
#
|
||||||
# A Ruby {Gem::URI::Generic}[rdoc-ref:Gem::URI::Generic] object
|
# A Ruby {Gem::URI::Generic}[https://docs.ruby-lang.org/en/master/Gem/URI/Generic.html] object
|
||||||
# represents an internet URI.
|
# represents an internet URI.
|
||||||
# It provides, among others, methods
|
# It provides, among others, methods
|
||||||
# +scheme+, +hostname+, +path+, +query+, and +fragment+.
|
# +scheme+, +hostname+, +path+, +query+, and +fragment+.
|
||||||
@ -460,7 +460,7 @@ module Gem::Net #:nodoc:
|
|||||||
#
|
#
|
||||||
# First, what's elsewhere. Class Gem::Net::HTTP:
|
# First, what's elsewhere. Class Gem::Net::HTTP:
|
||||||
#
|
#
|
||||||
# - Inherits from {class Object}[rdoc-ref:Object@What-27s+Here].
|
# - Inherits from {class Object}[https://docs.ruby-lang.org/en/master/Object.html#class-Object-label-What-27s+Here].
|
||||||
#
|
#
|
||||||
# This is a categorized summary of methods and attributes.
|
# This is a categorized summary of methods and attributes.
|
||||||
#
|
#
|
||||||
@ -475,8 +475,7 @@ module Gem::Net #:nodoc:
|
|||||||
#
|
#
|
||||||
# - {::start}[rdoc-ref:Gem::Net::HTTP.start]:
|
# - {::start}[rdoc-ref:Gem::Net::HTTP.start]:
|
||||||
# Begins a new session in a new \Gem::Net::HTTP object.
|
# Begins a new session in a new \Gem::Net::HTTP object.
|
||||||
# - {#started?}[rdoc-ref:Gem::Net::HTTP#started?]
|
# - {#started?}[rdoc-ref:Gem::Net::HTTP#started?]:
|
||||||
# (aliased as {#active?}[rdoc-ref:Gem::Net::HTTP#active?]):
|
|
||||||
# Returns whether in a session.
|
# Returns whether in a session.
|
||||||
# - {#finish}[rdoc-ref:Gem::Net::HTTP#finish]:
|
# - {#finish}[rdoc-ref:Gem::Net::HTTP#finish]:
|
||||||
# Ends an active session.
|
# Ends an active session.
|
||||||
@ -556,18 +555,15 @@ module Gem::Net #:nodoc:
|
|||||||
# Sends a PUT request and returns a response object.
|
# Sends a PUT request and returns a response object.
|
||||||
# - {#request}[rdoc-ref:Gem::Net::HTTP#request]:
|
# - {#request}[rdoc-ref:Gem::Net::HTTP#request]:
|
||||||
# Sends a request and returns a response object.
|
# Sends a request and returns a response object.
|
||||||
# - {#request_get}[rdoc-ref:Gem::Net::HTTP#request_get]
|
# - {#request_get}[rdoc-ref:Gem::Net::HTTP#request_get]:
|
||||||
# (aliased as {#get2}[rdoc-ref:Gem::Net::HTTP#get2]):
|
|
||||||
# Sends a GET request and forms a response object;
|
# Sends a GET request and forms a response object;
|
||||||
# if a block given, calls the block with the object,
|
# if a block given, calls the block with the object,
|
||||||
# otherwise returns the object.
|
# otherwise returns the object.
|
||||||
# - {#request_head}[rdoc-ref:Gem::Net::HTTP#request_head]
|
# - {#request_head}[rdoc-ref:Gem::Net::HTTP#request_head]:
|
||||||
# (aliased as {#head2}[rdoc-ref:Gem::Net::HTTP#head2]):
|
|
||||||
# Sends a HEAD request and forms a response object;
|
# Sends a HEAD request and forms a response object;
|
||||||
# if a block given, calls the block with the object,
|
# if a block given, calls the block with the object,
|
||||||
# otherwise returns the object.
|
# otherwise returns the object.
|
||||||
# - {#request_post}[rdoc-ref:Gem::Net::HTTP#request_post]
|
# - {#request_post}[rdoc-ref:Gem::Net::HTTP#request_post]:
|
||||||
# (aliased as {#post2}[rdoc-ref:Gem::Net::HTTP#post2]):
|
|
||||||
# Sends a POST request and forms a response object;
|
# Sends a POST request and forms a response object;
|
||||||
# if a block given, calls the block with the object,
|
# if a block given, calls the block with the object,
|
||||||
# otherwise returns the object.
|
# otherwise returns the object.
|
||||||
@ -605,8 +601,7 @@ module Gem::Net #:nodoc:
|
|||||||
# Returns whether +self+ is a proxy class.
|
# Returns whether +self+ is a proxy class.
|
||||||
# - {#proxy?}[rdoc-ref:Gem::Net::HTTP#proxy?]:
|
# - {#proxy?}[rdoc-ref:Gem::Net::HTTP#proxy?]:
|
||||||
# Returns whether +self+ has a proxy.
|
# Returns whether +self+ has a proxy.
|
||||||
# - {#proxy_address}[rdoc-ref:Gem::Net::HTTP#proxy_address]
|
# - {#proxy_address}[rdoc-ref:Gem::Net::HTTP#proxy_address]:
|
||||||
# (aliased as {#proxyaddr}[rdoc-ref:Gem::Net::HTTP#proxyaddr]):
|
|
||||||
# Returns the proxy address.
|
# Returns the proxy address.
|
||||||
# - {#proxy_from_env?}[rdoc-ref:Gem::Net::HTTP#proxy_from_env?]:
|
# - {#proxy_from_env?}[rdoc-ref:Gem::Net::HTTP#proxy_from_env?]:
|
||||||
# Returns whether the proxy is taken from an environment variable.
|
# Returns whether the proxy is taken from an environment variable.
|
||||||
@ -718,8 +713,7 @@ module Gem::Net #:nodoc:
|
|||||||
# === \HTTP Version
|
# === \HTTP Version
|
||||||
#
|
#
|
||||||
# - {::version_1_2?}[rdoc-ref:Gem::Net::HTTP.version_1_2?]
|
# - {::version_1_2?}[rdoc-ref:Gem::Net::HTTP.version_1_2?]
|
||||||
# (aliased as {::is_version_1_2?}[rdoc-ref:Gem::Net::HTTP.is_version_1_2?]
|
# (aliased as {::version_1_2}[rdoc-ref:Gem::Net::HTTP.version_1_2]):
|
||||||
# and {::version_1_2}[rdoc-ref:Gem::Net::HTTP.version_1_2]):
|
|
||||||
# Returns true; retained for compatibility.
|
# Returns true; retained for compatibility.
|
||||||
#
|
#
|
||||||
# === Debugging
|
# === Debugging
|
||||||
@ -1293,7 +1287,7 @@ module Gem::Net #:nodoc:
|
|||||||
# - The name of an encoding.
|
# - The name of an encoding.
|
||||||
# - An alias for an encoding name.
|
# - An alias for an encoding name.
|
||||||
#
|
#
|
||||||
# See {Encoding}[rdoc-ref:Encoding].
|
# See {Encoding}[https://docs.ruby-lang.org/en/master/Encoding.html].
|
||||||
#
|
#
|
||||||
# Examples:
|
# Examples:
|
||||||
#
|
#
|
||||||
@ -1552,11 +1546,11 @@ module Gem::Net #:nodoc:
|
|||||||
attr_accessor :cert_store
|
attr_accessor :cert_store
|
||||||
|
|
||||||
# Sets or returns the available SSL ciphers.
|
# Sets or returns the available SSL ciphers.
|
||||||
# See {OpenSSL::SSL::SSLContext#ciphers=}[rdoc-ref:OpenSSL::SSL::SSLContext#ciphers-3D].
|
# See {OpenSSL::SSL::SSLContext#ciphers=}[OpenSSL::SSL::SSL::Context#ciphers=].
|
||||||
attr_accessor :ciphers
|
attr_accessor :ciphers
|
||||||
|
|
||||||
# Sets or returns the extra X509 certificates to be added to the certificate chain.
|
# Sets or returns the extra X509 certificates to be added to the certificate chain.
|
||||||
# See {OpenSSL::SSL::SSLContext#add_certificate}[rdoc-ref:OpenSSL::SSL::SSLContext#add_certificate].
|
# See {OpenSSL::SSL::SSLContext#add_certificate}[OpenSSL::SSL::SSL::Context#add_certificate].
|
||||||
attr_accessor :extra_chain_cert
|
attr_accessor :extra_chain_cert
|
||||||
|
|
||||||
# Sets or returns the OpenSSL::PKey::RSA or OpenSSL::PKey::DSA object.
|
# Sets or returns the OpenSSL::PKey::RSA or OpenSSL::PKey::DSA object.
|
||||||
@ -1566,15 +1560,15 @@ module Gem::Net #:nodoc:
|
|||||||
attr_accessor :ssl_timeout
|
attr_accessor :ssl_timeout
|
||||||
|
|
||||||
# Sets or returns the SSL version.
|
# Sets or returns the SSL version.
|
||||||
# See {OpenSSL::SSL::SSLContext#ssl_version=}[rdoc-ref:OpenSSL::SSL::SSLContext#ssl_version-3D].
|
# See {OpenSSL::SSL::SSLContext#ssl_version=}[OpenSSL::SSL::SSL::Context#ssl_version=].
|
||||||
attr_accessor :ssl_version
|
attr_accessor :ssl_version
|
||||||
|
|
||||||
# Sets or returns the minimum SSL version.
|
# Sets or returns the minimum SSL version.
|
||||||
# See {OpenSSL::SSL::SSLContext#min_version=}[rdoc-ref:OpenSSL::SSL::SSLContext#min_version-3D].
|
# See {OpenSSL::SSL::SSLContext#min_version=}[OpenSSL::SSL::SSL::Context#min_version=].
|
||||||
attr_accessor :min_version
|
attr_accessor :min_version
|
||||||
|
|
||||||
# Sets or returns the maximum SSL version.
|
# Sets or returns the maximum SSL version.
|
||||||
# See {OpenSSL::SSL::SSLContext#max_version=}[rdoc-ref:OpenSSL::SSL::SSLContext#max_version-3D].
|
# See {OpenSSL::SSL::SSLContext#max_version=}[OpenSSL::SSL::SSL::Context#max_version=].
|
||||||
attr_accessor :max_version
|
attr_accessor :max_version
|
||||||
|
|
||||||
# Sets or returns the callback for the server certification verification.
|
# Sets or returns the callback for the server certification verification.
|
||||||
@ -1590,7 +1584,7 @@ module Gem::Net #:nodoc:
|
|||||||
|
|
||||||
# Sets or returns whether to verify that the server certificate is valid
|
# Sets or returns whether to verify that the server certificate is valid
|
||||||
# for the hostname.
|
# for the hostname.
|
||||||
# See {OpenSSL::SSL::SSLContext#verify_hostname=}[rdoc-ref:OpenSSL::SSL::SSLContext#attribute-i-verify_mode].
|
# See {OpenSSL::SSL::SSLContext#verify_hostname=}[OpenSSL::SSL::SSL::Context#verify_hostname=].
|
||||||
attr_accessor :verify_hostname
|
attr_accessor :verify_hostname
|
||||||
|
|
||||||
# Returns the X509 certificate chain (an array of strings)
|
# Returns the X509 certificate chain (an array of strings)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user