From fa2b01b9a0169da858e11f8a8d65883a1da7a0c7 Mon Sep 17 00:00:00 2001 From: Juanito Fatas Date: Fri, 3 Jul 2020 16:06:22 +0900 Subject: [PATCH] Check if OPENSSL_VERSION is defined in MiniSSL For people who did not install from OpenSSL extension, Here https://github.com/puma/puma/blob/91e57f4e173343746e122e8bb850b0244f508484/ext/puma_http11/mini_ssl.c#L12 is false, and they hit SSLError https://github.com/puma/puma/blob/91e57f4e173343746e122e8bb850b0244f508484/ext/puma_http11/mini_ssl.c#L555-L562 Check if the OPENSSL_VERSION is defined to fix this. Co-Authored-By: Matthew Draper Co-Authored-By: Samuel Cochran --- lib/puma/minissl.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/puma/minissl.rb b/lib/puma/minissl.rb index 4d5c8d68ba..80390cf4c4 100644 --- a/lib/puma/minissl.rb +++ b/lib/puma/minissl.rb @@ -13,7 +13,7 @@ module MiniSSL # define constant at runtime, as it's easy to determine at built time, # but Puma could (it shouldn't) be loaded with an older OpenSSL version - HAS_TLS1_3 = !IS_JRUBY && + HAS_TLS1_3 = !IS_JRUBY && const_defined?(OPENSSL_VERSION) && (OPENSSL_VERSION[/ \d+\.\d+\.\d+/].split('.').map(&:to_i) <=> [1,1,1]) != -1 && (OPENSSL_LIBRARY_VERSION[/ \d+\.\d+\.\d+/].split('.').map(&:to_i) <=> [1,1,1]) !=-1