Sha256: 0dda492b337795d33044beeb4fc2da9836868fbb80d093abc5e8184c79185ab7

Contents?: true

Size: 606 Bytes

Versions: 15

Compression:

Stored size: 606 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 if zstream.total_in.positive?
          zstream.close
        end
        chunk
      end

      private

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

Version data entries

15 entries across 15 versions & 3 rubygems

Version Path
direct7-0.0.18 vendor/bundle/ruby/2.7.0/gems/http-5.1.1/lib/http/response/inflater.rb
direct7-0.0.17 vendor/bundle/ruby/2.7.0/gems/http-5.1.1/lib/http/response/inflater.rb
direct7-0.0.16 vendor/bundle/ruby/2.7.0/gems/http-5.1.1/lib/http/response/inflater.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/http-5.2.0/lib/http/response/inflater.rb
direct7-0.0.13 vendor/bundle/ruby/2.7.0/gems/http-5.1.1/lib/http/response/inflater.rb
direct7-0.0.12 vendor/bundle/ruby/2.7.0/gems/http-5.1.1/lib/http/response/inflater.rb
http-5.2.0 lib/http/response/inflater.rb
direct7-0.0.11 vendor/bundle/ruby/2.7.0/gems/http-5.1.1/lib/http/response/inflater.rb
http-5.1.1 lib/http/response/inflater.rb
http-5.1.0 lib/http/response/inflater.rb
http-5.0.4 lib/http/response/inflater.rb
http-5.0.3 lib/http/response/inflater.rb
http-5.0.2 lib/http/response/inflater.rb
http-5.0.1 lib/http/response/inflater.rb
http-5.0.0 lib/http/response/inflater.rb