summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2008-03-24 09:56:39 -0500
committerLuke Kanies <luke@madstop.com>2008-03-24 09:56:39 -0500
commit273c7ec5259d911d7d153662ad2c69c5df0a7fee (patch)
treed8786b59b39402312cbafb910399fdc5b47a47ff /lib
parent6aa6fdb119f55c3b66e0a13a7df076256083359c (diff)
downloadpuppet-273c7ec5259d911d7d153662ad2c69c5df0a7fee.tar.gz
puppet-273c7ec5259d911d7d153662ad2c69c5df0a7fee.tar.xz
puppet-273c7ec5259d911d7d153662ad2c69c5df0a7fee.zip
Disabling http keep-alive as a means of preventing #1010.
There is now a constant in Puppet::Network::HttpPool that will disable or enable this feature, but note that we determined that it can cause corruption, especially in file serving (but it's client-side corruption).
Diffstat (limited to 'lib')
-rw-r--r--lib/puppet/network/client.rb5
-rw-r--r--lib/puppet/network/http_pool.rb25
2 files changed, 21 insertions, 9 deletions
diff --git a/lib/puppet/network/client.rb b/lib/puppet/network/client.rb
index cf1782f79..478883959 100644
--- a/lib/puppet/network/client.rb
+++ b/lib/puppet/network/client.rb
@@ -96,8 +96,9 @@ 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.
- @driver.start if @driver.respond_to? :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)
diff --git a/lib/puppet/network/http_pool.rb b/lib/puppet/network/http_pool.rb
index 69574d8fd..9d37f2eeb 100644
--- a/lib/puppet/network/http_pool.rb
+++ b/lib/puppet/network/http_pool.rb
@@ -6,6 +6,15 @@ end
# Manage Net::HTTP instances for keep-alive.
module Puppet::Network::HttpPool
+ # 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
+
# This handles reading in the key and such-like.
extend Puppet::SSLCertificates::Support
@http_cache = {}
@@ -56,12 +65,14 @@ module Puppet::Network::HttpPool
# Return our cached instance if we've got a cache, as long as we're not
# resetting the instance.
- 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?
+ 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]
@@ -88,7 +99,7 @@ module Puppet::Network::HttpPool
cert_setup(http)
- @http_cache[key] = http
+ @http_cache[key] = http if keep_alive?
return http
end