class Async::HTTP::Protocol::HTTP1::Server

def next_request

def next_request
	if closed?
		return nil
	elsif !idle?
		@ready.wait
	end
	
	# Read an incoming request:
	return unless request = Request.read(self)
	
	unless persistent?(request.version, request.method, request.headers)
		@persistent = false
	end
	
	return request
rescue ::Protocol::HTTP1::BadRequest => error
	fail_request(400)
	# Conceivably we could retry here, but we don't really know how bad the error is, so it's better to just fail:
	raise
end