summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorNoah Kantrowitz <noah@coderanger.net>2016-02-29 15:34:15 -0800
committerNoah Kantrowitz <noah@coderanger.net>2016-02-29 15:34:15 -0800
commitb4b8120191de45f5f8f8611dde244fde714b1004 (patch)
tree698b8c7b85afaafede57ebcfbdf1a5f7a3e78e51 /lib
parentc824aa564fa1a193d76b47fa430742c0a756eaa2 (diff)
downloadchef-b4b8120191de45f5f8f8611dde244fde714b1004.tar.gz
Split the negative check to its own log message.
Diffstat (limited to 'lib')
-rw-r--r--lib/chef/http/validate_content_length.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/chef/http/validate_content_length.rb b/lib/chef/http/validate_content_length.rb
index 17219a7c89..81d3b0fb74 100644
--- a/lib/chef/http/validate_content_length.rb
+++ b/lib/chef/http/validate_content_length.rb
@@ -86,11 +86,16 @@ class Chef
transfer_encoding = http_response["transfer-encoding"]
content_encoding = http_response["content-encoding"]
- if content_length.nil? || content_length < 0
+ if content_length.nil?
Chef::Log.debug "HTTP server did not include a Content-Length header in response, cannot identify truncated downloads."
return true
end
+ if content_length < 0
+ Chef::Log.debug "HTTP server responded with a negative Content-Length header (#{content_length}), cannot identify truncated downloads."
+ return true
+ end
+
# if Transfer-Encoding is set the RFC states that we must ignore the Content-Length field
# CHEF-5041: some proxies uncompress gzip content, leave the incorrect content-length, but set the transfer-encoding field
unless transfer_encoding.nil?