diff options
author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-03-25 09:31:25 +0000 |
---|---|---|
committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-03-25 09:31:25 +0000 |
commit | fb28e643423b08fb8b0b458cca7799992d8df156 (patch) | |
tree | 600f9bfae730a776af136dda22bc2e209ec4bce2 | |
parent | facd02511b30aa27fd1a33d39b9c28109738652e (diff) |
merge revision(s) 53810: [Backport #12044]
* net/ftp.rb: add NullSocket#closed? to fix closing not opened
connection. [Fix GH-1232]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@54277 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | lib/net/ftp.rb | 4 | ||||
-rw-r--r-- | test/net/ftp/test_ftp.rb | 8 | ||||
-rw-r--r-- | version.h | 2 |
4 files changed, 18 insertions, 1 deletions
@@ -1,3 +1,8 @@ +Fri Mar 25 18:30:55 2016 Anthony Dmitriyev <[email protected]> + + * net/ftp.rb: add NullSocket#closed? to fix closing not opened + connection. [Fix GH-1232] + Fri Mar 25 18:26:40 2016 Nobuyoshi Nakada <[email protected]> * numeric.c (num_step_scan_args): comparison String with Numeric diff --git a/lib/net/ftp.rb b/lib/net/ftp.rb index 5ddccda90c..f337fd5056 100644 --- a/lib/net/ftp.rb +++ b/lib/net/ftp.rb @@ -1070,6 +1070,10 @@ module Net def read_timeout=(sec) end + def closed? + true + end + def close end diff --git a/test/net/ftp/test_ftp.rb b/test/net/ftp/test_ftp.rb index 423cfe8e9e..3ccbb6222b 100644 --- a/test/net/ftp/test_ftp.rb +++ b/test/net/ftp/test_ftp.rb @@ -23,6 +23,14 @@ class FTPTest < Test::Unit::TestCase end end + def test_closed_when_not_connected + ftp = Net::FTP.new + assert_equal(true, ftp.closed?) + assert_nothing_raised(Net::FTPConnectionError) do + ftp.close + end + end + def test_connect_fail server = create_ftp_server { |sock| sock.print("421 Service not available, closing control connection.\r\n") @@ -1,6 +1,6 @@ #define RUBY_VERSION "2.1.9" #define RUBY_RELEASE_DATE "2016-03-25" -#define RUBY_PATCHLEVEL 474 +#define RUBY_PATCHLEVEL 475 #define RUBY_RELEASE_YEAR 2016 #define RUBY_RELEASE_MONTH 3 |