Capture Edi at Abort not throw (#11875)

This commit is contained in:
Ben Adams 2019-07-19 21:34:19 +01:00 committed by Stephen Halter
parent e6a4d9f19e
commit 5a0a7aa088
1 changed files with 6 additions and 3 deletions

View File

@ -17,7 +17,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http
{ {
private MessageBody _body; private MessageBody _body;
private HttpStreamState _state; private HttpStreamState _state;
private Exception _error; private ExceptionDispatchInfo _error;
public HttpRequestPipeReader() public HttpRequestPipeReader()
{ {
@ -92,7 +92,10 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http
if (_state != HttpStreamState.Closed) if (_state != HttpStreamState.Closed)
{ {
_state = HttpStreamState.Aborted; _state = HttpStreamState.Aborted;
_error = error; if (error != null)
{
_error = ExceptionDispatchInfo.Capture(error);
}
} }
} }
@ -112,7 +115,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http
{ {
if (_error != null) if (_error != null)
{ {
ExceptionDispatchInfo.Capture(_error).Throw(); _error.Throw();
} }
else else
{ {