From d3d6e0e7090ae4a45e9e616e92f3395650471436 Mon Sep 17 00:00:00 2001 From: Kahbazi Date: Sat, 8 Jun 2019 03:12:09 +0430 Subject: [PATCH] Ensure MaxConcurrentRequests is a positive number (#11003) --- .../RequestThrottling/src/RequestThrottlingMiddleware.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Middleware/RequestThrottling/src/RequestThrottlingMiddleware.cs b/src/Middleware/RequestThrottling/src/RequestThrottlingMiddleware.cs index 4aa7e9c9be..7af7e0603c 100644 --- a/src/Middleware/RequestThrottling/src/RequestThrottlingMiddleware.cs +++ b/src/Middleware/RequestThrottling/src/RequestThrottlingMiddleware.cs @@ -35,6 +35,10 @@ namespace Microsoft.AspNetCore.RequestThrottling { throw new ArgumentException("The value of 'options.MaxConcurrentRequests' must be specified.", nameof(options)); } + if (_requestThrottlingOptions.MaxConcurrentRequests < 0) + { + throw new ArgumentException("The value of 'options.MaxConcurrentRequests' must be a positive integer.", nameof(options)); + } if (_requestThrottlingOptions.RequestQueueLimit < 0) { throw new ArgumentException("The value of 'options.RequestQueueLimit' must be a positive integer.", nameof(options));