jruby-openssl icon indicating copy to clipboard operation
jruby-openssl copied to clipboard

verify_callback not being called during WEBRick HTTPS test

Open headius opened this issue 5 years ago • 1 comments

While working on jruby/jruby#6246 I found that the test_sni test in WEBrick's test_ssl.rb is failing because a verify_callback is not being called.

The assertion in question is here: https://github.com/ruby/webrick/blob/2c912ded39f2d3046203cde8b169dcf2c267017e/test/webrick/test_https.rb#L41

The callback is set just north of that line, and is intended to capture the subject. However since it never gets called, subject remains nil and the assertion fails.

headius avatar Jun 01 '20 23:06 headius

The test is easy to run:

$ ruby -Ilib -Itest/lib test/webrick/test_https.rb -n test_sni

And the error that results:

TestWEBrickHTTPS#test_sni [/Users/headius/projects/webrick/test/webrick/utils.rb:72]:
exceptions on 1 threads:
#<Thread:0x61f05988@/Users/headius/projects/webrick/test/webrick/utils.rb:65 dead>:
/Users/headius/projects/webrick/test/lib/minitest/unit.rb:201:in `assert': <"/CN=localhost"> expected but was
<nil>. (MiniTest::Assertion)
	from /Users/headius/projects/webrick/test/lib/test/unit/assertions.rb:37:in `assert'
	from /Users/headius/projects/webrick/test/lib/test/unit/assertions.rb:298:in `assert_equal'
	from test/webrick/test_https.rb:43:in `https_get'
	from test/webrick/test_https.rb:94:in `block in test_sni'
	from /Users/headius/projects/webrick/test/webrick/utils.rb:67:in `block in start_server'

Note that the assertion here must be commented out in order to see this failure, due to #201: https://github.com/ruby/webrick/blob/2c912ded39f2d3046203cde8b169dcf2c267017e/test/webrick/test_https.rb#L90

headius avatar Jun 01 '20 23:06 headius