summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorNoah Kantrowitz <noah@coderanger.net>2016-03-01 12:17:30 -0800
committerNoah Kantrowitz <noah@coderanger.net>2016-03-01 12:17:30 -0800
commit8b94d2346158f42e37ae0f54f65710e3122e8098 (patch)
tree5e306b8c402751b52e65264a163c7c63387ac03a /spec
parent55753254660c5a1a91eef45791989322dc186660 (diff)
parentba3ad73d90154934ec25eca3b5c5f17f5e11a437 (diff)
downloadchef-8b94d2346158f42e37ae0f54f65710e3122e8098.tar.gz
Merge pull request #4646 from coderanger/negative-length
Handle negative content length headers too.
Diffstat (limited to 'spec')
-rw-r--r--spec/unit/http/validate_content_length_spec.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/spec/unit/http/validate_content_length_spec.rb b/spec/unit/http/validate_content_length_spec.rb
index 37bf6c2180..85f8d92f78 100644
--- a/spec/unit/http/validate_content_length_spec.rb
+++ b/spec/unit/http/validate_content_length_spec.rb
@@ -119,6 +119,21 @@ describe Chef::HTTP::ValidateContentLength do
end
end
+ describe "with negative Content-Length header" do
+ let(:content_length_value) { "-1" }
+
+ %w{direct streaming}.each do |req_type|
+ describe "when running #{req_type} request" do
+ let(:request_type) { req_type.to_sym }
+
+ it "should skip validation and log for debug" do
+ run_content_length_validation
+ expect(debug_output).to include("HTTP server responded with a negative Content-Length header (-1), cannot identify truncated downloads.")
+ end
+ end
+ end
+ end
+
describe "with correct Content-Length header" do
%w{direct streaming}.each do |req_type|
describe "when running #{req_type} request" do