Compare commits

..

No commits in common. "1c0b4205d40781ff2d34d64dddf29e5dc89d1723" and "97c4165f55c4574efb554c9dae8d919d08da1cdd" have entirely different histories.

3 changed files with 10 additions and 15 deletions

View File

@ -16,7 +16,7 @@ jobs:
days-before-stale: 365
days-before-pr-stale: 90
days-before-close: 30
exempt-pr-labels: blocked,exempt-stale
exempt-pr-labels: blocked
stale-issue-message: 'This issue has been automatically marked as stale and will be closed in 30 days because it has not had recent activity and is much likely outdated. If you think this issue is still relevant and applicable, you just have to post a comment and it will be unmarked.'
stale-pr-message: 'This pull request has been automatically marked as stale and will be closed in 30 days because it has not had recent activity and is much likely abandoned or outdated. If you think this pull request is still relevant and applicable, you just have to post a comment and it will be unmarked.'
stale-issue-label: "stale"

View File

@ -42,7 +42,7 @@ module Invidious::Routes::VideoPlayback
headers["Range"] = "bytes=#{range_for_head}"
end
client = make_client(URI.parse(host), region, force_resolve = true)
client = make_client(URI.parse(host), region)
response = HTTP::Client::Response.new(500)
error = ""
5.times do
@ -57,7 +57,7 @@ module Invidious::Routes::VideoPlayback
if new_host != host
host = new_host
client.close
client = make_client(URI.parse(new_host), region, force_resolve = true)
client = make_client(URI.parse(new_host), region)
end
url = "#{location.request_target}&host=#{location.host}#{region ? "&region=#{region}" : ""}"
@ -71,7 +71,7 @@ module Invidious::Routes::VideoPlayback
fvip = "3"
host = "https://r#{fvip}---#{mn}.googlevideo.com"
client = make_client(URI.parse(host), region, force_resolve = true)
client = make_client(URI.parse(host), region)
rescue ex
error = ex.message
end
@ -196,7 +196,7 @@ module Invidious::Routes::VideoPlayback
break
else
client.close
client = make_client(URI.parse(host), region, force_resolve = true)
client = make_client(URI.parse(host), region)
end
end

View File

@ -26,7 +26,7 @@ struct YoutubeConnectionPool
def client(region = nil, &block)
if region
conn = make_client(url, region, force_resolve = true)
conn = make_client(url, region)
response = yield conn
else
conn = pool.checkout
@ -59,14 +59,9 @@ struct YoutubeConnectionPool
end
end
def make_client(url : URI, region = nil, force_resolve : Bool = false)
def make_client(url : URI, region = nil)
client = HTTPClient.new(url, OpenSSL::SSL::Context::Client.insecure)
# Some services do not support IPv6.
if force_resolve
client.family = CONFIG.force_resolve
end
client.family = CONFIG.force_resolve
client.before_request { |r| add_yt_headers(r) } if url.host == "www.youtube.com"
client.read_timeout = 10.seconds
client.connect_timeout = 10.seconds
@ -85,8 +80,8 @@ def make_client(url : URI, region = nil, force_resolve : Bool = false)
return client
end
def make_client(url : URI, region = nil, force_resolve : Bool = false, &block)
client = make_client(url, region, force_resolve)
def make_client(url : URI, region = nil, &block)
client = make_client(url, region)
begin
yield client
ensure