summaryrefslogtreecommitdiff
path: root/lib/net/ftp.rb
diff options
context:
space:
mode:
authorShugo Maeda <shugo@ruby-lang.org>2020-05-19 17:46:21 +0900
committerShugo Maeda <shugo@ruby-lang.org>2020-05-19 17:48:53 +0900
commit5e81e8675a020ecd493620a4ff38db8fcf4b972a (patch)
tree33e5cfafd27aea0546f0f09110eb248edca941c7 /lib/net/ftp.rb
parent1f063abb4c42acc52e27fed76577c984ad8b7a3a (diff)
Ignore exceptions when closing data connections [Bug #16780]
Patch by koshigoe (Masataka SUZUKI). Thanks!
Diffstat (limited to 'lib/net/ftp.rb')
-rw-r--r--lib/net/ftp.rb16
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/net/ftp.rb b/lib/net/ftp.rb
index 307b40e6dd..eedb88c49f 100644
--- a/lib/net/ftp.rb
+++ b/lib/net/ftp.rb
@@ -634,9 +634,9 @@ module Net
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
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
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
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