summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorsyeopite <syeopite@syeopite.dev>2023-12-07 11:21:06 -0800
committersyeopite <syeopite@syeopite.dev>2024-05-22 13:22:00 -0700
commit41c978d350eaf7a78951d58ae859830a300f6191 (patch)
tree2d101a14159dfc3d83e80363e6cc39cc38e5619b /src
parentcff25a7b2569b15d6129edffc6ca01e7c3a69d76 (diff)
downloadinvidious-41c978d350eaf7a78951d58ae859830a300f6191.tar.gz
invidious-41c978d350eaf7a78951d58ae859830a300f6191.tar.bz2
invidious-41c978d350eaf7a78951d58ae859830a300f6191.zip
Use HTTP::Client directly in instance list job
The HTTP::Client created via `make_client` is affected by the force_resolve configuration option. However, api.invidious.io does not support ipv6 and as such any request with ipv6 to api.invidious.io will instead raise. Directly calling the HTTP::Client will ignore the force_resolve option allowing requests to go through ipv4 when needed.
Diffstat (limited to 'src')
-rw-r--r--src/invidious/jobs/instance_refresh_job.cr5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/invidious/jobs/instance_refresh_job.cr b/src/invidious/jobs/instance_refresh_job.cr
index bfda9f3f..38071998 100644
--- a/src/invidious/jobs/instance_refresh_job.cr
+++ b/src/invidious/jobs/instance_refresh_job.cr
@@ -58,7 +58,10 @@ class Invidious::Jobs::InstanceListRefreshJob < Invidious::Jobs::BaseJob
# Fetches information regarding instances from api.invidious.io or an otherwise configured URL
private def fetch_instances : Array(JSON::Any)
begin
- instance_api_client = make_client(URI.parse("https://api.invidious.io"))
+ # We directly call the stdlib HTTP::Client here as it allows us to negate the effects
+ # of the force_resolve config option. This is needed as api.invidious.io does not support ipv6
+ # and as such the following request raises if we were to use force_resolve with the ipv6 value.
+ instance_api_client = HTTP::Client.new(URI.parse("https://api.invidious.io"))
# Timeouts
instance_api_client.connect_timeout = 10.seconds