class Async::HTTP::Protocol::HTTP11::ChunkedBody

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
			@closed = true
			@protocol.read_line
			
			return
		end
		
		yield @protocol.stream.read(size)
		
		@protocol.read_line # Consume the trailing CRLF
	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