Skip to content

Commit

Permalink
Update call to em_http_ssl_patch (#1202)
Browse files Browse the repository at this point in the history
  • Loading branch information
kylekeesling committed Nov 19, 2020
1 parent 1595e6f commit b766d1f
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 25 deletions.
29 changes: 17 additions & 12 deletions lib/faraday/adapter/em_http.rb
Expand Up @@ -90,7 +90,23 @@ def request_options(env)

include Options

dependency 'em-http'
dependency do
require 'em-http'

if Faraday::Adapter::EMHttp.loaded?
begin
require 'openssl'
rescue LoadError
warn 'Warning: no such file to load -- openssl. ' \
'Make sure it is installed if you want HTTPS support'
else
require 'em-http/version'
if EventMachine::HttpRequest::VERSION < '1.1.6'
require 'faraday/adapter/em_http_ssl_patch'
end
end
end
end

self.supports_parallel = true

Expand Down Expand Up @@ -273,14 +289,3 @@ def check_finished
end
end
end

if Faraday::Adapter::EMHttp.loaded?
begin
require 'openssl'
rescue LoadError
warn 'Warning: no such file to load -- openssl. ' \
'Make sure it is installed if you want HTTPS support'
else
require 'faraday/adapter/em_http_ssl_patch'
end
end
29 changes: 16 additions & 13 deletions lib/faraday/adapter/em_synchrony.rb
Expand Up @@ -12,6 +12,22 @@ class EMSynchrony < Faraday::Adapter
require 'em-synchrony/em-http'
require 'em-synchrony/em-multi'
require 'fiber'

require 'faraday/adapter/em_synchrony/parallel_manager'

if Faraday::Adapter::EMSynchrony.loaded?
begin
require 'openssl'
rescue LoadError
warn 'Warning: no such file to load -- openssl. ' \
'Make sure it is installed if you want HTTPS support'
else
require 'em-http/version'
if EventMachine::HttpRequest::VERSION < '1.1.6'
require 'faraday/adapter/em_http_ssl_patch'
end
end
end
end

self.supports_parallel = true
Expand Down Expand Up @@ -135,16 +151,3 @@ def call_block(block)
end
end
end

require 'faraday/adapter/em_synchrony/parallel_manager'

if Faraday::Adapter::EMSynchrony.loaded?
begin
require 'openssl'
rescue LoadError
warn 'Warning: no such file to load -- openssl. ' \
'Make sure it is installed if you want HTTPS support'
else
require 'faraday/adapter/em_http_ssl_patch'
end
end

0 comments on commit b766d1f

Please sign in to comment.