зеркало из https://github.com/github/ruby.git
net/ftp.rb: NullSocket#closed?
* 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/trunk@53810 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
41784333f1
Коммит
0a19e7f0a3
|
@ -1,3 +1,8 @@
|
|||
Fri Feb 12 11:49:49 2016 Anthony Dmitriyev <antstorm@gmail.com>
|
||||
|
||||
* net/ftp.rb: add NullSocket#closed? to fix closing not opened
|
||||
connection. [Fix GH-1232]
|
||||
|
||||
Fri Feb 12 11:17:38 2016 Bogdan <bogdanvlviv@gmail.com>
|
||||
|
||||
* re.c (rb_reg_initialize_m): [DOC] fix missing right bracket.
|
||||
|
|
|
@ -1270,6 +1270,10 @@ module Net
|
|||
def read_timeout=(sec)
|
||||
end
|
||||
|
||||
def closed?
|
||||
true
|
||||
end
|
||||
|
||||
def close
|
||||
end
|
||||
|
||||
|
|
|
@ -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")
|
||||
|
|
Загрузка…
Ссылка в новой задаче