ruby-changes:61296
From: Shugo <ko1@a...>
Date: Tue, 19 May 2020 17:49:25 +0900 (JST)
Subject: [ruby-changes:61296] 5e81e8675a (master): Ignore exceptions when closing data connections [Bug #16780]
https://git.ruby-lang.org/ruby.git/commit/?id=5e81e8675a From 5e81e8675a020ecd493620a4ff38db8fcf4b972a Mon Sep 17 00:00:00 2001 From: Shugo Maeda <shugo@r...> Date: Tue, 19 May 2020 17:46:21 +0900 Subject: Ignore exceptions when closing data connections [Bug #16780] Patch by koshigoe (Masataka SUZUKI). Thanks! diff --git a/lib/net/ftp.rb b/lib/net/ftp.rb index 307b40e..eedb88c 100644 --- a/lib/net/ftp.rb +++ b/lib/net/ftp.rb @@ -634,9 +634,9 @@ module Net https://github.com/ruby/ruby/blob/trunk/lib/net/ftp.rb#L634 while data = conn.read(blocksize) yield(data) end - conn.shutdown(Socket::SHUT_WR) + conn.shutdown(Socket::SHUT_WR) rescue nil conn.read_timeout = 1 - conn.read + conn.read rescue nil ensure conn.close if conn end @@ -659,9 +659,9 @@ module Net https://github.com/ruby/ruby/blob/trunk/lib/net/ftp.rb#L659 while line = conn.gets yield(line.sub(/\r?\n\z/, ""), !line.match(/\n\z/).nil?) end - conn.shutdown(Socket::SHUT_WR) + conn.shutdown(Socket::SHUT_WR) rescue nil conn.read_timeout = 1 - conn.read + conn.read rescue nil ensure conn.close if conn end @@ -688,9 +688,9 @@ module Net https://github.com/ruby/ruby/blob/trunk/lib/net/ftp.rb#L688 conn.write(buf) yield(buf) if block_given? end - conn.shutdown(Socket::SHUT_WR) + conn.shutdown(Socket::SHUT_WR) rescue nil conn.read_timeout = 1 - conn.read + conn.read rescue nil ensure conn.close if conn end @@ -724,9 +724,9 @@ module Net https://github.com/ruby/ruby/blob/trunk/lib/net/ftp.rb#L724 conn.write(buf) yield(buf) if block_given? end - conn.shutdown(Socket::SHUT_WR) + conn.shutdown(Socket::SHUT_WR) rescue nil conn.read_timeout = 1 - conn.read + conn.read rescue nil ensure conn.close if conn end -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/