vendor/bundle/ruby/2.7.0/gems/faraday-1.3.0/lib/faraday/adapter/em_http.rb
# Options is a module containing helpers to convert the Faraday env object
# into options hashes for EMHTTP method calls.
Options is a module containing helpers to convert the Faraday env object
into options hashes for EMHTTP method calls.
Options is a module containing helpers to convert the Faraday env object into options hashes for EMHTTP method calls .
def perform_request(env)
        if parallel?(env)
          manager = env[:parallel_manager]
          manager.add do
            perform_single_request(env)
              .callback { env[:response].finish(env) }
          end
        elsif EventMachine.reactor_running?
          env[:parallel_manager] = true
          perform_single_request(env)
            .callback { env[:response].finish(env) }
            .errback do
              raise NotImplementedError
            end
        else
          error = nil
          EventMachine.run do
            perform_single_request(env)
              .callback { EventMachine.stop }
              .errback do |client|
                error = error_message(client)
                EventMachine.stop
              end
          end
          raise_error(error) if error
        end
      rescue EventMachine::Connectify::CONNECTError => e
        if e.message.include?('Proxy Authentication Required')
          raise Faraday::ConnectionFailed,
                %(407 "Proxy Authentication Required ")
        end
        raise Faraday::ConnectionFailed, e
      rescue StandardError => e
        if defined?(::OpenSSL::SSL::SSLError) && \
           e.is_a?(::OpenSSL::SSL::SSLError)
          raise Faraday::SSLError, e
        end
        raise
      end
def perform_request ( env ) if parallel? ( env ) manager = env [ :parallel_manager ] manager . add do perform_single_request ( env ) . callback { env [ :response ] . finish ( env ) } end elsif EventMachine . reactor_running? env [ :parallel_manager ] = true perform_single_request ( env ) . callback { env [ :response ] . finish ( env ) } . errback do raise NotImplementedError end else error = nil EventMachine . run do perform_single_request ( env ) . callback { EventMachine . stop } . errback do | client | error = error_message ( client ) EventMachine . stop end end raise_error ( error ) if error end rescue EventMachine :: Connectify :: CONNECTError => e if e . message . include? ( 'Proxy Authentication Required' ) raise Faraday :: ConnectionFailed , %(407 "Proxy Authentication Required ") end raise Faraday :: ConnectionFailed , e rescue StandardError => e if defined? ( :: OpenSSL :: SSL :: SSLError ) && e . is_a? ( :: OpenSSL :: SSL :: SSLError ) raise Faraday :: SSLError , e end raise end
Options is a module containing helpers to convert the Faraday env object
into options hashes for EMHTTP method calls.
Options is a module containing helpers to convert the Faraday env object into options hashes for EMHTTP method calls .
# EM is running: instruct upstream that this is an async request # TODO: no way to communicate the error in async mode # start EM, block until request is completed
env
<not_specific>