Method: Chef::HTTP::Decompressor#stream_response_handler

Defined in:
lib/chef/http/decompressor.rb

#stream_response_handler(response) ⇒ Object

This isn’t used when this class is used as middleware; it returns an object you can use to unzip/inflate a streaming response.



96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# File 'lib/chef/http/decompressor.rb', line 96

def stream_response_handler(response)
  if gzip_disabled?
    Chef::Log.trace "disable_gzip is set. \
      Not using #{response[CONTENT_ENCODING]} \
      and initializing noop stream deflator."
    NoopInflater.new
  else
    case response[CONTENT_ENCODING]
    when GZIP
      Chef::Log.trace "Initializing gzip stream deflator"
      GzipInflater.new
    when DEFLATE
      Chef::Log.trace "Initializing deflate stream deflator"
      DeflateInflater.new
    else
      Chef::Log.trace "content_encoding = '#{response[CONTENT_ENCODING]}' \
        initializing noop stream deflator."
      NoopInflater.new
    end
  end
end