diff options
Diffstat (limited to 'lib/chef')
-rw-r--r-- | lib/chef/http/validate_content_length.rb | 7 |
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? |