From 8ca558aefdc3ad29b4e3a680fa48f736bbdd460d Mon Sep 17 00:00:00 2001 From: Hiroshi Nakamura Date: Thu, 28 Sep 2017 10:12:39 -0700 Subject: [PATCH] raise the cause of KeepAliveDisconnected to caller It's rarely useful when a caller receives KeepAliveDisconnected exception. By this commit caller only receives KeepAliveDisconnected when HTTPClient receives empty header line twice. Test should come later. --- lib/httpclient.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/httpclient.rb b/lib/httpclient.rb index 4f4b4297..7568e5a1 100644 --- a/lib/httpclient.rb +++ b/lib/httpclient.rb @@ -1136,6 +1136,8 @@ def protect_keep_alive_disconnected Thread.current[:HTTPClient_AcquireNewConnection] = true begin yield + rescue KeepAliveDisconnected => e + raise e.cause || e ensure Thread.current[:HTTPClient_AcquireNewConnection] = false end