1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

test_ssl_server.rb: fix FD leak

* test/webrick/test_ssl_server.rb (assert_self_signed_cert): close
  underlying TCP socket to fix FD leak.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55992 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2016-08-23 02:05:24 +00:00
parent c58c902576
commit d3e7e3cc8b

View file

@ -28,11 +28,13 @@ class TestWEBrickSSLServer < Test::Unit::TestCase
def assert_self_signed_cert(config)
TestWEBrick.start_server(Echo, config){|server, addr, port, log|
sock = OpenSSL::SSL::SSLSocket.new(TCPSocket.new(addr, port))
io = TCPSocket.new(addr, port)
sock = OpenSSL::SSL::SSLSocket.new(io)
sock.connect
sock.puts(server.ssl_context.cert.subject.to_s)
assert_equal("/C=JP/O=www.ruby-lang.org/CN=Ruby\n", sock.gets, log.call)
sock.close
io.close
}
end
end