summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNeha Pansare <neha.pansare@progress.com>2023-05-17 17:00:35 +0530
committerNeha Pansare <neha.pansare@progress.com>2023-05-17 17:00:35 +0530
commit703163d646861da6609e2fa172498a4a4cb1bd94 (patch)
tree8402242f535118bda1e84e6b2e4c32c80122f3d4
parent67990efc48fc73b6906c48bfdc5202694db58209 (diff)
downloadchef-neha-p6/for_test_net_http_patch.tar.gz
Signed-off-by: Neha Pansare <neha.pansare@progress.com>
-rw-r--r--habitat/plan.ps14
-rw-r--r--lib/chef/monkey_patches/net-http.rb5
2 files changed, 5 insertions, 4 deletions
diff --git a/habitat/plan.ps1 b/habitat/plan.ps1
index 03fc1da27a..3aebdbceb9 100644
--- a/habitat/plan.ps1
+++ b/habitat/plan.ps1
@@ -1,5 +1,5 @@
-$pkg_name="chef-infra-client"
-$pkg_origin="chef"
+$pkg_name="test_patched_chef18"
+$pkg_origin="np-test"
$pkg_version=(Get-Content $PLAN_CONTEXT/../VERSION)
$pkg_description="Chef Infra Client is an agent that runs locally on every node that is under management by Chef Infra. This package is binary-only to provide Chef Infra Client executables. It does not define a service to run."
$pkg_maintainer="The Chef Maintainers <maintainers@chef.io>"
diff --git a/lib/chef/monkey_patches/net-http.rb b/lib/chef/monkey_patches/net-http.rb
index fc192faf71..0231413ef9 100644
--- a/lib/chef/monkey_patches/net-http.rb
+++ b/lib/chef/monkey_patches/net-http.rb
@@ -1,5 +1,6 @@
if RUBY_VERSION.split(".")[0..1].join(".") == "3.1"
- require "net/http"
+ require "net/http" unless defined?(Net::HTTP)
+ puts "*********** LOading patch *************"
# This is monkey-patch for ruby 3.1.x
# Due to change https://github.com/ruby/net-http/pull/10, when making net/http requests to a url which supports only IPv6 and not IPv4,
# ruby waits for IPv4 request to timeout first, then makes IPv6 request. This increased response time.
@@ -7,7 +8,7 @@ if RUBY_VERSION.split(".")[0..1].join(".") == "3.1"
# NOTE 2: We are patching action `connect` from here https://github.com/ruby/ruby/blob/f88bff770578583a708093f4a0d8b1483a1d2039/lib/net/http.rb#L1000
module Net
- class HTTP < Protocol
+ class HTTP
def connect
if use_ssl?
# reference early to load OpenSSL before connecting,