summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorNick Lewis <nick@puppetlabs.com>2011-07-19 15:19:10 -0700
committerJacob Helwig <jacob@puppetlabs.com>2011-08-19 13:50:15 -0700
commit3093047e07bdc69222c26d11aff50353f64c977d (patch)
treef162577bbae7c1175571e404bbadccb3c0004abe /lib
parent57d62179d248b8a7982921e2c60f5d9e9e0a8ba9 (diff)
downloadpuppet-3093047e07bdc69222c26d11aff50353f64c977d.tar.gz
puppet-3093047e07bdc69222c26d11aff50353f64c977d.tar.xz
puppet-3093047e07bdc69222c26d11aff50353f64c977d.zip
Remove Puppet::Network::HttpPool keep_alive handling
Keep alive has been disabled since 2008, and seems to have caused problems when it was enabled before then. Since there doesn't seem to be any push to get it working again, just remove it to simplify this code. This also allows us to entirely remove the usage of Puppet::Util::Cacher from HttpPool. Paired-With: Jacob Helwig <jacob@puppetlabs.com> (cherry picked from commit 185a666018c0cf0b2c497f655f942a82cd22e49e)
Diffstat (limited to 'lib')
-rw-r--r--lib/puppet/configurer.rb4
-rw-r--r--lib/puppet/network/client.rb5
-rw-r--r--lib/puppet/network/http_pool.rb55
3 files changed, 0 insertions, 64 deletions
diff --git a/lib/puppet/configurer.rb b/lib/puppet/configurer.rb
index 3d6e8557c..5581917a1 100644
--- a/lib/puppet/configurer.rb
+++ b/lib/puppet/configurer.rb
@@ -161,10 +161,6 @@ class Puppet::Configurer
# Make sure we forget the retained module_directories of any autoload
# we might have used.
Thread.current[:env_module_directories] = nil
-
- # Now close all of our existing http connections, since there's no
- # reason to leave them lying open.
- Puppet::Network::HttpPool.clear_http_instances
end
ensure
Puppet::Util::Log.close(report)
diff --git a/lib/puppet/network/client.rb b/lib/puppet/network/client.rb
index c56b21393..f9c4c5fea 100644
--- a/lib/puppet/network/client.rb
+++ b/lib/puppet/network/client.rb
@@ -82,11 +82,6 @@ class Puppet::Network::Client
self.read_cert
- # We have to start the HTTP connection manually before we start
- # sending it requests or keep-alive won't work. Note that with #1010,
- # we don't currently actually want keep-alive.
- @driver.start if @driver.respond_to? :start and Puppet::Network::HttpPool.keep_alive?
-
@local = false
elsif hash.include?(driverparam)
@driver = hash[driverparam]
diff --git a/lib/puppet/network/http_pool.rb b/lib/puppet/network/http_pool.rb
index 7d227b4d4..d4ec48d22 100644
--- a/lib/puppet/network/http_pool.rb
+++ b/lib/puppet/network/http_pool.rb
@@ -4,50 +4,12 @@ require 'puppet/util/cacher'
module Puppet::Network; end
-# Manage Net::HTTP instances for keep-alive.
module Puppet::Network::HttpPool
- class << self
- include Puppet::Util::Cacher
-
- private
-
- cached_attr(:http_cache) { Hash.new }
- end
-
# Use the global localhost instance.
def self.ssl_host
Puppet::SSL::Host.localhost
end
- # 2008/03/23
- # LAK:WARNING: Enabling this has a high propability of
- # causing corrupt files and who knows what else. See #1010.
- HTTP_KEEP_ALIVE = false
-
- def self.keep_alive?
- HTTP_KEEP_ALIVE
- end
-
- # Clear our http cache, closing all connections.
- def self.clear_http_instances
- http_cache.each do |name, connection|
- connection.finish if connection.started?
- end
- Puppet::Util::Cacher.expire
- end
-
- # Make sure we set the driver up when we read the cert in.
- def self.read_cert
- if val = super # This calls read_cert from the Puppet::SSLCertificates::Support module.
- # Clear out all of our connections, since they previously had no cert and now they
- # should have them.
- clear_http_instances
- return val
- else
- return false
- end
- end
-
# Use cert information from a Puppet client to set up the http object.
def self.cert_setup(http)
# Just no-op if we don't have certs.
@@ -63,21 +25,6 @@ module Puppet::Network::HttpPool
# Retrieve a cached http instance if caching is enabled, else return
# a new one.
def self.http_instance(host, port, reset = false)
- # We overwrite the uninitialized @http here with a cached one.
- key = "#{host}:#{port}"
-
- # Return our cached instance if we've got a cache, as long as we're not
- # resetting the instance.
- if keep_alive?
- return http_cache[key] if ! reset and http_cache[key]
-
- # Clean up old connections if we have them.
- if http = http_cache[key]
- http_cache.delete(key)
- http.finish if http.started?
- end
- end
-
args = [host, port]
if Puppet[:http_proxy_host] == "none"
args << nil << nil
@@ -97,8 +44,6 @@ module Puppet::Network::HttpPool
cert_setup(http)
- http_cache[key] = http if keep_alive?
-
http
end
end