65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
|
# File 'lib/chef/http/basic_client.rb', line 65
def request(method, url, req_body, = {})
http_request = HTTPRequest.new(method, url, req_body, ).http_request
Chef::Log.trace("Initiating #{method} to #{url}")
Chef::Log.trace("---- HTTP Request Header Data: ----")
.each do |name, value|
Chef::Log.trace("#{name}: #{value}")
end
Chef::Log.trace("---- End HTTP Request Header Data ----")
http_client.request(http_request) do |response|
Chef::Log.trace("---- HTTP Status and Header Data: ----")
Chef::Log.trace("HTTP #{response.http_version} #{response.code} #{response.msg}")
response.each do |, value|
Chef::Log.trace("#{header}: #{value}")
end
Chef::Log.trace("---- End HTTP Status/Header Data ----")
if !response.code || !response.code.start_with?("2")
if response.body
Chef::Log.trace("---- HTTP Response Body ----")
Chef::Log.trace(response.body)
Chef::Log.trace("---- End HTTP Response Body -----")
end
if req_body
Chef::Log.trace("---- HTTP Request Body ----")
Chef::Log.trace(req_body)
Chef::Log.trace("---- End HTTP Request Body ----")
end
end
yield response if block_given?
return [http_request, response]
end
rescue OpenSSL::SSL::SSLError => e
Chef::Log.error("SSL Validation failure connecting to host: #{host} - #{e.message}")
raise
end
|