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
1051
1051
end
1052
1052
end
1053
1053
@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
1058
1062
1059
1063
# Still do the post_connection_check below even if connecting
1060
1064
# to IP address
Original file line number Diff line number Diff line change @@ -152,12 +152,14 @@ def test_session_reuse
152
152
end
153
153
154
154
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
156
157
http . get ( "/" )
157
158
http . finish
158
159
159
160
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
161
163
assert_equal $test_net_http_data, http . get ( "/" ) . body
162
164
http . finish
163
165
end
@@ -301,7 +303,7 @@ def test_max_version
301
303
ex = assert_raise ( OpenSSL ::SSL ::SSLError ) {
302
304
http . request_get ( "/" ) { |res | }
303
305
}
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 /
305
307
assert_match ( re_msg , ex . message )
306
308
end
307
309
You can’t perform that action at this time.
0 commit comments