22 writes to Limits
InMemory.FunctionalTests (12)
MaxRequestBodySizeTests.cs (11)
41new TestServiceContext(LoggerFactory) { ServerOptions = { Limits = { MaxRequestBodySize = globalMaxRequestBodySize } } })) 88new TestServiceContext(LoggerFactory) { ServerOptions = { Limits = { MaxRequestBodySize = maxRequestBodySize } } })) 135new TestServiceContext(LoggerFactory, metrics: new KestrelMetrics(testMeterFactory)) { ServerOptions = { Limits = { MaxRequestBodySize = maxRequestBodySize } } })) 184new TestServiceContext(LoggerFactory) { ServerOptions = { Limits = { MaxRequestBodySize = globalMaxRequestBodySize } } })) 228new TestServiceContext(LoggerFactory) { ServerOptions = { Limits = { MaxRequestBodySize = 0 } } })) 252new TestServiceContext { ServerOptions = { Limits = { MaxRequestBodySize = 0 } } })) 384new TestServiceContext(LoggerFactory, metrics: new KestrelMetrics(testMeterFactory)) { ServerOptions = { Limits = { MaxRequestBodySize = 0 } } })) 437new TestServiceContext(LoggerFactory) { ServerOptions = { Limits = { MaxRequestBodySize = globalMaxRequestBodySize } } })) 483new TestServiceContext(LoggerFactory) { ServerOptions = { Limits = { MaxRequestBodySize = globalMaxRequestBodySize } } })) 546new TestServiceContext(LoggerFactory) { ServerOptions = { Limits = { MaxRequestBodySize = globalMaxRequestBodySize } } })) 597new TestServiceContext(LoggerFactory) { ServerOptions = { Limits = { MaxRequestBodySize = 0 } } }))
MaxRequestLineSizeTests.cs (1)
90Limits =
Microsoft.AspNetCore.Server.Kestrel.Core.Tests (2)
KestrelServerTests.cs (2)
223Limits = 249Limits =
Sockets.FunctionalTests (8)
src\Servers\Kestrel\test\FunctionalTests\RequestTests.cs (1)
1038Limits =
src\Servers\Kestrel\test\FunctionalTests\ResponseTests.cs (7)
288Limits = 511Limits = 645Limits = 766Limits = 864Limits = 941Limits = 1028Limits =
201 references to Limits
Binding.Http.IntegrationTests (1)
MtomBindingTestHelper.cs (1)
47serverOptions.Limits.MaxRequestBodySize = 5_368_709_120;
InMemory.FunctionalTests (120)
ChunkedRequestTests.cs (2)
555testContext.ServerOptions.Limits.MaxRequestHeadersTotalSize = 602testContext.ServerOptions.Limits.MaxRequestHeaderCount = 2;
ConnectionLimitTests.cs (1)
229serviceContext.ServerOptions.Limits.MaxConcurrentConnections = max;
Http2\Http2ConnectionTests.cs (25)
655_serviceContext.ServerOptions.Limits.MinRequestBodyDataRate = null; 748_serviceContext.ServerOptions.Limits.Http2.MaxFrameSize = length; 835var initialStreamWindowSize = _serviceContext.ServerOptions.Limits.Http2.InitialStreamWindowSize; 837var initialConnectionWindowSize = _serviceContext.ServerOptions.Limits.Http2.InitialConnectionWindowSize; 937var initialStreamWindowSize = _serviceContext.ServerOptions.Limits.Http2.InitialStreamWindowSize; 939var initialConnectionWindowSize = _serviceContext.ServerOptions.Limits.Http2.InitialConnectionWindowSize; 1068var initialStreamWindowSize = _serviceContext.ServerOptions.Limits.Http2.InitialStreamWindowSize; 1069var initialConnectionWindowSize = _serviceContext.ServerOptions.Limits.Http2.InitialConnectionWindowSize; 1288var initialWindowSize = _serviceContext.ServerOptions.Limits.Http2.InitialStreamWindowSize; 1358var initialConnectionWindowSize = _serviceContext.ServerOptions.Limits.Http2.InitialConnectionWindowSize; 1398_serviceContext.ServerOptions.Limits.Http2.InitialConnectionWindowSize = 128 * 1024; 1399_serviceContext.ServerOptions.Limits.Http2.InitialStreamWindowSize = 96 * 1024; 1401var initialStreamWindowSize = _serviceContext.ServerOptions.Limits.Http2.InitialStreamWindowSize; 1403var initialConnectionWindowSize = _serviceContext.ServerOptions.Limits.Http2.InitialConnectionWindowSize; 1649_serviceContext.ServerOptions.Limits.Http2.MaxStreamsPerConnection = 1; 1684_serviceContext.ServerOptions.Limits.Http2.MaxStreamsPerConnection = 1; 1697_serviceContext.ServerOptions.Limits.Http2.MaxStreamsPerConnection = 100; 1710_serviceContext.ServerOptions.Limits.Http2.MaxStreamsPerConnection = int.MaxValue; 1723_serviceContext.ServerOptions.Limits.Http2.MaxStreamsPerConnection = 1; 1802_serviceContext.ServerOptions.Limits.Http2.MaxStreamsPerConnection = maxStreamsPerConnection; 1863var initialWindowSize = _serviceContext.ServerOptions.Limits.Http2.InitialStreamWindowSize; 1887var initialWindowSize = _serviceContext.ServerOptions.Limits.Http2.InitialConnectionWindowSize; 2425_serviceContext.ServerOptions.Limits.Http2.HeaderTableSize = 0; 3539var initialConnectionWindowSize = _serviceContext.ServerOptions.Limits.Http2.InitialConnectionWindowSize; 4161_serviceContext.ServerOptions.Limits.Http2.HeaderTableSize = 40000;
Http2\Http2KeepAliveTests.cs (17)
14_serviceContext.ServerOptions.Limits.Http2.KeepAlivePingDelay = Timeout.InfiniteTimeSpan; 27_serviceContext.ServerOptions.Limits.Http2.KeepAlivePingDelay = TimeSpan.FromSeconds(1); 28_serviceContext.ServerOptions.Limits.Http2.KeepAlivePingTimeout = Timeout.InfiniteTimeSpan; 57_serviceContext.ServerOptions.Limits.Http2.KeepAlivePingDelay = TimeSpan.FromSeconds(1); 79_serviceContext.ServerOptions.Limits.Http2.KeepAlivePingDelay = TimeSpan.FromSeconds(1); 102_serviceContext.ServerOptions.Limits.Http2.KeepAlivePingDelay = TimeSpan.FromSeconds(5); 119_serviceContext.ServerOptions.Limits.Http2.KeepAlivePingDelay = TimeSpan.FromSeconds(1); 142_serviceContext.ServerOptions.Limits.Http2.KeepAlivePingDelay = TimeSpan.FromSeconds(1); 180_serviceContext.ServerOptions.Limits.Http2.KeepAlivePingDelay = TimeSpan.FromSeconds(1); 181_serviceContext.ServerOptions.Limits.Http2.KeepAlivePingTimeout = TimeSpan.FromSeconds(3); 212_serviceContext.ServerOptions.Limits.Http2.KeepAlivePingDelay = TimeSpan.FromSeconds(1); 213_serviceContext.ServerOptions.Limits.Http2.KeepAlivePingTimeout = TimeSpan.FromSeconds(3); 244_serviceContext.ServerOptions.Limits.Http2.KeepAlivePingDelay = TimeSpan.FromSeconds(1); 268_serviceContext.ServerOptions.Limits.Http2.KeepAlivePingDelay = TimeSpan.FromSeconds(1); 271_serviceContext.ServerOptions.Limits.Http2.InitialConnectionWindowSize = 65535; 322_serviceContext.ServerOptions.Limits.Http2.KeepAlivePingDelay = TimeSpan.FromSeconds(1); 325_serviceContext.ServerOptions.Limits.Http2.InitialConnectionWindowSize = 65535;
Http2\Http2StreamTests.cs (7)
1856_serviceContext.ServerOptions.Limits.MaxRequestBodySize = 15; 1897_serviceContext.ServerOptions.Limits.MaxRequestBodySize = 10; 1943_serviceContext.ServerOptions.Limits.MaxRequestBodySize = 15; 1983_serviceContext.ServerOptions.Limits.MaxRequestBodySize = 10; 2035_serviceContext.ServerOptions.Limits.MaxRequestBodySize = 20; 2095_serviceContext.ServerOptions.Limits.MaxRequestBodySize = 10; 3651_serviceContext.ServerOptions.Limits.Http2.MaxFrameSize = 17001;
Http2\Http2TestBase.cs (3)
1411pauseWriterThreshold: serviceContext.ServerOptions.Limits.MaxRequestBufferSize ?? 0, 1412resumeWriterThreshold: serviceContext.ServerOptions.Limits.MaxRequestBufferSize ?? 0, 1430var bufferSize = serviceContext.ServerOptions.Limits.MaxResponseBufferSize;
Http2\Http2TimeoutTests.cs (21)
19var limits = _serviceContext.ServerOptions.Limits; 41var limits = _serviceContext.ServerOptions.Limits; 61var limits = _serviceContext.ServerOptions.Limits; 110var limits = _serviceContext.ServerOptions.Limits; 133var limits = _serviceContext.ServerOptions.Limits; 174var limits = _serviceContext.ServerOptions.Limits; 209var limits = _serviceContext.ServerOptions.Limits; 350var limits = _serviceContext.ServerOptions.Limits; 403var limits = _serviceContext.ServerOptions.Limits; 458var limits = _serviceContext.ServerOptions.Limits; 510var limits = _serviceContext.ServerOptions.Limits; 564var limits = _serviceContext.ServerOptions.Limits; 630var limits = _serviceContext.ServerOptions.Limits; 677var limits = _serviceContext.ServerOptions.Limits; 728var limits = _serviceContext.ServerOptions.Limits; 795var limits = _serviceContext.ServerOptions.Limits; 863var limits = _serviceContext.ServerOptions.Limits; 915var initialConnectionWindowSize = _serviceContext.ServerOptions.Limits.Http2.InitialConnectionWindowSize; 920var limits = _serviceContext.ServerOptions.Limits; 1006var limits = _serviceContext.ServerOptions.Limits; 1089var limits = _serviceContext.ServerOptions.Limits;
Http2\Http2WebSocketTests.cs (3)
325var limits = _serviceContext.ServerOptions.Limits; 387var limits = _serviceContext.ServerOptions.Limits; 403Assert.Equal(_serviceContext.ServerOptions.Limits.MaxRequestBodySize + 1, memoryStream.Length);
Http3\Http3StreamTests.cs (10)
2378var limit = _serviceContext.ServerOptions.Limits.Http3.MaxRequestHeaderFieldSize; 2514_serviceContext.ServerOptions.Limits.MaxRequestBodySize = 15; 2548_serviceContext.ServerOptions.Limits.MaxRequestBodySize = 10; 2588_serviceContext.ServerOptions.Limits.MaxRequestBodySize = 15; 2621_serviceContext.ServerOptions.Limits.MaxRequestBodySize = 10; 2665_serviceContext.ServerOptions.Limits.MaxRequestBodySize = 20; 2717_serviceContext.ServerOptions.Limits.MaxRequestBodySize = 10; 3073_serviceContext.ServerOptions.Limits.MaxRequestBufferSize = 100; 3138_serviceContext.ServerOptions.Limits.MaxRequestBufferSize = 1; 3222_serviceContext.ServerOptions.Limits.MaxRequestBufferSize = 1;
Http3\Http3TimeoutTests.cs (20)
21var limits = _serviceContext.ServerOptions.Limits; 37var limits = _serviceContext.ServerOptions.Limits; 61var limits = _serviceContext.ServerOptions.Limits; 90var limits = _serviceContext.ServerOptions.Limits; 131var limits = _serviceContext.ServerOptions.Limits; 165var limits = _serviceContext.ServerOptions.Limits; 219var limits = _serviceContext.ServerOptions.Limits; 247var limits = _serviceContext.ServerOptions.Limits; 283var limits = _serviceContext.ServerOptions.Limits; 308var limits = _serviceContext.ServerOptions.Limits; 338var limits = _serviceContext.ServerOptions.Limits; 380var limits = _serviceContext.ServerOptions.Limits; 448var limits = _serviceContext.ServerOptions.Limits; 490var limits = _serviceContext.ServerOptions.Limits; 532var limits = _serviceContext.ServerOptions.Limits; 578var limits = _serviceContext.ServerOptions.Limits; 633var limits = _serviceContext.ServerOptions.Limits; 689var limits = _serviceContext.ServerOptions.Limits; 746var limits = _serviceContext.ServerOptions.Limits; 830Http3Api.TriggerTick(_serviceContext.ServerOptions.Limits.RequestHeadersTimeout + TimeSpan.FromTicks(1));
KeepAliveTimeoutTests.cs (2)
252context.ServerOptions.Limits.KeepAliveTimeout = _keepAliveTimeout; 253context.ServerOptions.Limits.MinRequestBodyDataRate = null;
RequestHeaderLimitsTests.cs (2)
167options.Limits.MaxRequestHeaderCount = maxRequestHeaderCount.Value; 172options.Limits.MaxRequestHeadersTotalSize = maxRequestHeadersTotalSize.Value;
RequestHeadersTimeoutTests.cs (3)
126testContext.ServerOptions.Limits.MinResponseDataRate = null; 155context.ServerOptions.Limits.RequestHeadersTimeout = RequestHeadersTimeout; 156context.ServerOptions.Limits.MinRequestBodyDataRate = null;
RequestTests.cs (1)
888testContext.ServerOptions.Limits.MinRequestBodyDataRate = null;
src\Servers\Kestrel\shared\test\Http3\Http3InMemory.cs (3)
381pauseWriterThreshold: serviceContext.ServerOptions.Limits.MaxRequestBufferSize ?? 0, 382resumeWriterThreshold: serviceContext.ServerOptions.Limits.MaxRequestBufferSize ?? 0, 400var bufferSize = serviceContext.ServerOptions.Limits.MaxResponseBufferSize;
Interop.FunctionalTests (5)
Http3\Http3RequestTests.cs (1)
2173kestrel.Limits.MinRequestBodyDataRate = null;
HttpClientHttp2InteropTests.cs (4)
1139options.Limits.Http2.HeaderTableSize = 1; 1199options.Limits.Http2.MaxStreamsPerConnection = 5; 1260options.Limits.Http2.MaxStreamsPerConnection = 5; 1318webHostBuilder.ConfigureKestrel(options => options.Limits.Http2.MaxFrameSize = 1024 * 20); // The default is 16kb
InteropWebsite (1)
Program.cs (1)
50options.Limits.MinRequestBodyDataRate = null;
Microsoft.AspNetCore.Server.Kestrel.Core (48)
Internal\Http\Http1Connection.cs (9)
116TimeoutControl.StartDrainTimeout(MinResponseDataRate, ServerOptions.Limits.MaxResponseBufferSize); 194if (reader.Remaining >= ServerOptions.Limits.MaxRequestLineSize) 204var trimmedBuffer = reader.Sequence.Slice(reader.Position, ServerOptions.Limits.MaxRequestLineSize); 289TimeoutControl.ResetTimeout(ServerOptions.Limits.RequestHeadersTimeout, TimeoutReason.RequestHeaders); 325if (reader.Remaining >= ServerOptions.Limits.MaxRequestLineSize) 334var trimmedBuffer = reader.Sequence.Slice(reader.Position, ServerOptions.Limits.MaxRequestLineSize); 818_remainingRequestHeadersBytesAllowed = (long)ServerOptions.Limits.MaxRequestHeadersTotalSize + 2; 820MinResponseDataRate = ServerOptions.Limits.MinResponseDataRate; 843TimeoutControl.SetTimeout(ServerOptions.Limits.KeepAliveTimeout, TimeoutReason.KeepAlive);
Internal\Http\HttpProtocol.cs (3)
374MaxRequestBodySize = ServerOptions.Limits.MaxRequestBodySize; 375MinRequestBodyDataRate = ServerOptions.Limits.MinRequestBodyDataRate; 445_eagerRequestHeadersParsedLimit = ServerOptions.Limits.MaxRequestHeaderCount;
Internal\Http2\Http2Connection.cs (4)
154var httpLimits = context.ServiceContext.ServerOptions.Limits; 215public KestrelServerLimits Limits => _context.ServiceContext.ServerOptions.Limits; 310var connectionWindow = _context.ServiceContext.ServerOptions.Limits.Http2.InitialConnectionWindowSize; 1611if (_totalParsedHeaderSize > _context.ServiceContext.ServerOptions.Limits.MaxRequestHeadersTotalSize * 2)
Internal\Http2\Http2Stream.cs (4)
60_eagerRequestHeadersParsedLimit = ServerOptions.Limits.MaxRequestHeaderCount * 2; 220if (TotalParsedHeaderSize > ServerOptions.Limits.MaxRequestHeadersTotalSize) 226if (RequestHeadersParsed > ServerOptions.Limits.MaxRequestHeaderCount) 333if (requestLineLength > ServerOptions.Limits.MaxRequestLineSize)
Internal\Http3\Http3Connection.cs (4)
62var httpLimits = context.ServiceContext.ServerOptions.Limits; 96public KestrelServerLimits Limits => _context.ServiceContext.ServerOptions.Limits; 259var requestHeadersTimeout = serviceContext.ServerOptions.Limits.RequestHeadersTimeout.ToTicks( 307var minDataRate = _context.ServiceContext.ServerOptions.Limits.MinResponseDataRate;
Internal\Http3\Http3ControlStream.cs (1)
50var httpLimits = context.ServiceContext.ServerOptions.Limits;
Internal\Http3\Http3Stream.cs (8)
87public KestrelServerLimits Limits => _context.ServiceContext.ServerOptions.Limits; 116_eagerRequestHeadersParsedLimit = ServerOptions.Limits.MaxRequestHeaderCount * 2; 127context.ServiceContext.ServerOptions.Limits.MinResponseDataRate, 141QPackDecoder = new QPackDecoder(_context.ServiceContext.ServerOptions.Limits.Http3.MaxRequestHeaderFieldSize); 304if (_totalParsedHeaderSize > ServerOptions.Limits.MaxRequestHeadersTotalSize * 2) 1012if (_totalParsedHeaderSize > ServerOptions.Limits.MaxRequestHeadersTotalSize) 1018if (RequestHeadersParsed > ServerOptions.Limits.MaxRequestHeaderCount) 1101if (requestLineLength > ServerOptions.Limits.MaxRequestLineSize)
Internal\KestrelServerImpl.cs (13)
87serverOptions.Limits.MaxConcurrentUpgradedConnections); 201connectionDelegate = EnforceConnectionLimit(connectionDelegate, Options.Limits.MaxConcurrentConnections, Trace, ServiceContext.Metrics); 220multiplexedConnectionDelegate = EnforceConnectionLimit(multiplexedConnectionDelegate, Options.Limits.MaxConcurrentConnections, Trace, ServiceContext.Metrics); 417if (Options.Limits.MaxRequestBufferSize.HasValue && 418Options.Limits.MaxRequestBufferSize < Options.Limits.MaxRequestLineSize) 421CoreStrings.FormatMaxRequestBufferSmallerThanRequestLineBuffer(Options.Limits.MaxRequestBufferSize.Value, Options.Limits.MaxRequestLineSize)); 424if (Options.Limits.MaxRequestBufferSize.HasValue && 425Options.Limits.MaxRequestBufferSize < Options.Limits.MaxRequestHeadersTotalSize) 428CoreStrings.FormatMaxRequestBufferSmallerThanRequestHeaderBuffer(Options.Limits.MaxRequestBufferSize.Value, Options.Limits.MaxRequestHeadersTotalSize));
KestrelServerOptions.cs (2)
358writer.WritePropertyName(nameof(Limits)); 360Limits.Serialize(writer);
Microsoft.AspNetCore.Server.Kestrel.Core.Tests (12)
Http1\Http1ConnectionTests.cs (12)
66_serviceContext.ServerOptions.Limits.MaxRequestHeadersTotalSize = int.MaxValue; 77_serviceContext.ServerOptions.Limits.MaxRequestHeadersTotalSize = headerLine.Length - 1; 94_serviceContext.ServerOptions.Limits.MaxRequestHeaderCount = 1; 117_serviceContext.ServerOptions.Limits.MaxRequestHeadersTotalSize = headerLine.Length; 173Assert.Same(_serviceContext.ServerOptions.Limits.MinRequestBodyDataRate, _http1Connection.MinRequestBodyDataRate); 183Assert.Same(_serviceContext.ServerOptions.Limits.MinResponseDataRate, _http1Connection.MinResponseDataRate); 272options.Limits.MaxRequestHeadersTotalSize = headerLine1.Length; 273options.Limits.MaxRequestHeaderCount = 1; 477_serviceContext.ServerOptions.Limits.MaxRequestLineSize = "GET / HTTP/1.1\r\n".Length; 593var expectedKeepAliveTimeout = _serviceContext.ServerOptions.Limits.KeepAliveTimeout; 888_serviceContext.ServerOptions.Limits.MaxRequestHeaderCount = header0Count + header1Count; 920_serviceContext.ServerOptions.Limits.MaxRequestHeaderCount = header0Count + header1Count;
Microsoft.AspNetCore.Server.Kestrel.Microbenchmarks (3)
src\Servers\Kestrel\shared\test\Http3\Http3InMemory.cs (3)
381pauseWriterThreshold: serviceContext.ServerOptions.Limits.MaxRequestBufferSize ?? 0, 382resumeWriterThreshold: serviceContext.ServerOptions.Limits.MaxRequestBufferSize ?? 0, 400var bufferSize = serviceContext.ServerOptions.Limits.MaxResponseBufferSize;
Sockets.BindTests (1)
src\Servers\Kestrel\shared\test\TransportTestHelpers\TestServer.cs (1)
70_host = TransportSelector.GetHostBuilder(context.ServerOptions.Limits.MaxRequestBufferSize)
Sockets.FunctionalTests (10)
src\Servers\Kestrel\shared\test\TransportTestHelpers\TestServer.cs (1)
70_host = TransportSelector.GetHostBuilder(context.ServerOptions.Limits.MaxRequestBufferSize)
src\Servers\Kestrel\test\FunctionalTests\MaxRequestBufferSizeTests.cs (7)
319options.Limits.MaxRequestBufferSize = maxRequestBufferSize; 322maxRequestBufferSize.Value < options.Limits.MaxRequestLineSize) 324options.Limits.MaxRequestLineSize = (int)maxRequestBufferSize; 328maxRequestBufferSize.Value < options.Limits.MaxRequestHeadersTotalSize) 330options.Limits.MaxRequestHeadersTotalSize = (int)maxRequestBufferSize; 333options.Limits.MinRequestBodyDataRate = null; 335options.Limits.MaxRequestBodySize = _dataLength;
src\Servers\Kestrel\test\FunctionalTests\RequestTests.cs (2)
80options.Limits.MaxRequestBodySize = contentLength; 81options.Limits.MinRequestBodyDataRate = null;