summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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 d0097f9046..67b78a7b33 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Fri Mar 25 18:30:55 2016 Anthony Dmitriyev <antstorm@gmail.com>
+
+ * net/ftp.rb: add NullSocket#closed? to fix closing not opened
+ connection. [Fix GH-1232]
+
Fri Mar 25 18:26:40 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
* 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")
diff --git a/version.h b/version.h
index 449ef540cc..430b75f5ed 100644
--- a/version.h
+++ b/version.h
@@ -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