summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorOmar Roth <omarroth@protonmail.com>2019-05-05 19:03:56 -0500
committerOmar Roth <omarroth@protonmail.com>2019-05-05 19:03:56 -0500
commit53fbb257b97d52a2146683c2ed9382bfcc7fb747 (patch)
tree67da79cbca5e6faf8c9a336105c7927b7ce4a4c9 /src
parent65a32d6e20f47bbc310d46d64910ac9d66d12ed6 (diff)
downloadinvidious-53fbb257b97d52a2146683c2ed9382bfcc7fb747.tar.gz
invidious-53fbb257b97d52a2146683c2ed9382bfcc7fb747.tar.bz2
invidious-53fbb257b97d52a2146683c2ed9382bfcc7fb747.zip
Update fix for HTTP Client
Diffstat (limited to 'src')
-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