Sha256: 31ed351353e31f39450ac53f39270861ad83a043faf193bcb6ee58b61c4bc05b
Contents?: true
Size: 1.04 KB
Versions: 1
Compression:
Stored size: 1.04 KB
Contents
class HttpConnectionOptions attr_reader :host, :port, :tls, :proxy, :bind, :bind_port attr_reader :connect_timeout, :inactivity_timeout 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) uri.port = (uri.scheme == "https" ? (uri.port || 443) : (uri.port || 80)) if proxy = options[:proxy] @host = proxy[:host] @port = proxy[:port] else @host = uri.host @port = uri.port end end def http_proxy?; @proxy && [nil, :http].include?(@proxy[:type]); end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
em-http-request-1.0.3 | lib/em-http/http_connection_options.rb |