summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/invidious/helpers/handlers.cr17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/invidious/helpers/handlers.cr b/src/invidious/helpers/handlers.cr
index bc1a3896..4e73df51 100644
--- a/src/invidious/helpers/handlers.cr
+++ b/src/invidious/helpers/handlers.cr
@@ -199,7 +199,7 @@ class DenyFrame < Kemal::Handler
end
end
-# Temp fix for https://github.com/crystal-lang/crystal/issues/7383
+# Temp fixes for https://github.com/crystal-lang/crystal/issues/7383
class HTTP::UnknownLengthContent
def read_byte
ensure_send_continue
@@ -209,3 +209,18 @@ class HTTP::UnknownLengthContent
@io.read_byte
end
end
+
+class HTTP::Client
+ private def handle_response(response)
+ if @socket.is_a?(OpenSSL::SSL::Socket::Client)
+ 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 = nil
+ end
+ else
+ close unless response.keep_alive?
+ end
+
+ response
+ end
+end