Skip to content

Commit

Permalink
add some debug so we can see when compression is used
Browse files Browse the repository at this point in the history
  • Loading branch information
danielsdeleo committed Dec 19, 2011
1 parent 974a7d8 commit eaa9442
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions chef/lib/chef/rest.rb
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,10 @@ def api_request(method, url, headers={}, data=false)
def decompress_body(response)
case response[CONTENT_ENCODING]
when GZIP
Chef::Log.debug "decompressing gzip response"
Zlib::GzipReader.new(StringIO.new(response.body), encoding: "ASCII-8BIT").read
when DEFLATE
Chef::Log.debug "decompressing deflate response"
Zlib::Inflate.inflate(response.body)
else
response.body
Expand Down Expand Up @@ -414,8 +416,10 @@ def stream_to_tempfile(url, response)

inflater = case response[CONTENT_ENCODING]
when GZIP
Chef::Log.debug "decompressing gzip stream"
Zlib::Inflate.new(Zlib::MAX_WBITS + 16)
when DEFLATE
Chef::Log.debug "decompressing inflate stream"
Zlib::Inflate.new
else
NoopInflater.new
Expand Down

0 comments on commit eaa9442

Please sign in to comment.