summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-03-29 07:29:20 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-03-29 07:29:20 +0000
commitb2ac0f9c7d8ce2aee4730a5ccc4f35a17a1d36d9 (patch)
tree65b66ebb114375c9cd5267a9283eab77f2c7a157
parent11b277344113be65b8a8db6e2c7ff4040104bee9 (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_3@54377 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rw-r--r--lib/net/ftp.rb4
-rw-r--r--test/net/ftp/test_ftp.rb8
-rw-r--r--version.h2
4 files changed, 18 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 4bd229b1c0..3d9b6fc319 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Tue Mar 29 16:25:27 2016 Anthony Dmitriyev <antstorm@gmail.com>
+
+ * net/ftp.rb: add NullSocket#closed? to fix closing not opened
+ connection. [Fix GH-1232]
+
Tue Mar 29 16:12:08 2016 Koichi ITO <koic.ito@gmail.com>
* variable.c: Added documentation about order of `Module#constants`
diff --git a/lib/net/ftp.rb b/lib/net/ftp.rb
index 26bca1a54a..cfd8cf7945 100644
--- a/lib/net/ftp.rb
+++ b/lib/net/ftp.rb
@@ -1270,6 +1270,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 3af00e7da9..4759772cb1 100644
--- a/test/net/ftp/test_ftp.rb
+++ b/test/net/ftp/test_ftp.rb
@@ -29,6 +29,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")
diff --git a/version.h b/version.h
index 2ab0773419..cefecd8e07 100644
--- a/version.h
+++ b/version.h
@@ -1,6 +1,6 @@
#define RUBY_VERSION "2.3.0"
#define RUBY_RELEASE_DATE "2016-03-29"
-#define RUBY_PATCHLEVEL 34
+#define RUBY_PATCHLEVEL 35
#define RUBY_RELEASE_YEAR 2016
#define RUBY_RELEASE_MONTH 3