class HTTP::Response::Inflater

def initialize(connection)

def initialize(connection)
  @connection = connection
end

def readpartial(*args)

def readpartial(*args)
  chunk = @connection.readpartial(*args)
  if chunk
    chunk = zstream.inflate(chunk)
  elsif !zstream.closed?
    zstream.finish if zstream.total_in.positive?
    zstream.close
  end
  chunk
end

def zstream

def zstream
  @zstream ||= Zlib::Inflate.new(32 + Zlib::MAX_WBITS)
end