You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 20, 2018. It is now read-only.
Some resources need to be cleaned up at the end of a request. Middleware can do this as the request pipeline unwinds. Non-middleware components do not have a clear indication of when they should clean up their resources and must currently rely on the GC.
Prior art: Right now we have an notification void HttpResponse.OnSendingHeaders(Action<object> callback, object state) where components can register for callbacks to be invoked just before the response headers are sent.
Proposal: void HttpResponse.OnResponseCompleted(Action<object> callback, object state)
Semantics: Registered callbacks are invoked after the response has complete and the application pipeline has unwound. The HttpContext is still in scope and may be used as part of the state parameter but it is too late to make any modifications to the response.
Should this go on the IHttpResposneFeature interface next to OnSendingHeaders?
The text was updated successfully, but these errors were encountered:
Some resources need to be cleaned up at the end of a request. Middleware can do this as the request pipeline unwinds. Non-middleware components do not have a clear indication of when they should clean up their resources and must currently rely on the GC.
Example:
https://github.com/aspnet/HttpAbstractions/blob/dev/src/Microsoft.AspNet.PipelineCore/BufferingHelper.cs#L40
When the request body is buffered to a temp file it is marked as delete-on-close. However, it's unclear when the temp buffer is actually ready for disposal so the GC has to take care of it. The code above could register for a new notification that the request had ended and proactively dispose the temp file at that point.
Prior art: Right now we have an notification
void HttpResponse.OnSendingHeaders(Action<object> callback, object state)
where components can register for callbacks to be invoked just before the response headers are sent.Proposal:
void HttpResponse.OnResponseCompleted(Action<object> callback, object state)
Semantics: Registered callbacks are invoked after the response has complete and the application pipeline has unwound. The HttpContext is still in scope and may be used as part of the state parameter but it is too late to make any modifications to the response.
Should this go on the IHttpResposneFeature interface next to OnSendingHeaders?
The text was updated successfully, but these errors were encountered: