mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* test/openssl: Don't specify port number.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48400 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
1e502d2a10
commit
3864eb828b
5 changed files with 37 additions and 42 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
Thu Nov 13 21:45:13 2014 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
|
* test/openssl: Don't specify port number.
|
||||||
|
|
||||||
Thu Nov 13 21:22:35 2014 Tanaka Akira <akr@fsij.org>
|
Thu Nov 13 21:22:35 2014 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
* test/openssl/ssl_server.rb: Unused file removed.
|
* test/openssl/ssl_server.rb: Unused file removed.
|
||||||
|
|
|
@ -4,9 +4,7 @@ if defined?(OpenSSL)
|
||||||
|
|
||||||
class OpenSSL::TestPartialRecordRead < OpenSSL::SSLTestCase
|
class OpenSSL::TestPartialRecordRead < OpenSSL::SSLTestCase
|
||||||
def test_partial_tls_record_read_nonblock
|
def test_partial_tls_record_read_nonblock
|
||||||
port = 12345
|
start_server(OpenSSL::SSL::VERIFY_NONE, true, :server_proc =>
|
||||||
|
|
||||||
start_server(port, OpenSSL::SSL::VERIFY_NONE, true, :server_proc =>
|
|
||||||
Proc.new do |server_ctx, server_ssl|
|
Proc.new do |server_ctx, server_ssl|
|
||||||
begin
|
begin
|
||||||
server_ssl.io.write("\x01") # the beginning of a TLS record
|
server_ssl.io.write("\x01") # the beginning of a TLS record
|
||||||
|
|
|
@ -34,7 +34,7 @@ class OpenSSL::TestSSL < OpenSSL::SSLTestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_ssl_gets
|
def test_ssl_gets
|
||||||
start_server(PORT, OpenSSL::SSL::VERIFY_NONE, true) { |server, port|
|
start_server(OpenSSL::SSL::VERIFY_NONE, true) { |server, port|
|
||||||
server_connect(port) { |ssl|
|
server_connect(port) { |ssl|
|
||||||
ssl.write "abc\n"
|
ssl.write "abc\n"
|
||||||
IO.select [ssl]
|
IO.select [ssl]
|
||||||
|
@ -48,7 +48,7 @@ class OpenSSL::TestSSL < OpenSSL::SSLTestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_ssl_read_nonblock
|
def test_ssl_read_nonblock
|
||||||
start_server(PORT, OpenSSL::SSL::VERIFY_NONE, true) { |server, port|
|
start_server(OpenSSL::SSL::VERIFY_NONE, true) { |server, port|
|
||||||
server_connect(port) { |ssl|
|
server_connect(port) { |ssl|
|
||||||
assert_raise(IO::WaitReadable) { ssl.read_nonblock(100) }
|
assert_raise(IO::WaitReadable) { ssl.read_nonblock(100) }
|
||||||
ssl.write("abc\n")
|
ssl.write("abc\n")
|
||||||
|
@ -61,7 +61,7 @@ class OpenSSL::TestSSL < OpenSSL::SSLTestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_connect_and_close
|
def test_connect_and_close
|
||||||
start_server(PORT, OpenSSL::SSL::VERIFY_NONE, true){|server, port|
|
start_server(OpenSSL::SSL::VERIFY_NONE, true){|server, port|
|
||||||
sock = TCPSocket.new("127.0.0.1", port)
|
sock = TCPSocket.new("127.0.0.1", port)
|
||||||
ssl = OpenSSL::SSL::SSLSocket.new(sock)
|
ssl = OpenSSL::SSL::SSLSocket.new(sock)
|
||||||
assert(ssl.connect)
|
assert(ssl.connect)
|
||||||
|
@ -79,7 +79,7 @@ class OpenSSL::TestSSL < OpenSSL::SSLTestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_read_and_write
|
def test_read_and_write
|
||||||
start_server(PORT, OpenSSL::SSL::VERIFY_NONE, true){|server, port|
|
start_server(OpenSSL::SSL::VERIFY_NONE, true){|server, port|
|
||||||
server_connect(port) { |ssl|
|
server_connect(port) { |ssl|
|
||||||
# syswrite and sysread
|
# syswrite and sysread
|
||||||
ITERATIONS.times{|i|
|
ITERATIONS.times{|i|
|
||||||
|
@ -128,7 +128,7 @@ class OpenSSL::TestSSL < OpenSSL::SSLTestCase
|
||||||
|
|
||||||
def test_client_auth_failure
|
def test_client_auth_failure
|
||||||
vflag = OpenSSL::SSL::VERIFY_PEER|OpenSSL::SSL::VERIFY_FAIL_IF_NO_PEER_CERT
|
vflag = OpenSSL::SSL::VERIFY_PEER|OpenSSL::SSL::VERIFY_FAIL_IF_NO_PEER_CERT
|
||||||
start_server(PORT, vflag, true, :ignore_listener_error => true){|server, port|
|
start_server(vflag, true, :ignore_listener_error => true){|server, port|
|
||||||
assert_raise(OpenSSL::SSL::SSLError, Errno::ECONNRESET){
|
assert_raise(OpenSSL::SSL::SSLError, Errno::ECONNRESET){
|
||||||
sock = TCPSocket.new("127.0.0.1", port)
|
sock = TCPSocket.new("127.0.0.1", port)
|
||||||
ssl = OpenSSL::SSL::SSLSocket.new(sock)
|
ssl = OpenSSL::SSL::SSLSocket.new(sock)
|
||||||
|
@ -144,7 +144,7 @@ class OpenSSL::TestSSL < OpenSSL::SSLTestCase
|
||||||
|
|
||||||
def test_client_auth_success
|
def test_client_auth_success
|
||||||
vflag = OpenSSL::SSL::VERIFY_PEER|OpenSSL::SSL::VERIFY_FAIL_IF_NO_PEER_CERT
|
vflag = OpenSSL::SSL::VERIFY_PEER|OpenSSL::SSL::VERIFY_FAIL_IF_NO_PEER_CERT
|
||||||
start_server(PORT, vflag, true){|server, port|
|
start_server(vflag, true){|server, port|
|
||||||
ctx = OpenSSL::SSL::SSLContext.new
|
ctx = OpenSSL::SSL::SSLContext.new
|
||||||
ctx.key = @cli_key
|
ctx.key = @cli_key
|
||||||
ctx.cert = @cli_cert
|
ctx.cert = @cli_cert
|
||||||
|
@ -175,7 +175,7 @@ class OpenSSL::TestSSL < OpenSSL::SSLTestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
vflag = OpenSSL::SSL::VERIFY_PEER|OpenSSL::SSL::VERIFY_FAIL_IF_NO_PEER_CERT
|
vflag = OpenSSL::SSL::VERIFY_PEER|OpenSSL::SSL::VERIFY_FAIL_IF_NO_PEER_CERT
|
||||||
start_server(PORT, vflag, true, :ctx_proc => ctx_proc){|server, port|
|
start_server(vflag, true, :ctx_proc => ctx_proc){|server, port|
|
||||||
ctx = OpenSSL::SSL::SSLContext.new
|
ctx = OpenSSL::SSL::SSLContext.new
|
||||||
client_ca_from_server = nil
|
client_ca_from_server = nil
|
||||||
ctx.client_cert_cb = Proc.new do |sslconn|
|
ctx.client_cert_cb = Proc.new do |sslconn|
|
||||||
|
@ -188,7 +188,7 @@ class OpenSSL::TestSSL < OpenSSL::SSLTestCase
|
||||||
|
|
||||||
def test_read_nonblock_without_session
|
def test_read_nonblock_without_session
|
||||||
OpenSSL::TestUtils.silent do
|
OpenSSL::TestUtils.silent do
|
||||||
start_server(PORT, OpenSSL::SSL::VERIFY_NONE, false){|server, port|
|
start_server(OpenSSL::SSL::VERIFY_NONE, false){|server, port|
|
||||||
sock = TCPSocket.new("127.0.0.1", port)
|
sock = TCPSocket.new("127.0.0.1", port)
|
||||||
ssl = OpenSSL::SSL::SSLSocket.new(sock)
|
ssl = OpenSSL::SSL::SSLSocket.new(sock)
|
||||||
ssl.sync_close = true
|
ssl.sync_close = true
|
||||||
|
@ -206,7 +206,7 @@ class OpenSSL::TestSSL < OpenSSL::SSLTestCase
|
||||||
|
|
||||||
def test_starttls
|
def test_starttls
|
||||||
OpenSSL::TestUtils.silent do
|
OpenSSL::TestUtils.silent do
|
||||||
start_server(PORT, OpenSSL::SSL::VERIFY_NONE, false){|server, port|
|
start_server(OpenSSL::SSL::VERIFY_NONE, false){|server, port|
|
||||||
sock = TCPSocket.new("127.0.0.1", port)
|
sock = TCPSocket.new("127.0.0.1", port)
|
||||||
ssl = OpenSSL::SSL::SSLSocket.new(sock)
|
ssl = OpenSSL::SSL::SSLSocket.new(sock)
|
||||||
ssl.sync_close = true
|
ssl.sync_close = true
|
||||||
|
@ -230,7 +230,7 @@ class OpenSSL::TestSSL < OpenSSL::SSLTestCase
|
||||||
|
|
||||||
def test_parallel
|
def test_parallel
|
||||||
GC.start
|
GC.start
|
||||||
start_server(PORT, OpenSSL::SSL::VERIFY_NONE, true){|server, port|
|
start_server(OpenSSL::SSL::VERIFY_NONE, true){|server, port|
|
||||||
ssls = []
|
ssls = []
|
||||||
10.times{
|
10.times{
|
||||||
sock = TCPSocket.new("127.0.0.1", port)
|
sock = TCPSocket.new("127.0.0.1", port)
|
||||||
|
@ -251,7 +251,7 @@ class OpenSSL::TestSSL < OpenSSL::SSLTestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_verify_result
|
def test_verify_result
|
||||||
start_server(PORT, OpenSSL::SSL::VERIFY_NONE, true, :ignore_listener_error => true){|server, port|
|
start_server(OpenSSL::SSL::VERIFY_NONE, true, :ignore_listener_error => true){|server, port|
|
||||||
sock = TCPSocket.new("127.0.0.1", port)
|
sock = TCPSocket.new("127.0.0.1", port)
|
||||||
ctx = OpenSSL::SSL::SSLContext.new
|
ctx = OpenSSL::SSL::SSLContext.new
|
||||||
ctx.set_params
|
ctx.set_params
|
||||||
|
@ -265,7 +265,7 @@ class OpenSSL::TestSSL < OpenSSL::SSLTestCase
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
start_server(PORT, OpenSSL::SSL::VERIFY_NONE, true){|server, port|
|
start_server(OpenSSL::SSL::VERIFY_NONE, true){|server, port|
|
||||||
sock = TCPSocket.new("127.0.0.1", port)
|
sock = TCPSocket.new("127.0.0.1", port)
|
||||||
ctx = OpenSSL::SSL::SSLContext.new
|
ctx = OpenSSL::SSL::SSLContext.new
|
||||||
ctx.set_params(
|
ctx.set_params(
|
||||||
|
@ -284,7 +284,7 @@ class OpenSSL::TestSSL < OpenSSL::SSLTestCase
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
start_server(PORT, OpenSSL::SSL::VERIFY_NONE, true, :ignore_listener_error => true){|server, port|
|
start_server(OpenSSL::SSL::VERIFY_NONE, true, :ignore_listener_error => true){|server, port|
|
||||||
sock = TCPSocket.new("127.0.0.1", port)
|
sock = TCPSocket.new("127.0.0.1", port)
|
||||||
ctx = OpenSSL::SSL::SSLContext.new
|
ctx = OpenSSL::SSL::SSLContext.new
|
||||||
ctx.set_params(
|
ctx.set_params(
|
||||||
|
@ -305,7 +305,7 @@ class OpenSSL::TestSSL < OpenSSL::SSLTestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_exception_in_verify_callback_is_ignored
|
def test_exception_in_verify_callback_is_ignored
|
||||||
start_server(PORT, OpenSSL::SSL::VERIFY_NONE, true, :ignore_listener_error => true){|server, port|
|
start_server(OpenSSL::SSL::VERIFY_NONE, true, :ignore_listener_error => true){|server, port|
|
||||||
sock = TCPSocket.new("127.0.0.1", port)
|
sock = TCPSocket.new("127.0.0.1", port)
|
||||||
ctx = OpenSSL::SSL::SSLContext.new
|
ctx = OpenSSL::SSL::SSLContext.new
|
||||||
ctx.set_params(
|
ctx.set_params(
|
||||||
|
@ -329,7 +329,7 @@ class OpenSSL::TestSSL < OpenSSL::SSLTestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_sslctx_set_params
|
def test_sslctx_set_params
|
||||||
start_server(PORT, OpenSSL::SSL::VERIFY_NONE, true, :ignore_listener_error => true){|server, port|
|
start_server(OpenSSL::SSL::VERIFY_NONE, true, :ignore_listener_error => true){|server, port|
|
||||||
sock = TCPSocket.new("127.0.0.1", port)
|
sock = TCPSocket.new("127.0.0.1", port)
|
||||||
ctx = OpenSSL::SSL::SSLContext.new
|
ctx = OpenSSL::SSL::SSLContext.new
|
||||||
ctx.set_params
|
ctx.set_params
|
||||||
|
@ -354,7 +354,7 @@ class OpenSSL::TestSSL < OpenSSL::SSLTestCase
|
||||||
def test_post_connection_check
|
def test_post_connection_check
|
||||||
sslerr = OpenSSL::SSL::SSLError
|
sslerr = OpenSSL::SSL::SSLError
|
||||||
|
|
||||||
start_server(PORT, OpenSSL::SSL::VERIFY_NONE, true){|server, port|
|
start_server(OpenSSL::SSL::VERIFY_NONE, true){|server, port|
|
||||||
server_connect(port) { |ssl|
|
server_connect(port) { |ssl|
|
||||||
assert_raise(sslerr){ssl.post_connection_check("localhost.localdomain")}
|
assert_raise(sslerr){ssl.post_connection_check("localhost.localdomain")}
|
||||||
assert_raise(sslerr){ssl.post_connection_check("127.0.0.1")}
|
assert_raise(sslerr){ssl.post_connection_check("127.0.0.1")}
|
||||||
|
@ -377,7 +377,7 @@ class OpenSSL::TestSSL < OpenSSL::SSLTestCase
|
||||||
]
|
]
|
||||||
@svr_cert = issue_cert(@svr, @svr_key, 4, now, now+1800, exts,
|
@svr_cert = issue_cert(@svr, @svr_key, 4, now, now+1800, exts,
|
||||||
@ca_cert, @ca_key, OpenSSL::Digest::SHA1.new)
|
@ca_cert, @ca_key, OpenSSL::Digest::SHA1.new)
|
||||||
start_server(PORT, OpenSSL::SSL::VERIFY_NONE, true){|server, port|
|
start_server(OpenSSL::SSL::VERIFY_NONE, true){|server, port|
|
||||||
server_connect(port) { |ssl|
|
server_connect(port) { |ssl|
|
||||||
assert(ssl.post_connection_check("localhost.localdomain"))
|
assert(ssl.post_connection_check("localhost.localdomain"))
|
||||||
assert(ssl.post_connection_check("127.0.0.1"))
|
assert(ssl.post_connection_check("127.0.0.1"))
|
||||||
|
@ -399,7 +399,7 @@ class OpenSSL::TestSSL < OpenSSL::SSLTestCase
|
||||||
]
|
]
|
||||||
@svr_cert = issue_cert(@svr, @svr_key, 5, now, now+1800, exts,
|
@svr_cert = issue_cert(@svr, @svr_key, 5, now, now+1800, exts,
|
||||||
@ca_cert, @ca_key, OpenSSL::Digest::SHA1.new)
|
@ca_cert, @ca_key, OpenSSL::Digest::SHA1.new)
|
||||||
start_server(PORT, OpenSSL::SSL::VERIFY_NONE, true){|server, port|
|
start_server(OpenSSL::SSL::VERIFY_NONE, true){|server, port|
|
||||||
server_connect(port) { |ssl|
|
server_connect(port) { |ssl|
|
||||||
assert(ssl.post_connection_check("localhost.localdomain"))
|
assert(ssl.post_connection_check("localhost.localdomain"))
|
||||||
assert_raise(sslerr){ssl.post_connection_check("127.0.0.1")}
|
assert_raise(sslerr){ssl.post_connection_check("127.0.0.1")}
|
||||||
|
@ -465,7 +465,7 @@ class OpenSSL::TestSSL < OpenSSL::SSLTestCase
|
||||||
readwrite_loop(ctx, ssl)
|
readwrite_loop(ctx, ssl)
|
||||||
end
|
end
|
||||||
|
|
||||||
start_server(PORT, OpenSSL::SSL::VERIFY_NONE, true, :ctx_proc => ctx_proc, :server_proc => server_proc) do |server, port|
|
start_server(OpenSSL::SSL::VERIFY_NONE, true, :ctx_proc => ctx_proc, :server_proc => server_proc) do |server, port|
|
||||||
2.times do |i|
|
2.times do |i|
|
||||||
ctx = OpenSSL::SSL::SSLContext.new
|
ctx = OpenSSL::SSL::SSLContext.new
|
||||||
if defined?(OpenSSL::SSL::OP_NO_TICKET)
|
if defined?(OpenSSL::SSL::OP_NO_TICKET)
|
||||||
|
@ -498,7 +498,7 @@ class OpenSSL::TestSSL < OpenSSL::SSLTestCase
|
||||||
assert_equal(num_written, raw_size)
|
assert_equal(num_written, raw_size)
|
||||||
ssl.close
|
ssl.close
|
||||||
}
|
}
|
||||||
start_server(PORT, OpenSSL::SSL::VERIFY_NONE, true, :server_proc => server_proc){|server, port|
|
start_server(OpenSSL::SSL::VERIFY_NONE, true, :server_proc => server_proc){|server, port|
|
||||||
server_connect(port) { |ssl|
|
server_connect(port) { |ssl|
|
||||||
str = auml * i
|
str = auml * i
|
||||||
num_written = ssl.write(str)
|
num_written = ssl.write(str)
|
||||||
|
@ -514,7 +514,7 @@ class OpenSSL::TestSSL < OpenSSL::SSLTestCase
|
||||||
# But it also degrades gracefully, so keep it
|
# But it also degrades gracefully, so keep it
|
||||||
ctx.options = OpenSSL::SSL::OP_ALL
|
ctx.options = OpenSSL::SSL::OP_ALL
|
||||||
}
|
}
|
||||||
start_server(PORT, OpenSSL::SSL::VERIFY_NONE, true, :ctx_proc => ctx_proc){|server, port|
|
start_server(OpenSSL::SSL::VERIFY_NONE, true, :ctx_proc => ctx_proc){|server, port|
|
||||||
server_connect(port) { |ssl|
|
server_connect(port) { |ssl|
|
||||||
ssl.puts('hello')
|
ssl.puts('hello')
|
||||||
assert_equal("hello\n", ssl.gets)
|
assert_equal("hello\n", ssl.gets)
|
||||||
|
@ -700,7 +700,7 @@ end
|
||||||
|
|
||||||
def test_invalid_shutdown_by_gc
|
def test_invalid_shutdown_by_gc
|
||||||
assert_nothing_raised {
|
assert_nothing_raised {
|
||||||
start_server(PORT, OpenSSL::SSL::VERIFY_NONE, true){|server, port|
|
start_server(OpenSSL::SSL::VERIFY_NONE, true){|server, port|
|
||||||
10.times {
|
10.times {
|
||||||
sock = TCPSocket.new("127.0.0.1", port)
|
sock = TCPSocket.new("127.0.0.1", port)
|
||||||
ssl = OpenSSL::SSL::SSLSocket.new(sock)
|
ssl = OpenSSL::SSL::SSLSocket.new(sock)
|
||||||
|
@ -713,7 +713,7 @@ end
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_close_after_socket_close
|
def test_close_after_socket_close
|
||||||
start_server(PORT, OpenSSL::SSL::VERIFY_NONE, true){|server, port|
|
start_server(OpenSSL::SSL::VERIFY_NONE, true){|server, port|
|
||||||
sock = TCPSocket.new("127.0.0.1", port)
|
sock = TCPSocket.new("127.0.0.1", port)
|
||||||
ssl = OpenSSL::SSL::SSLSocket.new(sock)
|
ssl = OpenSSL::SSL::SSLSocket.new(sock)
|
||||||
ssl.sync_close = true
|
ssl.sync_close = true
|
||||||
|
@ -742,7 +742,6 @@ end
|
||||||
ctx_proc.call(ctx) if ctx_proc
|
ctx_proc.call(ctx) if ctx_proc
|
||||||
}
|
}
|
||||||
start_server(
|
start_server(
|
||||||
PORT,
|
|
||||||
OpenSSL::SSL::VERIFY_NONE,
|
OpenSSL::SSL::VERIFY_NONE,
|
||||||
true,
|
true,
|
||||||
:ctx_proc => ctx_wrap,
|
:ctx_proc => ctx_wrap,
|
||||||
|
|
|
@ -26,7 +26,7 @@ tddwpBAEDjcwMzA5NTYzMTU1MzAwpQMCARM=
|
||||||
-----END SSL SESSION PARAMETERS-----
|
-----END SSL SESSION PARAMETERS-----
|
||||||
SESSION
|
SESSION
|
||||||
|
|
||||||
start_server(PORT, OpenSSL::SSL::VERIFY_NONE, true, :ignore_listener_error => true) { |_, port|
|
start_server(OpenSSL::SSL::VERIFY_NONE, true, :ignore_listener_error => true) { |_, port|
|
||||||
ctx = OpenSSL::SSL::SSLContext.new
|
ctx = OpenSSL::SSL::SSLContext.new
|
||||||
ctx.session_cache_mode = OpenSSL::SSL::SSLContext::SESSION_CACHE_CLIENT
|
ctx.session_cache_mode = OpenSSL::SSL::SSLContext::SESSION_CACHE_CLIENT
|
||||||
ctx.session_id_context = self.object_id.to_s
|
ctx.session_id_context = self.object_id.to_s
|
||||||
|
@ -45,7 +45,7 @@ tddwpBAEDjcwMzA5NTYzMTU1MzAwpQMCARM=
|
||||||
|
|
||||||
def test_session
|
def test_session
|
||||||
timeout(5) do
|
timeout(5) do
|
||||||
start_server(PORT, OpenSSL::SSL::VERIFY_NONE, true) do |server, port|
|
start_server(OpenSSL::SSL::VERIFY_NONE, true) do |server, port|
|
||||||
sock = TCPSocket.new("127.0.0.1", port)
|
sock = TCPSocket.new("127.0.0.1", port)
|
||||||
ctx = OpenSSL::SSL::SSLContext.new("TLSv1")
|
ctx = OpenSSL::SSL::SSLContext.new("TLSv1")
|
||||||
ssl = OpenSSL::SSL::SSLSocket.new(sock, ctx)
|
ssl = OpenSSL::SSL::SSLSocket.new(sock, ctx)
|
||||||
|
@ -156,7 +156,7 @@ __EOS__
|
||||||
|
|
||||||
def test_client_session
|
def test_client_session
|
||||||
last_session = nil
|
last_session = nil
|
||||||
start_server(PORT, OpenSSL::SSL::VERIFY_NONE, true) do |server, port|
|
start_server(OpenSSL::SSL::VERIFY_NONE, true) do |server, port|
|
||||||
2.times do
|
2.times do
|
||||||
sock = TCPSocket.new("127.0.0.1", port)
|
sock = TCPSocket.new("127.0.0.1", port)
|
||||||
# Debian's openssl 0.9.8g-13 failed at assert(ssl.session_reused?),
|
# Debian's openssl 0.9.8g-13 failed at assert(ssl.session_reused?),
|
||||||
|
@ -242,7 +242,7 @@ __EOS__
|
||||||
end
|
end
|
||||||
|
|
||||||
first_session = nil
|
first_session = nil
|
||||||
start_server(PORT, OpenSSL::SSL::VERIFY_NONE, true, :ctx_proc => ctx_proc, :server_proc => server_proc) do |server, port|
|
start_server(OpenSSL::SSL::VERIFY_NONE, true, :ctx_proc => ctx_proc, :server_proc => server_proc) do |server, port|
|
||||||
10.times do |i|
|
10.times do |i|
|
||||||
sock = TCPSocket.new("127.0.0.1", port)
|
sock = TCPSocket.new("127.0.0.1", port)
|
||||||
ctx = OpenSSL::SSL::SSLContext.new
|
ctx = OpenSSL::SSL::SSLContext.new
|
||||||
|
@ -292,7 +292,7 @@ __EOS__
|
||||||
# any resulting value is OK (ignored)
|
# any resulting value is OK (ignored)
|
||||||
}
|
}
|
||||||
|
|
||||||
start_server(PORT, OpenSSL::SSL::VERIFY_NONE, true) do |server, port|
|
start_server(OpenSSL::SSL::VERIFY_NONE, true) do |server, port|
|
||||||
sock = TCPSocket.new("127.0.0.1", port)
|
sock = TCPSocket.new("127.0.0.1", port)
|
||||||
begin
|
begin
|
||||||
ssl = OpenSSL::SSL::SSLSocket.new(sock, ctx)
|
ssl = OpenSSL::SSL::SSLSocket.new(sock, ctx)
|
||||||
|
@ -350,7 +350,7 @@ __EOS__
|
||||||
c.session_cache_stats
|
c.session_cache_stats
|
||||||
readwrite_loop(c, ssl)
|
readwrite_loop(c, ssl)
|
||||||
}
|
}
|
||||||
start_server(PORT, OpenSSL::SSL::VERIFY_NONE, true, :ctx_proc => ctx_proc, :server_proc => server_proc) do |server, port|
|
start_server(OpenSSL::SSL::VERIFY_NONE, true, :ctx_proc => ctx_proc, :server_proc => server_proc) do |server, port|
|
||||||
last_client_session = nil
|
last_client_session = nil
|
||||||
3.times do
|
3.times do
|
||||||
sock = TCPSocket.new("127.0.0.1", port)
|
sock = TCPSocket.new("127.0.0.1", port)
|
||||||
|
|
|
@ -190,7 +190,6 @@ AQjjxMXhwULlmuR/K+WwlaZPiLIBYalLAZQ7ZbOPeVkJ8ePao0eLAgEC
|
||||||
|
|
||||||
class OpenSSL::SSLTestCase < Test::Unit::TestCase
|
class OpenSSL::SSLTestCase < Test::Unit::TestCase
|
||||||
RUBY = EnvUtil.rubybin
|
RUBY = EnvUtil.rubybin
|
||||||
PORT = 20443
|
|
||||||
ITERATIONS = ($0 == __FILE__) ? 100 : 10
|
ITERATIONS = ($0 == __FILE__) ? 100 : 10
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
|
@ -267,7 +266,7 @@ AQjjxMXhwULlmuR/K+WwlaZPiLIBYalLAZQ7ZbOPeVkJ8ePao0eLAgEC
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def start_server(port0, verify_mode, start_immediately, args = {}, &block)
|
def start_server(verify_mode, start_immediately, args = {}, &block)
|
||||||
IO.pipe {|stop_pipe_r, stop_pipe_w|
|
IO.pipe {|stop_pipe_r, stop_pipe_w|
|
||||||
ctx_proc = args[:ctx_proc]
|
ctx_proc = args[:ctx_proc]
|
||||||
server_proc = args[:server_proc]
|
server_proc = args[:server_proc]
|
||||||
|
@ -288,13 +287,8 @@ AQjjxMXhwULlmuR/K+WwlaZPiLIBYalLAZQ7ZbOPeVkJ8ePao0eLAgEC
|
||||||
|
|
||||||
Socket.do_not_reverse_lookup = true
|
Socket.do_not_reverse_lookup = true
|
||||||
tcps = nil
|
tcps = nil
|
||||||
port = port0
|
tcps = TCPServer.new("127.0.0.1", 0)
|
||||||
begin
|
port = tcps.connect_address.ip_port
|
||||||
tcps = TCPServer.new("127.0.0.1", port)
|
|
||||||
rescue Errno::EADDRINUSE
|
|
||||||
port += 1
|
|
||||||
retry
|
|
||||||
end
|
|
||||||
|
|
||||||
ssls = OpenSSL::SSL::SSLServer.new(tcps, ctx)
|
ssls = OpenSSL::SSL::SSLServer.new(tcps, ctx)
|
||||||
ssls.start_immediately = start_immediately
|
ssls.start_immediately = start_immediately
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue