mirror of
https://github.com/BepInEx/dotnet-runtime.git
synced 2026-11-25 07:06:20 -10:00
SocketsHttpHandler doesn't own the proxy its given; the lifetime of that proxy is up to the developer supplying it. We may also end up using a global proxy instance if the developer hasn't explicitly supplied one. However, SocketsHttpHandler's internal HttpConnectionPoolManager was disposing of this proxy instance on its disposal. For proxies that implement IDisposable, as our global default proxy does, that can be very problematic; on Windows, our default proxy has a SafeHandle, and once its disposed, every subsequent request to the proxy will fail (an exception gets thrown and then internally eaten). The fix is simply to stop disposing a proxy instance we don't own. While investigating this, I also made a few style tweaks to WinInetProxyHelper, removing private property setters, so as to better be able to see that certain values were readonly and never changed after construction. Commit migrated from https://github.com/dotnet/corefx/commit/c6a849b8d24fc48bb0bbdb9f9165752a4a19459b