module Puppet::Network::HttpPool
This module is deprecated.
@api public @deprecated Use {Puppet::HTTP::Client} instead.
Public Class Methods
Retrieve a connection for the given host and port.
@param host [String] The host to connect to @param port [Integer] The port to connect to @param use_ssl [Boolean] Whether to use SSL, defaults to `true`. @param ssl_context [Puppet::SSL:SSLContext, nil] The ssl context to use
when making HTTPS connections. Required when `use_ssl` is `true`.
@return [Puppet::Network::HTTP::Connection]
@deprecated Use {Puppet.runtime} instead. @api public
# File lib/puppet/network/http_pool.rb 58 def self.connection(host, port, use_ssl: true, ssl_context: nil) 59 Puppet.warn_once('deprecations', self, "The method 'Puppet::Network::HttpPool.connection' is deprecated. Use Puppet.runtime[:http] instead") 60 61 if use_ssl 62 unless ssl_context 63 # TRANSLATORS 'ssl_context' is an argument and should not be translated 64 raise ArgumentError, _("An ssl_context is required when connecting to 'https://%{host}:%{port}'") % { host: host, port: port } 65 end 66 67 verifier = Puppet::SSL::Verifier.new(host, ssl_context) 68 http_client_class.new(host, port, use_ssl: true, verifier: verifier) 69 else 70 if ssl_context 71 # TRANSLATORS 'ssl_context' is an argument and should not be translated 72 Puppet.warning(_("An ssl_context is unnecessary when connecting to 'http://%{host}:%{port}' and will be ignored") % { host: host, port: port }) 73 end 74 75 http_client_class.new(host, port, use_ssl: false) 76 end 77 end
# File lib/puppet/network/http_pool.rb 15 def self.http_client_class 16 @http_client_class 17 end
# File lib/puppet/network/http_pool.rb 18 def self.http_client_class=(klass) 19 @http_client_class = klass 20 end
Retrieve a connection for the given host and port.
@param host [String] The hostname to connect to @param port [Integer] The port on the host to connect to @param use_ssl [Boolean] Whether to use an SSL connection @param verify_peer [Boolean] Whether to verify the peer credentials, if possible. Verification will not take place if the CA certificate is missing. @return [Puppet::Network::HTTP::Connection]
@deprecated Use {Puppet.runtime} instead. @api public
# File lib/puppet/network/http_pool.rb 33 def self.http_instance(host, port, use_ssl = true, verify_peer = true) 34 Puppet.warn_once('deprecations', self, "The method 'Puppet::Network::HttpPool.http_instance' is deprecated. Use Puppet.runtime[:http] instead") 35 36 if verify_peer 37 verifier = Puppet::SSL::Verifier.new(host, nil) 38 http_client_class.new(host, port, use_ssl: use_ssl, verifier: verifier) 39 else 40 ssl = Puppet::SSL::SSLProvider.new 41 verifier = Puppet::SSL::Verifier.new(host, ssl.create_insecure_context) 42 http_client_class.new(host, port, use_ssl: use_ssl, verifier: verifier) 43 end 44 end