Update fix for HTTP Client

This commit is contained in:
Omar Roth 2019-05-05 19:03:56 -05:00
parent 65a32d6e20
commit 53fbb257b9
No known key found for this signature in database
GPG Key ID: B8254FB7EC3D37F2
1 changed files with 16 additions and 1 deletions

View File

@ -199,7 +199,7 @@ class DenyFrame < Kemal::Handler
end end
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 class HTTP::UnknownLengthContent
def read_byte def read_byte
ensure_send_continue ensure_send_continue
@ -209,3 +209,18 @@ class HTTP::UnknownLengthContent
@io.read_byte @io.read_byte
end end
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