summaryrefslogtreecommitdiffstats
path: root/lib/puppet/network/http_pool.rb
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2008-03-31 23:56:09 -0500
committerLuke Kanies <luke@madstop.com>2008-03-31 23:56:09 -0500
commit88dc49cb7b0efe757c92ce28c807b91335acb07a (patch)
tree13fe4561f1f524f97a8bb2c1ff84c1ef981d0241 /lib/puppet/network/http_pool.rb
parent4165edaeb71ee2883b1bb85ff39a52d5628b259f (diff)
parenta8592f1009040ebf30a98268610915cc33bb3f63 (diff)
downloadpuppet-88dc49cb7b0efe757c92ce28c807b91335acb07a.tar.gz
puppet-88dc49cb7b0efe757c92ce28c807b91335acb07a.tar.xz
puppet-88dc49cb7b0efe757c92ce28c807b91335acb07a.zip
Merge branch 'master' into master_no_global_resources
Conflicts: lib/puppet/node/catalog.rb lib/puppet/type/pfile.rb lib/puppet/type/pfilebucket.rb lib/puppet/util/filetype.rb spec/unit/node/catalog.rb spec/unit/other/transbucket.rb spec/unit/ral/provider/mount/parsed.rb spec/unit/ral/types/file.rb spec/unit/ral/types/interface.rb spec/unit/ral/types/mount.rb spec/unit/ral/types/package.rb spec/unit/ral/types/schedule.rb spec/unit/ral/types/service.rb test/language/compile.rb test/language/lexer.rb test/language/snippets.rb test/lib/puppettest.rb test/ral/types/basic.rb test/ral/types/cron.rb test/ral/types/exec.rb test/ral/types/file.rb test/ral/types/file/target.rb test/ral/types/filebucket.rb test/ral/types/fileignoresource.rb test/ral/types/filesources.rb test/ral/types/group.rb test/ral/types/host.rb test/ral/types/parameter.rb test/ral/types/sshkey.rb test/ral/types/tidy.rb test/ral/types/user.rb test/ral/types/yumrepo.rb
Diffstat (limited to 'lib/puppet/network/http_pool.rb')
-rw-r--r--lib/puppet/network/http_pool.rb26
1 files changed, 20 insertions, 6 deletions
diff --git a/lib/puppet/network/http_pool.rb b/lib/puppet/network/http_pool.rb
index 99f09a90c..9d37f2eeb 100644
--- a/lib/puppet/network/http_pool.rb
+++ b/lib/puppet/network/http_pool.rb
@@ -1,8 +1,20 @@
require 'puppet/sslcertificates/support'
require 'net/https'
+module Puppet::Network
+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 = {}
@@ -53,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]
+ 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?
+ # 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]
@@ -85,7 +99,7 @@ module Puppet::Network::HttpPool
cert_setup(http)
- @http_cache[key] = http
+ @http_cache[key] = http if keep_alive?
return http
end