Class: EventMachine::HttpDecoders::GZip
- Defined in:
- lib/em-http/decoders.rb
Overview
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.
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Base
Constructor Details
This class inherits a constructor from EventMachine::HttpDecoders::Base
Class Method Details
.encoding_names ⇒ Object
100 101 102 |
# File 'lib/em-http/decoders.rb', line 100 def self.encoding_names %w(gzip compressed) end |
Instance Method Details
#decompress(compressed) ⇒ Object
104 105 106 107 108 |
# File 'lib/em-http/decoders.rb', line 104 def decompress(compressed) @buf ||= '' @buf += compressed nil end |
#finalize ⇒ Object
110 111 112 |
# File 'lib/em-http/decoders.rb', line 110 def finalize Zlib::GzipReader.new(StringIO.new(@buf)).read end |