class EventMachine::HttpDecoders::GZip

Oneshot decompressor, due to lack of a streaming Gzip reader implementation. We may steal code from Zliby to improve this.

For now, do not put `gzip’ or `compressed’ in your accept-encoding header if you expect much data through the :on_response interface.

Public Instance Methods

decompress(compressed) click to toggle source
# File lib/em-http/decoders.rb, line 105
def decompress(compressed)
  @buf ||= ''
  @buf += compressed
  nil
end
finalize() click to toggle source
# File lib/em-http/decoders.rb, line 111
def finalize
  begin
    Zlib::GzipReader.new(StringIO.new(@buf.to_s)).read
  rescue Zlib::Error
    raise DecoderError
  end
end

Public Class Methods

encoding_names() click to toggle source
# File lib/em-http/decoders.rb, line 101
def self.encoding_names
  %w(gzip compressed)
end