Skip to content
This repository was archived by the owner on Mar 19, 2019. It is now read-only.

Commit 1b5ba87

Browse files
committed
Improved request error handling.
1 parent 9e4ab16 commit 1b5ba87

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

src/Microsoft.AspNetCore.Server.HttpSys/AsyncAcceptContext.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
using System.Diagnostics.Contracts;
77
using System.Threading;
88
using System.Threading.Tasks;
9+
using Microsoft.AspNetCore.Http;
910

1011
namespace Microsoft.AspNetCore.Server.HttpSys
1112
{
@@ -79,6 +80,11 @@ private static void IOCompleted(AsyncAcceptContext asyncResult, uint errorCode,
7980
complete = true;
8081
}
8182
}
83+
catch (Exception)
84+
{
85+
server.SendError(asyncResult._nativeRequestContext.RequestId, StatusCodes.Status400BadRequest);
86+
throw;
87+
}
8288
finally
8389
{
8490
if (stoleBlob)

src/Microsoft.AspNetCore.Server.HttpSys/HttpSysListener.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ internal unsafe bool ValidateAuth(NativeRequestContext requestMemory)
315315
return true;
316316
}
317317

318-
private unsafe void SendError(ulong requestId, int httpStatusCode, IList<string> authChallenges)
318+
internal unsafe void SendError(ulong requestId, int httpStatusCode, IList<string> authChallenges = null)
319319
{
320320
HttpApi.HTTP_RESPONSE_V2 httpResponse = new HttpApi.HTTP_RESPONSE_V2();
321321
httpResponse.Response_V1.Version = new HttpApi.HTTP_VERSION();

src/Microsoft.AspNetCore.Server.HttpSys/MessagePump.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ private async void ProcessRequestsWorker()
165165
{
166166
LogHelper.LogException(_logger, "ListenForNextRequestAsync", exception);
167167
}
168-
return;
168+
continue;
169169
}
170170
try
171171
{

0 commit comments

Comments
 (0)