Invidious is an alternative front-end to YouTube
Fix monkeypatch for HTTP::Client
Omar Rothbdeb325bad15
diff --git a/src/invidious.cr b/src/invidious.crindex cd6775a7..b0447865 100644--- a/src/invidious.cr+++ b/src/invidious.cr@@ -5446,7 +5446,7 @@ get "/videoplayback" do |env|client = make_client(URI.parse(host), region)- response = HTTP::Client::Response.new(403)+ response = HTTP::Client::Response.new(500)5.times dobeginresponse = client.head(url, headers)diff --git a/src/invidious/helpers/handlers.cr b/src/invidious/helpers/handlers.crindex a3dfd062..5b60c1be 100644--- a/src/invidious/helpers/handlers.cr+++ b/src/invidious/helpers/handlers.cr@@ -226,15 +226,15 @@ endclass HTTP::Clientprivate 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?+if @socket.as(OpenSSL::SSL::Socket::Client).@in_buffer_rem.empty?@socket = nilendelseclose unless response.keep_alive?end-responseendenddiff --git a/src/invidious/helpers/utils.cr b/src/invidious/helpers/utils.crindex 8d4eff9b..7dd1adf3 100644--- a/src/invidious/helpers/utils.cr+++ b/src/invidious/helpers/utils.cr@@ -1610,7 +1610,11 @@ struct HTTPPoolendresponse = yield conn- conn.unset_proxy++ if region+ conn.unset_proxy+ end+responserescue exconn = HTTPClient.new(url)