Commit Graph

4 Commits

Author SHA1 Message Date
Chris Ross (ASP.NET) 07b8318db0 Merged PR 9042: [3.1] Pass RequestAborted to SendFileAsync
This is the 3.1 version of https://dev.azure.com/dnceng/internal/_git/dotnet-aspnetcore/pullrequest/9014.

The concerns in 3.1 are slightly different than prior versions due to a significant redesign in how the response body was handled.

In 2.1 very few components implemented IHttpSendFileFeature, and most of those that did would eagerly terminate if the request aborted (e.g. HttpSys server). We mainly had to be concerned about the fallback code that did a copy loop when IHttpSendFileFeature wasn't available.

In 3.x the response body Stream, PipeWriter, and SendFileAsync were consolidated onto the new IHttpResponseBodyFeature. Now all servers and component shims support all three ways to send data and we can't make any assumptions about how eagerly they terminate. E.g. many components implemented SendFileAsync using a fallback copy loop, and these components don't have access to RequestAborted to eagerly terminate. This means that in 3.1 we need to pass the RequestAborted token when calling IHttpSendFileFeature.SendFileAsync, as well as any copy loops that have access to the token.

I've primarily fixed the HttpResponse.SendFileAsync extension methods and made sure the other affected components call through here.

[Infrastructure side note]
This commit needs to be rebased on internal/release/3.1 before merging. That branch can't be built locally so I developed this fix based on release/3.1 instead.
2020-07-16 21:37:46 +00:00
Ben Adams 617bc1ac02 Reduce StaticFileContext allocation/struct copy (#9815) 2019-05-03 11:55:37 -07:00
Chris Ross 6db129a588
Support conditional compression #6925 (#8239) 2019-03-07 11:09:48 -08:00
dotnet-maestro-bot 38785d0be9 [automated] Merge branch 'release/2.1' => 'release/2.2' (#4577)
* Workaround problems when opening solution files in Visual Studio (#4569)

Changes:

* Condense Routing.sln into HttpAbstractions.sln
* Workaround NU1105 by adding all ProjectReferences to the .sln
* Workaround exceptions in the ReferencesHostBridge by moving Reference items to a temporary item group
* Add a 'startvs.cmd' script for launching VS with the right env variables
* Remove RangeHelper test project
* Move RangeHelper tests into StaticFiles.Tests and add target for NPM restore

* Convert Session to use Reference and move to Middleware folder (#4576)

* Add RoutingSample.Web to HttpAbstractions.sln
2018-12-11 16:13:20 -08:00