invidious icon indicating copy to clipboard operation
invidious copied to clipboard

[Enhancement] Don't override stdlib for `force_resolve` implementation

Open syeopite opened this issue 1 year ago • 2 comments

Is your enhancement request related to a problem? Please describe.

The current force_resolve implementation relies on patching the HTTP::Client in stdlib. It really isn't good practice.

Describe the solution you'd like

I've recently been made aware that it is possible to force the HTTP::Client to resolve a specific IP family without overriding the stdlib implementation.

See https://github.com/crystal-lang/crystal/issues/14196#issuecomment-1884003549

The downside is that we'll lose the automatic reconnect feature.

Describe alternatives you've considered

Create a new http client that inherits from stdlib with force_resolve implementation

Additional context

syeopite avatar Apr 29 '24 02:04 syeopite

Thanks for opening an upstream issue for that!

SamantazFox avatar May 13 '24 22:05 SamantazFox

Alternatively, we could just create a new client object that inherits from the stdlib HTTP::Client

syeopite avatar May 22 '24 20:05 syeopite