class Async::HTTP::Protocol::HTTP11

def write_body(body, chunked = true)

def write_body(body, chunked = true)
	if chunked
		@stream.write("Transfer-Encoding: chunked\r\n\r\n")
		
		body.each do |chunk|
			next if chunk.size == 0
			
			@stream.write("#{chunk.bytesize.to_s(16).upcase}\r\n")
			@stream.write(chunk)
			@stream.write(CRLF)
			@stream.flush
		end
		
		@stream.write("0\r\n\r\n")
	else
		buffer = String.new
		body.each{|chunk| buffer << chunk}
		
		@stream.write("Content-Length: #{buffer.bytesize}\r\n\r\n")
		@stream.write(buffer)
	end
end