class Protocol::HTTP::Body::Stream

def read_nonblock(length, buffer = nil)

def read_nonblock(length, buffer = nil)
	@buffer ||= read_next
	chunk = nil
	
	if @buffer.bytesize > length
		chunk = @buffer.byteslice(0, length)
		@buffer = @buffer.byteslice(length, @buffer.bytesize)
	else
		chunk = @buffer
		@buffer = nil
	end
	
	if buffer
		buffer.replace(chunk)
	else
		buffer = chunk
	end
	
	return buffer
end