diff options
| author | Samuel Giddins <segiddins@segiddins.me> | 2024-10-07 09:02:40 -0700 |
|---|---|---|
| committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2024-10-10 10:03:34 +0900 |
| commit | a392ee1437efbaa84edf3412bb96a5d667a08387 (patch) | |
| tree | bd61480700c67be50841bcb37729135318bddced /lib | |
| parent | a838f980f599d95ccf344157f7074e997af31f48 (diff) | |
Update vendored net-http
Signed-off-by: Samuel Giddins <segiddins@segiddins.me>
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/11860
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb | 54 | ||||
| -rw-r--r-- | lib/bundler/vendor/uri/lib/uri/common.rb | 2 | ||||
| -rw-r--r-- | lib/bundler/vendor/uri/lib/uri/version.rb | 2 | ||||
| -rw-r--r-- | lib/rubygems/vendor/net-http/lib/net/http.rb | 2 | ||||
| -rw-r--r-- | lib/rubygems/vendor/uri/lib/uri/common.rb | 2 | ||||
| -rw-r--r-- | lib/rubygems/vendor/uri/lib/uri/version.rb | 2 |
6 files changed, 53 insertions, 11 deletions
diff --git a/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb b/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb index c15b346330..cfc0f48197 100644 --- a/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +++ b/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb @@ -68,6 +68,8 @@ autoload :OpenSSL, 'openssl' # #verify_callback :: For server certificate verification # #verify_depth :: Depth of certificate verification # #verify_mode :: How connections should be verified +# #verify_hostname :: Use hostname verification for server certificate +# during the handshake # # == Proxies # @@ -174,7 +176,7 @@ class Gem::Net::HTTP::Persistent ## # The version of Gem::Net::HTTP::Persistent you are using - VERSION = '4.0.2' + VERSION = '4.0.4' ## # Error class for errors raised by Gem::Net::HTTP::Persistent. Various @@ -450,6 +452,21 @@ class Gem::Net::HTTP::Persistent attr_reader :verify_mode ## + # HTTPS verify_hostname. + # + # If a client sets this to true and enables SNI with SSLSocket#hostname=, + # the hostname verification on the server certificate is performed + # automatically during the handshake using + # OpenSSL::SSL.verify_certificate_identity(). + # + # You can set +verify_hostname+ as true to use hostname verification + # during the handshake. + # + # NOTE: This works with Ruby > 3.0. + + attr_reader :verify_hostname + + ## # Creates a new Gem::Net::HTTP::Persistent. # # Set a +name+ for fun. Your library name should be good enough, but this @@ -508,6 +525,7 @@ class Gem::Net::HTTP::Persistent @verify_callback = nil @verify_depth = nil @verify_mode = nil + @verify_hostname = nil @cert_store = nil @generation = 0 # incremented when proxy Gem::URI changes @@ -607,13 +625,23 @@ class Gem::Net::HTTP::Persistent return yield connection rescue Errno::ECONNREFUSED - address = http.proxy_address || http.address - port = http.proxy_port || http.port + 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 - address = http.proxy_address || http.address - port = http.proxy_port || http.port + 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 @@ -948,8 +976,10 @@ class Gem::Net::HTTP::Persistent connection.min_version = @min_version if @min_version connection.max_version = @max_version if @max_version - connection.verify_depth = @verify_depth - connection.verify_mode = @verify_mode + connection.verify_depth = @verify_depth + connection.verify_mode = @verify_mode + connection.verify_hostname = @verify_hostname if + @verify_hostname != nil && connection.respond_to?(:verify_hostname=) if OpenSSL::SSL::VERIFY_PEER == OpenSSL::SSL::VERIFY_NONE and not Object.const_defined?(:I_KNOW_THAT_OPENSSL_VERIFY_PEER_EQUALS_VERIFY_NONE_IS_WRONG) then @@ -1059,6 +1089,15 @@ application: end ## + # Sets the HTTPS verify_hostname. + + def verify_hostname= verify_hostname + @verify_hostname = verify_hostname + + reconnect_ssl + end + + ## # SSL verification callback. def verify_callback= callback @@ -1070,4 +1109,3 @@ end require_relative 'persistent/connection' require_relative 'persistent/pool' - diff --git a/lib/bundler/vendor/uri/lib/uri/common.rb b/lib/bundler/vendor/uri/lib/uri/common.rb index 93f4f226ad..89044da036 100644 --- a/lib/bundler/vendor/uri/lib/uri/common.rb +++ b/lib/bundler/vendor/uri/lib/uri/common.rb @@ -19,6 +19,8 @@ module Bundler::URI Parser = RFC2396_Parser RFC3986_PARSER = RFC3986_Parser.new Ractor.make_shareable(RFC3986_PARSER) if defined?(Ractor) + RFC2396_PARSER = RFC2396_Parser.new + Ractor.make_shareable(RFC2396_PARSER) if defined?(Ractor) # Bundler::URI::Parser.new DEFAULT_PARSER = Parser.new diff --git a/lib/bundler/vendor/uri/lib/uri/version.rb b/lib/bundler/vendor/uri/lib/uri/version.rb index 1fa1c7c09a..ac94e15221 100644 --- a/lib/bundler/vendor/uri/lib/uri/version.rb +++ b/lib/bundler/vendor/uri/lib/uri/version.rb @@ -1,6 +1,6 @@ module Bundler::URI # :stopdoc: - VERSION_CODE = '001300'.freeze + VERSION_CODE = '001301'.freeze VERSION = VERSION_CODE.scan(/../).collect{|n| n.to_i}.join('.').freeze # :startdoc: end diff --git a/lib/rubygems/vendor/net-http/lib/net/http.rb b/lib/rubygems/vendor/net-http/lib/net/http.rb index 7b15c3cf54..1a7074819d 100644 --- a/lib/rubygems/vendor/net-http/lib/net/http.rb +++ b/lib/rubygems/vendor/net-http/lib/net/http.rb @@ -722,7 +722,7 @@ module Gem::Net #:nodoc: class HTTP < Protocol # :stopdoc: - VERSION = "0.4.0" + VERSION = "0.4.1" HTTPVersion = '1.1' begin require 'zlib' diff --git a/lib/rubygems/vendor/uri/lib/uri/common.rb b/lib/rubygems/vendor/uri/lib/uri/common.rb index 921fb9dd28..da2651084c 100644 --- a/lib/rubygems/vendor/uri/lib/uri/common.rb +++ b/lib/rubygems/vendor/uri/lib/uri/common.rb @@ -19,6 +19,8 @@ module Gem::URI Parser = RFC2396_Parser RFC3986_PARSER = RFC3986_Parser.new Ractor.make_shareable(RFC3986_PARSER) if defined?(Ractor) + RFC2396_PARSER = RFC2396_Parser.new + Ractor.make_shareable(RFC2396_PARSER) if defined?(Ractor) # Gem::URI::Parser.new DEFAULT_PARSER = Parser.new diff --git a/lib/rubygems/vendor/uri/lib/uri/version.rb b/lib/rubygems/vendor/uri/lib/uri/version.rb index 3c80c334d4..080744095c 100644 --- a/lib/rubygems/vendor/uri/lib/uri/version.rb +++ b/lib/rubygems/vendor/uri/lib/uri/version.rb @@ -1,6 +1,6 @@ module Gem::URI # :stopdoc: - VERSION_CODE = '001300'.freeze + VERSION_CODE = '001301'.freeze VERSION = VERSION_CODE.scan(/../).collect{|n| n.to_i}.join('.').freeze # :startdoc: end |
