[release/5.0] Fix null ref in UrlGroup.Dispose due to logger not set (#28494)
* Fix null ref in UrlGroup.Dispose due to logger not set * PR Feedback: make _logger readonly Co-authored-by: Nolan Glore <nglore@microsoft.com>
This commit is contained in:
parent
894f4cabae
commit
050c257590
|
|
@ -24,7 +24,7 @@ namespace Microsoft.AspNetCore.Server.HttpSys
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
UrlGroup = new UrlGroup(this, UrlPrefix.Create(urlPrefix));
|
UrlGroup = new UrlGroup(this, UrlPrefix.Create(urlPrefix), logger);
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -16,8 +16,9 @@ namespace Microsoft.AspNetCore.Server.HttpSys
|
||||||
private static readonly int RequestPropertyInfoSize =
|
private static readonly int RequestPropertyInfoSize =
|
||||||
Marshal.SizeOf<HttpApiTypes.HTTP_BINDING_INFO>();
|
Marshal.SizeOf<HttpApiTypes.HTTP_BINDING_INFO>();
|
||||||
|
|
||||||
|
private readonly ILogger _logger;
|
||||||
|
|
||||||
private ServerSession _serverSession;
|
private ServerSession _serverSession;
|
||||||
private ILogger _logger;
|
|
||||||
private bool _disposed;
|
private bool _disposed;
|
||||||
private bool _created;
|
private bool _created;
|
||||||
|
|
||||||
|
|
@ -40,8 +41,10 @@ namespace Microsoft.AspNetCore.Server.HttpSys
|
||||||
Id = urlGroupId;
|
Id = urlGroupId;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal unsafe UrlGroup(RequestQueue requestQueue, UrlPrefix url)
|
internal unsafe UrlGroup(RequestQueue requestQueue, UrlPrefix url, ILogger logger)
|
||||||
{
|
{
|
||||||
|
_logger = logger;
|
||||||
|
|
||||||
ulong urlGroupId = 0;
|
ulong urlGroupId = 0;
|
||||||
_created = false;
|
_created = false;
|
||||||
var statusCode = HttpApi.HttpFindUrlGroupId(
|
var statusCode = HttpApi.HttpFindUrlGroupId(
|
||||||
|
|
|
||||||
|
|
@ -326,6 +326,10 @@ namespace Microsoft.AspNetCore.Server.HttpSys
|
||||||
|
|
||||||
internal unsafe void Delegate(DelegationRule destination)
|
internal unsafe void Delegate(DelegationRule destination)
|
||||||
{
|
{
|
||||||
|
if (destination == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(destination));
|
||||||
|
}
|
||||||
if (Request.HasRequestBodyStarted)
|
if (Request.HasRequestBodyStarted)
|
||||||
{
|
{
|
||||||
throw new InvalidOperationException("This request cannot be delegated, the request body has already started.");
|
throw new InvalidOperationException("This request cannot be delegated, the request body has already started.");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue