summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlamont-granquist <lamont@scriptkiddie.org>2014-04-09 10:17:50 -0700
committerlamont-granquist <lamont@scriptkiddie.org>2014-04-09 10:17:50 -0700
commit1ff344fa64068c9b8638a11a781adcb72ddaed2f (patch)
treecc25b9549a32c34fffa70c7ccc2da1033a6d3f49
parent67d077674ce4c58c73b245fd8a73a1c91dc6607a (diff)
parent596c8451231a1bdd14da0b7d08d84e4e35a10e0f (diff)
downloadchef-1ff344fa64068c9b8638a11a781adcb72ddaed2f.tar.gz
Merge pull request #1368 from opscode/lcg/CHEF-5198
reorder middleware in chef::http::simple
-rw-r--r--lib/chef/http/simple.rb11
-rw-r--r--spec/unit/http/simple_spec.rb2
2 files changed, 5 insertions, 8 deletions
diff --git a/lib/chef/http/simple.rb b/lib/chef/http/simple.rb
index d675a17ee8..40ac864224 100644
--- a/lib/chef/http/simple.rb
+++ b/lib/chef/http/simple.rb
@@ -7,15 +7,12 @@ class Chef
class HTTP
class Simple < HTTP
-
+ # When we 'use' middleware the first middleware is applied last on requests and
+ # first on responses (confusingly). So validatecontentlength must come before
+ # decompressor in order to be applied before decmopressing the response.
+ use ValidateContentLength
use Decompressor
use CookieManager
-
- # ValidateContentLength should come after Decompressor
- # because the order of middlewares is reversed when handling
- # responses.
- use ValidateContentLength
-
end
end
end
diff --git a/spec/unit/http/simple_spec.rb b/spec/unit/http/simple_spec.rb
index b33ef1d553..ae3e31bc94 100644
--- a/spec/unit/http/simple_spec.rb
+++ b/spec/unit/http/simple_spec.rb
@@ -27,6 +27,6 @@ describe Chef::HTTP::Simple do
content_length.should_not be_nil
decompressor.should_not be_nil
- (decompressor < content_length).should be_true
+ (decompressor > content_length).should be_true
end
end