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

Commit

Permalink
Improved request error handling.
Browse files Browse the repository at this point in the history
  • Loading branch information
Tratcher committed Nov 3, 2017
1 parent 9e4ab16 commit 1b5ba87
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions src/Microsoft.AspNetCore.Server.HttpSys/AsyncAcceptContext.cs
Expand Up @@ -6,6 +6,7 @@
using System.Diagnostics.Contracts;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;

namespace Microsoft.AspNetCore.Server.HttpSys
{
Expand Down Expand Up @@ -79,6 +80,11 @@ private static void IOCompleted(AsyncAcceptContext asyncResult, uint errorCode,
complete = true;
}
}
catch (Exception)
{
server.SendError(asyncResult._nativeRequestContext.RequestId, StatusCodes.Status400BadRequest);
throw;
}
finally
{
if (stoleBlob)
Expand Down
2 changes: 1 addition & 1 deletion src/Microsoft.AspNetCore.Server.HttpSys/HttpSysListener.cs
Expand Up @@ -315,7 +315,7 @@ internal unsafe bool ValidateAuth(NativeRequestContext requestMemory)
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)
{
HttpApi.HTTP_RESPONSE_V2 httpResponse = new HttpApi.HTTP_RESPONSE_V2();
httpResponse.Response_V1.Version = new HttpApi.HTTP_VERSION();
Expand Down
2 changes: 1 addition & 1 deletion src/Microsoft.AspNetCore.Server.HttpSys/MessagePump.cs
Expand Up @@ -165,7 +165,7 @@ private async void ProcessRequestsWorker()
{
LogHelper.LogException(_logger, "ListenForNextRequestAsync", exception);
}
return;
continue;
}
try
{
Expand Down

0 comments on commit 1b5ba87

Please sign in to comment.