65: def self.http_instance(host, port, reset = false)
66:
67: key = "%s:%s" % [host, port]
68:
69:
70:
71: if keep_alive?
72: return http_cache[key] if ! reset and http_cache[key]
73:
74:
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:
90:
91: class << http; attr_accessor :ca_file; end
92:
93: http.use_ssl = true
94:
95: http.read_timeout = Puppet[:configtimeout]
96: http.open_timeout = Puppet[:configtimeout]
97:
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