-
Notifications
You must be signed in to change notification settings - Fork 893
Description
IHttpForwarder.SendAsync does not directly accept a CancellationToken to abort it. It supports canceling if the ForwarderRequestConfig.ActivityTimeout expires, or if HttpContext.RequestAborted triggers (client disconnect).
https://github.com/microsoft/reverse-proxy/blob/79c88ce07f9b88a283e10fc4cc45287b2efa6750/src/ReverseProxy/Forwarder/IHttpForwarder.cs#L25-L26
A customer that wanted to add their own cancellation condition did so by replacing HttpContext.RequestAborted. However, this caused an issue where they were leaking resources because they were no longer responding to the original RequestAborted token. The fix was to chain the two tokens.
Feedback: Having a CancellationToken parameter on IHttpForwarder.SendAsync would make this less error prone.