class Async::HTTP::Protocol::HTTP11::ChunkedBody
def close
def close self.each {} end
def closed?
def closed? @closed end
def each
def each return if @closed while true size = @protocol.read_line.to_i(16) if size == 0 @protocol.read_line @closed = true return end chunk = @protocol.stream.read(size) @protocol.read_line # Consume the trailing CRLF yield chunk end end
def initialize(protocol)
def initialize(protocol) @protocol = protocol @closed = false end
def read
def read buffer = Async::IO::BinaryString.new self.each do |chunk| buffer << chunk end return buffer end