Improved request error handling.
This commit is contained in:
parent
58fb4f322e
commit
cfd974337d
|
|
@ -6,6 +6,7 @@ using System.Diagnostics.CodeAnalysis;
|
|||
using System.Runtime.InteropServices;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.HttpSys.Internal;
|
||||
|
||||
namespace Microsoft.AspNetCore.Server.HttpSys
|
||||
|
|
@ -80,6 +81,11 @@ namespace Microsoft.AspNetCore.Server.HttpSys
|
|||
complete = true;
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
server.SendError(asyncResult._nativeRequestContext.RequestId, StatusCodes.Status400BadRequest);
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
// The request has been handed to the user, which means this code can't reuse the blob. Reset it here.
|
||||
|
|
|
|||
|
|
@ -316,7 +316,7 @@ namespace Microsoft.AspNetCore.Server.HttpSys
|
|||
return true;
|
||||
}
|
||||
|
||||
private unsafe void SendError(ulong requestId, int httpStatusCode, IList<string> authChallenges)
|
||||
internal unsafe void SendError(ulong requestId, int httpStatusCode, IList<string> authChallenges = null)
|
||||
{
|
||||
HttpApiTypes.HTTP_RESPONSE_V2 httpResponse = new HttpApiTypes.HTTP_RESPONSE_V2();
|
||||
httpResponse.Response_V1.Version = new HttpApiTypes.HTTP_VERSION();
|
||||
|
|
|
|||
|
|
@ -168,7 +168,7 @@ namespace Microsoft.AspNetCore.Server.HttpSys
|
|||
{
|
||||
LogHelper.LogException(_logger, "ListenForNextRequestAsync", exception);
|
||||
}
|
||||
return;
|
||||
continue;
|
||||
}
|
||||
try
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue