dotnet / dotnet/aspnetcore

Abort connection instead of flushing committed response data when throwing an Application Exception in Kestrel

Open
#7,034 2 comments 0 reactions 0 assignees View on GitHub
affected-very-few area-networking enhancement feature-kestrel feature-pipelines severity-nice-to-have
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 10h
Merged PRs (30d)
281

Description

After introducing `HttpResponse.StartAsync()`, if someone does the following:
```c#
await httpContext.Response.StartAsync();
throw new Exception();
```

This shouldn't write any data to the client. However, today it does because we call PipeWriter.Complete() if we are either Aborting or Disposing the OutputProducer, rather than PipeWriter.Complete(exception).

I tried to do this as part of https://github.com/aspnet/AspNetCore/pull/6967, but it was a much larger change than expected.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.