Class: HttpConnectionOptions

### Home Classes Methods

### In Files

- lib/em-http/http_connection_options.rb

### Parent

Object

### Methods

- ::new
- #connect_proxy?
- #http_proxy?
- #socks_proxy?

### Class/Module Index

Quicksearch

- EventMachine
- EventMachine::HTTPMethods
- EventMachine::HttpClient
- EventMachine::HttpClient::CookieJar
- EventMachine::HttpConnection
- EventMachine::HttpDecoders
- EventMachine::HttpDecoders::Base
- EventMachine::HttpDecoders::DecoderError
- EventMachine::HttpDecoders::Deflate
- EventMachine::HttpDecoders::GZip
- EventMachine::HttpDecoders::GZipHeader
- EventMachine::HttpEncoding
- EventMachine::HttpRequest
- EventMachine::HttpResponseHeader
- EventMachine::HttpStatus
- EventMachine::HttpStubConnection
- EventMachine::Middleware
- EventMachine::Middleware::DigestAuth
- EventMachine::Middleware::JSONResponse
- EventMachine::Middleware::OAuth
- EventMachine::Middleware::OAuth2
- EventMachine::MultiRequest
- HttpClientOptions
- HttpConnectionOptions
- String

No matching classes.

# HttpConnectionOptions

### Attributes

bind[R]
bind_port[R]
connect_timeout[R]
host[R]
inactivity_timeout[R]
port[R]
proxy[R]
tls[R]

### Public Class Methods

new(uri, options) click to toggle source

    # File lib/em-http/http_connection_options.rb, line 5
    def initialize(uri, options)
      @connect_timeout     = options[:connect_timeout] || 5        # default connection setup timeout
      @inactivity_timeout  = options[:inactivity_timeout] ||= 10   # default connection inactivity (post-setup) timeout

      @tls   = options[:tls] || options[:ssl] || {}
      @proxy = options[:proxy]

      if bind = options[:bind]
        @bind = bind[:host] || '0.0.0.0'

        # Eventmachine will open a UNIX socket if bind :port
        # is explicitly set to nil
        @bind_port = bind[:port]
      end

      uri = uri.kind_of?(Addressable::URI) ? uri : Addressable::URI::parse(uri.to_s)
      @https = uri.scheme == "https"
      uri.port ||= (@https ? 443 : 80)

      if proxy = options[:proxy]
        @host = proxy[:host]
        @port = proxy[:port]
      else
        @host = uri.host
        @port = uri.port
      end
    end

### Public Instance Methods

connect_proxy?() click to toggle source

    # File lib/em-http/http_connection_options.rb, line 37
    def connect_proxy?
      @proxy && (@proxy[:type] == :http || @proxy[:type].nil?) && @https
    end

http_proxy?() click to toggle source

    # File lib/em-http/http_connection_options.rb, line 33
    def http_proxy?
      @proxy && (@proxy[:type] == :http || @proxy[:type].nil?) && !@https
    end

socks_proxy?() click to toggle source

    # File lib/em-http/http_connection_options.rb, line 41
    def socks_proxy?
      @proxy && (@proxy[:type] == :socks5)
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.