mirror of
https://github.com/iv-org/invidious.git
synced 2024-11-22 13:37:24 +00:00
Fix monkeypatch for HTTP::Client
This commit is contained in:
parent
a1225b6d0d
commit
bdeb325bad
@ -5446,7 +5446,7 @@ get "/videoplayback" do |env|
|
|||||||
|
|
||||||
client = make_client(URI.parse(host), region)
|
client = make_client(URI.parse(host), region)
|
||||||
|
|
||||||
response = HTTP::Client::Response.new(403)
|
response = HTTP::Client::Response.new(500)
|
||||||
5.times do
|
5.times do
|
||||||
begin
|
begin
|
||||||
response = client.head(url, headers)
|
response = client.head(url, headers)
|
||||||
|
@ -226,15 +226,15 @@ end
|
|||||||
|
|
||||||
class HTTP::Client
|
class HTTP::Client
|
||||||
private def handle_response(response)
|
private def handle_response(response)
|
||||||
if @socket.is_a?(OpenSSL::SSL::Socket::Client)
|
if @socket.is_a?(OpenSSL::SSL::Socket::Client) && @host.ends_with? "googlevideo.com"
|
||||||
close unless response.keep_alive? || @socket.as(OpenSSL::SSL::Socket::Client).@in_buffer_rem.empty?
|
close unless response.keep_alive? || @socket.as(OpenSSL::SSL::Socket::Client).@in_buffer_rem.empty?
|
||||||
|
|
||||||
if @socket.as(OpenSSL::SSL::Socket::Client).@in_buffer_rem.empty?
|
if @socket.as(OpenSSL::SSL::Socket::Client).@in_buffer_rem.empty?
|
||||||
@socket = nil
|
@socket = nil
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
close unless response.keep_alive?
|
close unless response.keep_alive?
|
||||||
end
|
end
|
||||||
|
|
||||||
response
|
response
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -1610,7 +1610,11 @@ struct HTTPPool
|
|||||||
end
|
end
|
||||||
|
|
||||||
response = yield conn
|
response = yield conn
|
||||||
|
|
||||||
|
if region
|
||||||
conn.unset_proxy
|
conn.unset_proxy
|
||||||
|
end
|
||||||
|
|
||||||
response
|
response
|
||||||
rescue ex
|
rescue ex
|
||||||
conn = HTTPClient.new(url)
|
conn = HTTPClient.new(url)
|
||||||
|
Loading…
Reference in New Issue
Block a user