class HTTPClient::Session::LenientInflater
This inflater allows deflate compression with/without zlib header
def first_inflate(body)
def first_inflate(body) @first = false begin @inflater.inflate(body) rescue Zlib::DataError # fallback to deflate without zlib header @inflater = Zlib::Inflate.new(-Zlib::MAX_WBITS) @inflater.inflate(body) end end
def inflate(body)
def inflate(body) if @first first_inflate(body) else @inflater.inflate(body) end end
def initialize
def initialize @inflater = Zlib::Inflate.new(Zlib::MAX_WBITS) @first = true end