Class: Faraday::Adapter::NetHttpPersistent

### Home Classes Methods

### In Files

- lib/faraday/adapter/net_http_persistent.rb

### Parent

Faraday::Adapter::NetHttp

### Methods

- #configure_ssl
- #net_http_connection
- #perform_request

### Class/Module Index

Quicksearch

- Faraday
- Faraday::Adapter
- Faraday::Adapter::EMHttp
- Faraday::Adapter::EMHttp::Manager
- Faraday::Adapter::EMHttp::Options
- Faraday::Adapter::EMSynchrony
- Faraday::Adapter::EMSynchrony::ParallelManager
- Faraday::Adapter::Excon
- Faraday::Adapter::NetHttp
- Faraday::Adapter::NetHttpPersistent
- Faraday::Adapter::Parallelism
- Faraday::Adapter::Patron
- Faraday::Adapter::Rack
- Faraday::Adapter::Test
- Faraday::Adapter::Test::Stub
- Faraday::Adapter::Test::Stubs
- Faraday::Adapter::Test::Stubs::NotFound
- Faraday::Adapter::Typhoeus
- Faraday::AutoloadHelper
- Faraday::Builder
- Faraday::Builder::Handler
- Faraday::Builder::StackLocked
- Faraday::CompositeReadIO
- Faraday::Connection
- Faraday::Error
- Faraday::Error::ClientError
- Faraday::Error::ConnectionFailed
- Faraday::Error::MissingDependency
- Faraday::Error::ParsingError
- Faraday::Error::ResourceNotFound
- Faraday::Error::TimeoutError
- Faraday::Middleware
- Faraday::MiddlewareRegistry
- Faraday::Request
- Faraday::Request::Authorization
- Faraday::Request::BasicAuthentication
- Faraday::Request::Multipart
- Faraday::Request::Retry
- Faraday::Request::TokenAuthentication
- Faraday::Request::UrlEncoded
- Faraday::Response
- Faraday::Response::Logger
- Faraday::Response::Middleware
- Faraday::Response::RaiseError
- Faraday::Utils
- Faraday::Utils::Headers
- Faraday::Utils::ParamsHash
- Object

No matching classes.

# Faraday::Adapter::NetHttpPersistent

Experimental adapter for net-http-persistent

### Public Instance Methods

configure_ssl(http, ssl) click to toggle source

    # File lib/faraday/adapter/net_http_persistent.rb, line 36
    def configure_ssl(http, ssl)
      http.verify_mode  = ssl_verify_mode(ssl)
      http.cert_store   = ssl_cert_store(ssl)

      http.certificate  = ssl[:client_cert]  if ssl[:client_cert]
      http.private_key  = ssl[:client_key]   if ssl[:client_key]
      http.ca_file      = ssl[:ca_file]      if ssl[:ca_file]
      http.ssl_version  = ssl[:version]      if ssl[:version]
    end

net_http_connection(env) click to toggle source

    # File lib/faraday/adapter/net_http_persistent.rb, line 11
    def net_http_connection(env)
      if proxy = env[:request][:proxy]
        proxy_uri = ::URI::HTTP === proxy[:uri] ? proxy[:uri].dup : ::URI.parse(proxy[:uri].to_s)
        proxy_uri.user = proxy_uri.password = nil
        # awful patch for net-http-persistent 2.8 not unescaping user/password
        (class << proxy_uri; self; end).class_eval do
          define_method(:user) { proxy[:user] }
          define_method(:password) { proxy[:password] }
        end if proxy[:user]
      end
      Net::HTTP::Persistent.new 'Faraday', proxy_uri
    end

perform_request(http, env) click to toggle source

    # File lib/faraday/adapter/net_http_persistent.rb, line 24
    def perform_request(http, env)
      http.request env[:url], create_request(env)
    rescue Net::HTTP::Persistent::Error => error
      if error.message.include? 'Timeout'
        raise Faraday::Error::TimeoutError, error
      elsif error.message.include? 'connection refused'
        raise Faraday::Error::ConnectionFailed, error
      else
        raise
      end
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.