# File lib/puppet/network/http_pool.rb, line 65
 65:     def self.http_instance(host, port, reset = false)
 66:         # We overwrite the uninitialized @http here with a cached one.
 67:         key = "%s:%s" % [host, port]
 68: 
 69:         # Return our cached instance if we've got a cache, as long as we're not
 70:         # resetting the instance.
 71:         if keep_alive?
 72:             return http_cache[key] if ! reset and http_cache[key]
 73: 
 74:             # Clean up old connections if we have them.
 75:             if http = http_cache[key]
 76:                 http_cache.delete(key)
 77:                 http.finish if http.started?
 78:             end
 79:         end
 80: 
 81:         args = [host, port]
 82:         if Puppet[:http_proxy_host] == "none"
 83:             args << nil << nil
 84:         else
 85:             args << Puppet[:http_proxy_host] << Puppet[:http_proxy_port]
 86:         end
 87:         http = Net::HTTP.new(*args)
 88: 
 89:         # Pop open the http client a little; older versions of Net::HTTP(s) didn't
 90:         # give us a reader for ca_file... Grr...
 91:         class << http; attr_accessor :ca_file; end
 92: 
 93:         http.use_ssl = true
 94:         # Use configured timeout (#1176)
 95:         http.read_timeout = Puppet[:configtimeout]
 96:         http.open_timeout = Puppet[:configtimeout]
 97:         # JJM Configurable fix for #896.
 98:         http.enable_post_connection_check = Puppet[:http_enable_post_connection_check]
 99: 
100:         cert_setup(http)
101: 
102:         http_cache[key] = http if keep_alive?
103: 
104:         return http
105:     end