From ccbbc453617d841c5020f20071a2ea6ec470979a Mon Sep 17 00:00:00 2001 From: syeopite Date: Thu, 10 Apr 2025 01:05:15 -0700 Subject: [PATCH] Ensure http-proxy is not used for companion --- src/invidious.cr | 1 + src/invidious/connection/pool.cr | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/invidious.cr b/src/invidious.cr index e39d08c4..0ae785df 100644 --- a/src/invidious.cr +++ b/src/invidious.cr @@ -112,6 +112,7 @@ end COMPANION_POOL = Invidious::ConnectionPool::Pool.new( max_capacity: CONFIG.pool_size, + reinitialize_proxy: false ) do companion = CONFIG.invidious_companion.sample next make_client(companion.private_url, use_http_proxy: false) diff --git a/src/invidious/connection/pool.cr b/src/invidious/connection/pool.cr index 3c6d747e..a97b9983 100644 --- a/src/invidious/connection/pool.cr +++ b/src/invidious/connection/pool.cr @@ -8,6 +8,7 @@ module Invidious::ConnectionPool *, max_capacity : Int32 = 5, timeout : Float64 = 5.0, + @reinitialize_proxy : Bool = true, # Whether or not http-proxy should be reinitialized on checkout &client_factory : -> HTTP::Client ) pool_options = DB::Pool::Options.new( @@ -57,7 +58,7 @@ module Invidious::ConnectionPool # This new TCP IO will be a direct connection to the server and will not go # through the proxy. As such we'll need to reinitialize the proxy connection - http_client.proxy = make_configured_http_proxy_client() if CONFIG.http_proxy + http_client.proxy = make_configured_http_proxy_client() if @reinitialize_proxy && CONFIG.http_proxy response = yield http_client rescue ex : DB::PoolTimeout