diff --git a/ext/puma_http11/mini_ssl.c b/ext/puma_http11/mini_ssl.c index b65712da..ee3d0d50 100644 --- a/ext/puma_http11/mini_ssl.c +++ b/ext/puma_http11/mini_ssl.c @@ -161,7 +161,7 @@ void raise_error(SSL* ssl, int result) { VALUE engine_read(VALUE self) { ms_conn* conn; char buf[512]; - int bytes, n; + int bytes, n, error; Data_Get_Struct(self, ms_conn, conn); @@ -173,7 +173,8 @@ VALUE engine_read(VALUE self) { if(SSL_want_read(conn->ssl)) return Qnil; - if(SSL_get_error(conn->ssl, bytes) == SSL_ERROR_ZERO_RETURN) { + error = SSL_get_error(conn->ssl, bytes); + if(error == SSL_ERROR_ZERO_RETURN || error == SSL_ERROR_SSL) { rb_eof_error(); } diff --git a/ext/puma_http11/org/jruby/puma/MiniSSL.java b/ext/puma_http11/org/jruby/puma/MiniSSL.java index e067c4e4..e89b9700 100644 --- a/ext/puma_http11/org/jruby/puma/MiniSSL.java +++ b/ext/puma_http11/org/jruby/puma/MiniSSL.java @@ -308,8 +308,10 @@ public class MiniSSL extends RubyObject { log("read(): end dump of request data <<<<\n"); return str; } catch (Exception e) { - e.printStackTrace(); - throw new RuntimeException(e); + if (DEBUG) { + e.printStackTrace(); + } + throw getRuntime().newEOFError(e.getMessage()); } } diff --git a/test/test_puma_server_ssl.rb b/test/test_puma_server_ssl.rb index e437df57..c81d63df 100644 --- a/test/test_puma_server_ssl.rb +++ b/test/test_puma_server_ssl.rb @@ -88,16 +88,16 @@ class TestPumaServerSSL < Test::Unit::TestCase assert_equal "https", body end - if defined?(JRUBY_VERSION) - def test_ssl_v3_support_disabled_by_default - @http.ssl_version='SSLv3' - assert_raises(OpenSSL::SSL::SSLError) do - @http.start do - Net::HTTP::Get.new '/' - end + def test_ssl_v3_rejection + @http.ssl_version='SSLv3' + assert_raises(OpenSSL::SSL::SSLError) do + @http.start do + Net::HTTP::Get.new '/' end end + end + if defined?(JRUBY_VERSION) def test_enabling_ssl_v3_support @server.stop(true) @ctx.enable_SSLv3 = true