class Async::HTTP::Protocol::HTTP11

def receive_requests(task: Task.current)

Server loop.
def receive_requests(task: Task.current)
	while true
		request = Request.new(*read_request)
		
		status, headers, body = yield request
		
		write_response(request.version, status, headers, body)
		
		request.close
		
		unless keep_alive?(request.headers) and keep_alive?(headers)
			@keep_alive = false
			
			break
		end
		
		# This ensures we yield at least once every iteration of the loop and allow other fibers to execute.
		task.yield
	end
end