diff --git a/lib/net/http/response.rb b/lib/net/http/response.rb index fb48490..3d5ad0b 100644 --- a/lib/net/http/response.rb +++ b/lib/net/http/response.rb @@ -596,6 +596,8 @@ def inflater # :nodoc: rescue => err # Ignore #finish's error if there is an exception from yield raise err if success + ensure + inflate_body_io.close end end when 'none', 'identity' then @@ -694,6 +696,13 @@ def finish @inflate.finish end + ## + # Closes the inflate stream and releases its resources. + + def close + @inflate.close + end + ## # The number of bytes inflated, used to update the Content-Length of # the response.