diff options
author | George Claghorn <george@basecamp.com> | 2018-11-25 18:31:36 -0500 |
---|---|---|
committer | George Claghorn <george@basecamp.com> | 2018-11-25 18:34:13 -0500 |
commit | 9a3fb1f43be172618a710f0bb170586dc2475591 (patch) | |
tree | 28892cd5ed8be96d346f6f20ca7a152114fc7fd9 | |
parent | 148110e70c0a408ea418a8e36a6a99305fdd9c99 (diff) | |
download | rails-9a3fb1f43be172618a710f0bb170586dc2475591.tar.gz rails-9a3fb1f43be172618a710f0bb170586dc2475591.tar.bz2 rails-9a3fb1f43be172618a710f0bb170586dc2475591.zip |
Load OpenSSL only when it's used
-rw-r--r-- | lib/action_mailbox/postfix_relayer.rb | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/action_mailbox/postfix_relayer.rb b/lib/action_mailbox/postfix_relayer.rb index de4fdc06d0..ee18c8f6ba 100644 --- a/lib/action_mailbox/postfix_relayer.rb +++ b/lib/action_mailbox/postfix_relayer.rb @@ -2,7 +2,6 @@ require "net/http" require "uri" -require "openssl" module ActionMailbox class PostfixRelayer @@ -49,8 +48,12 @@ module ActionMailbox def client @client ||= Net::HTTP.new(uri.host, uri.port).tap do |connection| - connection.use_ssl = uri.scheme == "https" - connection.verify_mode = OpenSSL::SSL::VERIFY_PEER + if uri.scheme == "https" + require "openssl" + + connection.use_ssl = true + connection.verify_mode = OpenSSL::SSL::VERIFY_PEER + end connection.open_timeout = 1 connection.read_timeout = 10 |