File tree Expand file tree Collapse file tree 2 files changed +13
-7
lines changed Expand file tree Collapse file tree 2 files changed +13
-7
lines changed Original file line number Diff line number Diff line change @@ -1051,10 +1051,14 @@ def connect
10511051 end
10521052 end
10531053 @ssl_context . set_params ( ssl_parameters )
1054- @ssl_context . session_cache_mode =
1055- OpenSSL ::SSL ::SSLContext ::SESSION_CACHE_CLIENT |
1056- OpenSSL ::SSL ::SSLContext ::SESSION_CACHE_NO_INTERNAL_STORE
1057- @ssl_context . session_new_cb = proc { |sock , sess | @ssl_session = sess }
1054+ unless @ssl_context . session_cache_mode . nil? # a dummy method on JRuby
1055+ @ssl_context . session_cache_mode =
1056+ OpenSSL ::SSL ::SSLContext ::SESSION_CACHE_CLIENT |
1057+ OpenSSL ::SSL ::SSLContext ::SESSION_CACHE_NO_INTERNAL_STORE
1058+ end
1059+ if @ssl_context . respond_to? ( :session_new_cb ) # not implemented under JRuby
1060+ @ssl_context . session_new_cb = proc { |sock , sess | @ssl_session = sess }
1061+ end
10581062
10591063 # Still do the post_connection_check below even if connecting
10601064 # to IP address
Original file line number Diff line number Diff line change @@ -152,12 +152,14 @@ def test_session_reuse
152152 end
153153
154154 http . start
155- assert_equal false , http . instance_variable_get ( :@socket ) . io . session_reused?
155+ session_reused = http . instance_variable_get ( :@socket ) . io . session_reused?
156+ assert_false session_reused unless session_reused . nil? # can not detect re-use under JRuby
156157 http . get ( "/" )
157158 http . finish
158159
159160 http . start
160- assert_equal true , http . instance_variable_get ( :@socket ) . io . session_reused?
161+ session_reused = http . instance_variable_get ( :@socket ) . io . session_reused?
162+ assert_true session_reused unless session_reused . nil? # can not detect re-use under JRuby
161163 assert_equal $test_net_http_data, http . get ( "/" ) . body
162164 http . finish
163165 end
@@ -301,7 +303,7 @@ def test_max_version
301303 ex = assert_raise ( OpenSSL ::SSL ::SSLError ) {
302304 http . request_get ( "/" ) { |res | }
303305 }
304- re_msg = /\A SSL_connect returned=1 errno=0 |SSL_CTX_set_max_proto_version/
306+ re_msg = /\A SSL_connect returned=1 errno=0 |SSL_CTX_set_max_proto_version|No appropriate protocol /
305307 assert_match ( re_msg , ex . message )
306308 end
307309
You can’t perform that action at this time.
0 commit comments