Clear MaxRequestBodySize
This commit is contained in:
parent
27e157fc37
commit
c3ffde286b
|
|
@ -76,6 +76,13 @@ namespace Microsoft.AspNetCore.Server.IISIntegration
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var bodySizeFeature = httpContext.Features.Get<IHttpMaxRequestBodySizeFeature>();
|
||||||
|
if (bodySizeFeature != null)
|
||||||
|
{
|
||||||
|
// IIS already limits this, no need to do it twice.
|
||||||
|
bodySizeFeature.MaxRequestBodySize = null;
|
||||||
|
}
|
||||||
|
|
||||||
if (_options.ForwardClientCertificate)
|
if (_options.ForwardClientCertificate)
|
||||||
{
|
{
|
||||||
var header = httpContext.Request.Headers[MSAspNetCoreClientCert];
|
var header = httpContext.Request.Headers[MSAspNetCoreClientCert];
|
||||||
|
|
|
||||||
|
|
@ -81,6 +81,10 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
|
||||||
response = await deploymentResult.HttpClient.GetAsync("/Query%3FPath?query?");
|
response = await deploymentResult.HttpClient.GetAsync("/Query%3FPath?query?");
|
||||||
responseText = await response.Content.ReadAsStringAsync();
|
responseText = await response.Content.ReadAsStringAsync();
|
||||||
Assert.Equal("?query?", responseText);
|
Assert.Equal("?query?", responseText);
|
||||||
|
|
||||||
|
response = await deploymentResult.HttpClient.GetAsync("/BodyLimit");
|
||||||
|
responseText = await response.Content.ReadAsStringAsync();
|
||||||
|
Assert.Equal("null", responseText);
|
||||||
}
|
}
|
||||||
catch (XunitException)
|
catch (XunitException)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,9 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// Copyright (c) .NET Foundation. All rights reserved.
|
||||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
using Microsoft.AspNetCore.Builder;
|
using Microsoft.AspNetCore.Builder;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
|
using Microsoft.AspNetCore.Http.Features;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace TestSites
|
namespace TestSites
|
||||||
|
|
@ -21,9 +22,14 @@ namespace TestSites
|
||||||
{
|
{
|
||||||
return ctx.Response.WriteAsync(ctx.Request.QueryString.Value);
|
return ctx.Response.WriteAsync(ctx.Request.QueryString.Value);
|
||||||
}
|
}
|
||||||
|
if (ctx.Request.Path.Value.StartsWith("/BodyLimit"))
|
||||||
|
{
|
||||||
|
return ctx.Response.WriteAsync(
|
||||||
|
ctx.Features.Get<IHttpMaxRequestBodySizeFeature>()?.MaxRequestBodySize?.ToString() ?? "null");
|
||||||
|
}
|
||||||
|
|
||||||
return ctx.Response.WriteAsync("Hello World");
|
return ctx.Response.WriteAsync("Hello World");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue