summaryrefslogtreecommitdiff
path: root/lib/chef/http.rb
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2016-07-29 16:29:28 -0700
committerLamont Granquist <lamont@scriptkiddie.org>2016-08-09 09:17:52 -0700
commitc5cf649b253ffb35684576e207f7c52b205f6360 (patch)
treefd90f084bf4a3551cf886da473c7d32073544ba2 /lib/chef/http.rb
parent7164a034a169532152acd812f40bbe8f8fbe35f6 (diff)
downloadchef-c5cf649b253ffb35684576e207f7c52b205f6360.tar.gz
per-host/port cache of BasicClient
Diffstat (limited to 'lib/chef/http.rb')
-rw-r--r--lib/chef/http.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/chef/http.rb b/lib/chef/http.rb
index 00b13482a1..0406a7a975 100644
--- a/lib/chef/http.rb
+++ b/lib/chef/http.rb
@@ -227,7 +227,11 @@ class Chef
end
def http_client(base_url = nil)
- @http_client =
+ # the per-host per-port cache here gets peristent connections correct in the
+ # face of redirects to different servers
+ @http_client ||= {}
+ @http_client[base_url.host] ||= {}
+ @http_client[base_url.host][base_url.port] ||=
begin
base_url ||= url
if chef_zero_uri?(base_url)