Fix monkeypatch for HTTP::Client

This commit is contained in:
Omar Roth 2019-10-26 11:43:28 -04:00
parent a1225b6d0d
commit bdeb325bad
No known key found for this signature in database
GPG key ID: B8254FB7EC3D37F2
3 changed files with 8 additions and 4 deletions

View file

@ -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 do
begin
response = client.head(url, headers)

View file

@ -226,15 +226,15 @@ end
class HTTP::Client
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?
if @socket.as(OpenSSL::SSL::Socket::Client).@in_buffer_rem.empty?
@socket = nil
end
else
close unless response.keep_alive?
end
response
end
end

View file

@ -1610,7 +1610,11 @@ struct HTTPPool
end
response = yield conn
if region
conn.unset_proxy
end
response
rescue ex
conn = HTTPClient.new(url)