Sha256: b03e309b11a5c0c2241de853475defcb2f906387b18150cd5947b086ec3a2a0d

Contents?: true

Size: 576 Bytes

Versions: 23

Compression:

Stored size: 576 Bytes

Contents

# frozen_string_literal: true

require "zlib"

module HTTP
  class Response
    class Inflater
      attr_reader :connection

      def initialize(connection)
        @connection = connection
      end

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

      private

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

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
http-4.4.1 lib/http/response/inflater.rb
http-4.4.0 lib/http/response/inflater.rb
http-5.0.0.pre3 lib/http/response/inflater.rb
http-5.0.0.pre2 lib/http/response/inflater.rb
http-4.3.0 lib/http/response/inflater.rb
http-4.2.0 lib/http/response/inflater.rb
http-4.1.1 lib/http/response/inflater.rb
http-4.1.0 lib/http/response/inflater.rb
http-4.0.5 lib/http/response/inflater.rb
http-4.0.4 lib/http/response/inflater.rb
http-5.0.0.pre lib/http/response/inflater.rb
http-4.0.3 lib/http/response/inflater.rb
http-4.0.2 lib/http/response/inflater.rb
http-4.0.1 lib/http/response/inflater.rb
http-4.0.0 lib/http/response/inflater.rb
http-3.3.0 lib/http/response/inflater.rb
http-3.2.1 lib/http/response/inflater.rb
http-3.2.0 lib/http/response/inflater.rb
http-3.1.0 lib/http/response/inflater.rb
http-3.0.0 lib/http/response/inflater.rb