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