summaryrefslogtreecommitdiff
path: root/lib/net
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2021-03-02 11:26:58 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2021-03-02 11:26:58 +0000
commita175a30ab9d79b759fa17e71506caef896a4540e (patch)
treee4326e4b458d7ed815b77f40dd7a7184f636d288 /lib/net
parentefd499b211dfc9696beea90a73fd72aaf95d6c5e (diff)
merge revision(s) 5a79d8e0,160511d8: [Backport #16925]
Fix error raised by Net::HTTPResponse#inflater if the block raises * See https://bugs.ruby-lang.org/issues/13882#note-6 --- lib/net/http/response.rb | 5 ++- spec/ruby/library/net/http/http/get_spec.rb | 67 +++++++++++++++++++++++++++++ 2 files changed, 70 insertions(+), 2 deletions(-) Quarantine specs which fail frequently with CHECK_LEAKS=true --- spec/ruby/library/net/http/http/get_spec.rb | 2 ++ 1 file changed, 2 insertions(+) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_6@67909 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/net')
-rw-r--r--lib/net/http/response.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/net/http/response.rb b/lib/net/http/response.rb
index 66132985d9..ca0a6eb379 100644
--- a/lib/net/http/response.rb
+++ b/lib/net/http/response.rb
@@ -262,12 +262,13 @@ class Net::HTTPResponse
begin
yield inflate_body_io
+ success = true
ensure
- orig_err = $!
begin
inflate_body_io.finish
rescue => err
- raise orig_err || err
+ # Ignore #finish's error if there is an exception from yield
+ raise err if success
end
end
when 'none', 'identity' then