Skip to content

Commit d0fac50

Browse files
committed
[test] avoid dup-ing SSLContext instance
1 parent 81df2a6 commit d0fac50

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/test/ruby/ssl/test_ssl.rb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -249,13 +249,15 @@ def test_renegotiation_cb
249249
def test_tlsext_hostname
250250
return unless OpenSSL::SSL::SSLSocket.instance_methods.include?(:hostname)
251251

252-
ctx_proc = Proc.new do |ctx, ssl|
253-
foo_ctx = ctx.dup
252+
fooctx = OpenSSL::SSL::SSLContext.new
253+
fooctx.cert = @cli_cert
254+
fooctx.key = @cli_key
254255

256+
ctx_proc = Proc.new do |ctx, ssl|
255257
ctx.servername_cb = Proc.new do |ssl2, hostname|
256258
case hostname
257259
when 'foo.example.com'
258-
foo_ctx
260+
fooctx
259261
when 'bar.example.com'
260262
nil
261263
else

0 commit comments

Comments
 (0)