11 implementations of IHttpMaxRequestBodySizeFeature
BasicWebSite (1)
StartupRequestLimitSize.cs (1)
128private class TestHttpMaxRequestBodySizeFeature : IHttpMaxRequestBodySizeFeature
Microsoft.AspNetCore.Mvc.Core.Test (2)
Filters\DisableRequestSizeLimitFilterTest.cs (1)
125private class TestHttpMaxRequestBodySizeFeature : IHttpMaxRequestBodySizeFeature
Filters\RequestSizeLimitFilterTest.cs (1)
131private class TestHttpMaxRequestBodySizeFeature : IHttpMaxRequestBodySizeFeature
Microsoft.AspNetCore.Mvc.FunctionalTests (1)
AntiforgeryMiddlewareTest.cs (1)
253public class FakeHttpMaxRequestBodySizeFeature : IHttpMaxRequestBodySizeFeature
Microsoft.AspNetCore.RequestDecompression.Microbenchmarks (1)
RequestDecompressionMiddlewareBenchmark.cs (1)
64private sealed class MaxRequestBodySizeFeature : IHttpMaxRequestBodySizeFeature
Microsoft.AspNetCore.RequestDecompression.Tests (1)
RequestDecompressionMiddlewareTests.cs (1)
775private class FakeHttpMaxRequestBodySizeFeature : IHttpMaxRequestBodySizeFeature
Microsoft.AspNetCore.Routing.FunctionalTests (1)
MinimalFormTests.cs (1)
777private class FakeHttpMaxRequestBodySizeFeature : IHttpMaxRequestBodySizeFeature
Microsoft.AspNetCore.Routing.Tests (1)
EndpointRoutingMiddlewareTest.cs (1)
433private class FakeHttpMaxRequestBodySizeFeature : IHttpMaxRequestBodySizeFeature
Microsoft.AspNetCore.Server.HttpSys (1)
RequestProcessing\RequestContext.FeatureCollection.cs (1)
32IHttpMaxRequestBodySizeFeature,
Microsoft.AspNetCore.Server.IIS (1)
Core\IISHttpContext.FeatureCollection.cs (1)
36IHttpMaxRequestBodySizeFeature,
Microsoft.AspNetCore.Server.Kestrel.Core (1)
Internal\Http\HttpProtocol.Generated.cs (1)
35IHttpMaxRequestBodySizeFeature,
143 references to IHttpMaxRequestBodySizeFeature
BasicWebSite (3)
StartupRequestLimitSize.cs (3)
24httpContext.Features.Set<IHttpMaxRequestBodySizeFeature>( 45private readonly IHttpMaxRequestBodySizeFeature _maxRequestBodySizeFeature; 50IHttpMaxRequestBodySizeFeature maxRequestBodySizeFeature)
Binding.Http.IntegrationTests (1)
MtomBindingTestHelper.cs (1)
54context.Features.Get<IHttpMaxRequestBodySizeFeature>().MaxRequestBodySize = 5_368_709_120;
IIS.Tests (8)
MaxRequestBodySizeTests.cs (8)
74var feature = ctx.Features.Get<IHttpMaxRequestBodySizeFeature>(); 110var feature = ctx.Features.Get<IHttpMaxRequestBodySizeFeature>(); 137var feature = ctx.Features.Get<IHttpMaxRequestBodySizeFeature>(); 248var feature = ctx.Features.Get<IHttpMaxRequestBodySizeFeature>();
InMemory.FunctionalTests (24)
Http2\Http2StreamTests.cs (6)
2051Assert.False(context.Features.Get<IHttpMaxRequestBodySizeFeature>().IsReadOnly); 2052context.Features.Get<IHttpMaxRequestBodySizeFeature>().MaxRequestBodySize = 17; 2060Assert.True(context.Features.Get<IHttpMaxRequestBodySizeFeature>().IsReadOnly); 2111Assert.False(context.Features.Get<IHttpMaxRequestBodySizeFeature>().IsReadOnly); 2112context.Features.Get<IHttpMaxRequestBodySizeFeature>().MaxRequestBodySize = 12; 2116Assert.True(context.Features.Get<IHttpMaxRequestBodySizeFeature>().IsReadOnly);
Http2\Http2WebSocketTests.cs (2)
396var maxRequestBodySizeFeature = context.Features.Get<IHttpMaxRequestBodySizeFeature>();
Http3\Http3StreamTests.cs (6)
2664Assert.False(context.Features.Get<IHttpMaxRequestBodySizeFeature>().IsReadOnly); 2665context.Features.Get<IHttpMaxRequestBodySizeFeature>().MaxRequestBodySize = 17; 2673Assert.True(context.Features.Get<IHttpMaxRequestBodySizeFeature>().IsReadOnly); 2716Assert.False(context.Features.Get<IHttpMaxRequestBodySizeFeature>().IsReadOnly); 2717context.Features.Get<IHttpMaxRequestBodySizeFeature>().MaxRequestBodySize = 12; 2721Assert.True(context.Features.Get<IHttpMaxRequestBodySizeFeature>().IsReadOnly);
MaxRequestBodySizeTests.cs (10)
171var feature = context.Features.Get<IHttpMaxRequestBodySizeFeature>(); 213var feature = context.Features.Get<IHttpMaxRequestBodySizeFeature>(); 293var feature = context.Features.Get<IHttpMaxRequestBodySizeFeature>(); 333var feature = context.Features.Get<IHttpMaxRequestBodySizeFeature>(); 515var feature = context.Features.Get<IHttpMaxRequestBodySizeFeature>();
InProcessWebSite (2)
src\Servers\IIS\IIS\test\testassets\InProcessWebSite\Startup.cs (1)
1074public Task BodyLimit(HttpContext ctx) => ctx.Response.WriteAsync(ctx.Features.Get<IHttpMaxRequestBodySizeFeature>()?.MaxRequestBodySize?.ToString(CultureInfo.InvariantCulture) ?? "null");
src\Servers\IIS\IIS\test\testassets\InProcessWebSite\Startup.WebSockets.cs (1)
156Assert.Null(context.Features.Get<IHttpMaxRequestBodySizeFeature>().MaxRequestBodySize);
Kestrel.SampleApp (1)
Startup.cs (1)
37context.Features.Get<IHttpMaxRequestBodySizeFeature>().MaxRequestBodySize = 1024;
Microsoft.AspNetCore.Mvc.Core (10)
Filters\DisableRequestSizeLimitFilter.cs (5)
10/// A filter that sets <see cref="IHttpMaxRequestBodySizeFeature.MaxRequestBodySize"/> 26/// Sets the <see cref="IHttpMaxRequestBodySizeFeature.MaxRequestBodySize"/> 30/// <remarks>If <see cref="IHttpMaxRequestBodySizeFeature"/> is not enabled or is read-only, 43var maxRequestBodySizeFeature = context.HttpContext.Features.Get<IHttpMaxRequestBodySizeFeature>();
Filters\RequestSizeLimitFilter.cs (5)
11/// A filter that sets the <see cref="IHttpMaxRequestBodySizeFeature.MaxRequestBodySize"/> 29/// Sets the <see cref="IHttpMaxRequestBodySizeFeature.MaxRequestBodySize"/> to <see cref="Bytes"/>. 32/// <remarks>If <see cref="IHttpMaxRequestBodySizeFeature"/> is not enabled or is read-only, 45var maxRequestBodySizeFeature = context.HttpContext.Features.Get<IHttpMaxRequestBodySizeFeature>();
Microsoft.AspNetCore.Mvc.Core.Test (8)
Filters\DisableRequestSizeLimitFilterTest.cs (4)
23authorizationFilterContext.HttpContext.Features.Set<IHttpMaxRequestBodySizeFeature>(httpMaxRequestBodySize); 42authorizationFilterContext.HttpContext.Features.Set<IHttpMaxRequestBodySizeFeature>(httpMaxRequestBodySize); 84authorizationFilterContext.HttpContext.Features.Set<IHttpMaxRequestBodySizeFeature>(httpMaxRequestBodySize); 105authorizationFilterContext.HttpContext.Features.Set<IHttpMaxRequestBodySizeFeature>(httpMaxRequestBodySize);
Filters\RequestSizeLimitFilterTest.cs (4)
24authorizationFilterContext.HttpContext.Features.Set<IHttpMaxRequestBodySizeFeature>(httpMaxRequestBodySize); 45authorizationFilterContext.HttpContext.Features.Set<IHttpMaxRequestBodySizeFeature>(httpMaxRequestBodySize); 89authorizationFilterContext.HttpContext.Features.Set<IHttpMaxRequestBodySizeFeature>(httpMaxRequestBodySize); 111authorizationFilterContext.HttpContext.Features.Set<IHttpMaxRequestBodySizeFeature>(httpMaxRequestBodySize);
Microsoft.AspNetCore.Mvc.FunctionalTests (2)
AntiforgeryMiddlewareTest.cs (2)
105context.Features.Set<IHttpMaxRequestBodySizeFeature>(new FakeHttpMaxRequestBodySizeFeature(5_000_000)); 111context.Request.Body = new SizeLimitedStream(context.Request.Body, context.Features.Get<IHttpMaxRequestBodySizeFeature>()?.MaxRequestBodySize);
Microsoft.AspNetCore.RequestDecompression (1)
RequestDecompressionMiddleware.cs (1)
63?? context.Features.Get<IHttpMaxRequestBodySizeFeature>()?.MaxRequestBodySize;
Microsoft.AspNetCore.RequestDecompression.Microbenchmarks (1)
RequestDecompressionMiddlewareBenchmark.cs (1)
58features.Set<IHttpMaxRequestBodySizeFeature>(new MaxRequestBodySizeFeature());
Microsoft.AspNetCore.RequestDecompression.Tests (6)
RequestDecompressionMiddlewareTests.cs (6)
219context.Features.Set<IHttpMaxRequestBodySizeFeature>( 289context.Features.Set<IHttpMaxRequestBodySizeFeature>( 365context.Features.Set<IHttpMaxRequestBodySizeFeature>( 462context.Features.Set<IHttpMaxRequestBodySizeFeature>( 546context.Features.Set<IHttpMaxRequestBodySizeFeature>( 704context.Features.Set<IHttpMaxRequestBodySizeFeature>(
Microsoft.AspNetCore.Routing (4)
EndpointRoutingMiddleware.cs (4)
311var maxRequestBodySizeFeature = context.Features.Get<IHttpMaxRequestBodySizeFeature>(); 369[LoggerMessage(9, LogLevel.Warning, $"A request body size limit could not be applied. This server does not support the {nameof(IHttpMaxRequestBodySizeFeature)}.", EventName = "RequestSizeFeatureNotFound")] 372[LoggerMessage(10, LogLevel.Warning, $"A request body size limit could not be applied. The {nameof(IHttpMaxRequestBodySizeFeature)} for the server is read-only.", EventName = "RequestSizeFeatureIsReadOnly")]
Microsoft.AspNetCore.Routing.FunctionalTests (2)
MinimalFormTests.cs (2)
445context.Features.Set<IHttpMaxRequestBodySizeFeature>(new FakeHttpMaxRequestBodySizeFeature(5_000_000)); 451context.Request.Body = new SizeLimitedStream(context.Request.Body, context.Features.Get<IHttpMaxRequestBodySizeFeature>()?.MaxRequestBodySize);
Microsoft.AspNetCore.Routing.Tests (5)
EndpointRoutingMiddlewareTest.cs (5)
279httpContext.Features.Set<IHttpMaxRequestBodySizeFeature>(maxRequestBodySizeFeature); 294Assert.Equal($"A request body size limit could not be applied. The {nameof(IHttpMaxRequestBodySizeFeature)} for the server is read-only.", write.Message); 323Assert.Equal($"A request body size limit could not be applied. This server does not support the {nameof(IHttpMaxRequestBodySizeFeature)}.", write.Message); 337httpContext.Features.Set<IHttpMaxRequestBodySizeFeature>(maxRequestBodySizeFeature); 367httpContext.Features.Set<IHttpMaxRequestBodySizeFeature>(maxRequestBodySizeFeature);
Microsoft.AspNetCore.Server.HttpSys (4)
HttpSysOptions.cs (1)
174/// This can be overridden per-request via <see cref="IHttpMaxRequestBodySizeFeature"/>.
RequestProcessing\RequestContext.FeatureCollection.cs (2)
585bool IHttpMaxRequestBodySizeFeature.IsReadOnly => Request.HasRequestBodyStarted; 587long? IHttpMaxRequestBodySizeFeature.MaxRequestBodySize
StandardFeatureCollection.cs (1)
26{ typeof(IHttpMaxRequestBodySizeFeature), _identityFunc },
Microsoft.AspNetCore.Server.HttpSys.FunctionalTests (34)
OpaqueUpgradeTests.cs (2)
134var feature = httpContext.Features.Get<IHttpMaxRequestBodySizeFeature>();
RequestBodyLimitTests.cs (32)
26var feature = httpContext.Features.Get<IHttpMaxRequestBodySizeFeature>(); 48var feature = httpContext.Features.Get<IHttpMaxRequestBodySizeFeature>(); 70var feature = httpContext.Features.Get<IHttpMaxRequestBodySizeFeature>(); 93var feature = httpContext.Features.Get<IHttpMaxRequestBodySizeFeature>(); 115var feature = httpContext.Features.Get<IHttpMaxRequestBodySizeFeature>(); 137var feature = httpContext.Features.Get<IHttpMaxRequestBodySizeFeature>(); 160var feature = httpContext.Features.Get<IHttpMaxRequestBodySizeFeature>(); 185var feature = httpContext.Features.Get<IHttpMaxRequestBodySizeFeature>(); 210var feature = httpContext.Features.Get<IHttpMaxRequestBodySizeFeature>(); 236var feature = httpContext.Features.Get<IHttpMaxRequestBodySizeFeature>(); 261var feature = httpContext.Features.Get<IHttpMaxRequestBodySizeFeature>(); 285var feature = httpContext.Features.Get<IHttpMaxRequestBodySizeFeature>(); 313var feature = httpContext.Features.Get<IHttpMaxRequestBodySizeFeature>(); 339var feature = httpContext.Features.Get<IHttpMaxRequestBodySizeFeature>(); 363var feature = httpContext.Features.Get<IHttpMaxRequestBodySizeFeature>(); 387var feature = httpContext.Features.Get<IHttpMaxRequestBodySizeFeature>();
Microsoft.AspNetCore.Server.IIS (4)
Core\IISHttpContext.FeatureCollection.cs (2)
437bool IHttpMaxRequestBodySizeFeature.IsReadOnly => HasStartedConsumingRequestBody || _wasUpgraded; 439long? IHttpMaxRequestBodySizeFeature.MaxRequestBodySize
Core\IISHttpContext.Features.cs (1)
29private static readonly Type IHttpMaxRequestBodySizeFeature = typeof(global::Microsoft.AspNetCore.Http.Features.IHttpMaxRequestBodySizeFeature);
IISServerOptions.cs (1)
62/// This can be overridden per-request via <see cref="IHttpMaxRequestBodySizeFeature"/>.
Microsoft.AspNetCore.Server.IISIntegration (2)
IISMiddleware.cs (2)
128var bodySizeFeature = httpContext.Features.Get<IHttpMaxRequestBodySizeFeature>();
Microsoft.AspNetCore.Server.Kestrel.Core (12)
Internal\Http\HttpProtocol.FeatureCollection.cs (2)
198bool IHttpMaxRequestBodySizeFeature.IsReadOnly => HasStartedConsumingRequestBody || IsUpgraded || IsExtendedConnectRequest; 200long? IHttpMaxRequestBodySizeFeature.MaxRequestBodySize
Internal\Http\HttpProtocol.Generated.cs (9)
54internal protected IHttpMaxRequestBodySizeFeature? _currentIHttpMaxRequestBodySizeFeature; 304else if (key == typeof(IHttpMaxRequestBodySizeFeature)) 456else if (key == typeof(IHttpMaxRequestBodySizeFeature)) 458_currentIHttpMaxRequestBodySizeFeature = (IHttpMaxRequestBodySizeFeature?)value; 610else if (typeof(TFeature) == typeof(IHttpMaxRequestBodySizeFeature)) 612feature = Unsafe.As<IHttpMaxRequestBodySizeFeature?, TFeature?>(ref _currentIHttpMaxRequestBodySizeFeature); 770else if (typeof(TFeature) == typeof(IHttpMaxRequestBodySizeFeature)) 772_currentIHttpMaxRequestBodySizeFeature = Unsafe.As<TFeature?, IHttpMaxRequestBodySizeFeature?>(ref feature); 920yield return new KeyValuePair<Type, object>(typeof(IHttpMaxRequestBodySizeFeature), _currentIHttpMaxRequestBodySizeFeature);
KestrelServerLimits.cs (1)
152/// This can be overridden per-request via <see cref="IHttpMaxRequestBodySizeFeature"/>.
Microsoft.AspNetCore.Server.Kestrel.Core.Tests (7)
Http1\Http1ConnectionTests.cs (3)
939Assert.True(((IHttpMaxRequestBodySizeFeature)_http1Connection).IsReadOnly); 940var ex = Assert.Throws<InvalidOperationException>(() => ((IHttpMaxRequestBodySizeFeature)_http1Connection).MaxRequestBodySize = 1); 948var ex = Assert.Throws<ArgumentOutOfRangeException>(() => ((IHttpMaxRequestBodySizeFeature)_http1Connection).MaxRequestBodySize = -1);
Http1\Http1HttpProtocolFeatureCollectionTests.cs (4)
113_collection[typeof(IHttpMaxRequestBodySizeFeature)] = CreateHttp1Connection(); 143_collection.Set<IHttpMaxRequestBodySizeFeature>(CreateHttp1Connection()); 190Assert.Same(_collection.Get<IHttpMaxRequestBodySizeFeature>(), _collection[typeof(IHttpMaxRequestBodySizeFeature)]);
Microsoft.AspNetCore.Server.Kestrel.Microbenchmarks (2)
HttpProtocolFeatureCollection.cs (2)
180public IHttpMaxRequestBodySizeFeature Get_IHttpMaxRequestBodySizeFeature() 182return _collection.Get<IHttpMaxRequestBodySizeFeature>();