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

Commit a8e4f69

Browse files
committed
Improved request error handling.
1 parent 28d56fe commit a8e4f69

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ private async void ProcessRequestsWorker()
127127
{
128128
LogHelper.LogException(_logger, "ListenForNextRequestAsync", exception);
129129
}
130-
return;
130+
continue;
131131
}
132132
try
133133
{

src/Microsoft.Net.Http.Server/AsyncAcceptContext.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,11 @@ private static void IOCompleted(AsyncAcceptContext asyncResult, uint errorCode,
7979
complete = true;
8080
}
8181
}
82+
catch (Exception)
83+
{
84+
server.SendError(asyncResult._nativeRequestContext.RequestId, HttpStatusCode.BadRequest);
85+
throw;
86+
}
8287
finally
8388
{
8489
if (stoleBlob)

src/Microsoft.Net.Http.Server/WebListener.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ internal unsafe bool ValidateAuth(NativeRequestContext requestMemory)
318318
return true;
319319
}
320320

321-
private unsafe void SendError(ulong requestId, HttpStatusCode httpStatusCode, IList<string> authChallenges)
321+
internal unsafe void SendError(ulong requestId, HttpStatusCode httpStatusCode, IList<string> authChallenges = null)
322322
{
323323
HttpApi.HTTP_RESPONSE_V2 httpResponse = new HttpApi.HTTP_RESPONSE_V2();
324324
httpResponse.Response_V1.Version = new HttpApi.HTTP_VERSION();

0 commit comments

Comments
 (0)