Skip to content

Commit

Permalink
Check if OPENSSL_VERSION is defined in MiniSSL
Browse files Browse the repository at this point in the history
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 <matthew@trebex.net>
Co-Authored-By: Samuel Cochran <sj26@sj26.com>
  • Loading branch information
3 people committed Jul 3, 2020
1 parent a72c68b commit fa2b01b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/puma/minissl.rb
Expand Up @@ -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

Expand Down

0 comments on commit fa2b01b

Please sign in to comment.