Class: HTTP::Response::Inflater
- Inherits:
-
Object
- Object
- HTTP::Response::Inflater
- Defined in:
- lib/http/response/inflater.rb
Overview
Decompresses gzip/deflate response body streams
Instance Attribute Summary collapse
-
#connection ⇒ HTTP::Connection
readonly
The underlying connection.
Instance Method Summary collapse
-
#initialize(connection) ⇒ Inflater
constructor
Create a new Inflater wrapping a connection.
-
#readpartial ⇒ String
Read and inflate a chunk of the response body.
Constructor Details
#initialize(connection) ⇒ Inflater
Create a new Inflater wrapping a connection
26 27 28 |
# File 'lib/http/response/inflater.rb', line 26 def initialize(connection) @connection = connection end |
Instance Attribute Details
#connection ⇒ HTTP::Connection (readonly)
The underlying connection
16 17 18 |
# File 'lib/http/response/inflater.rb', line 16 def connection @connection end |
Instance Method Details
#readpartial ⇒ String
Read and inflate a chunk of the response body
38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/http/response/inflater.rb', line 38 def readpartial(*) chunk = @connection.readpartial(*) zstream.inflate(chunk) rescue EOFError unless zstream.closed? zstream.finished? ? zstream.finish : zstream.reset zstream.close end raise end |