Class: HttpConnectionOptions
- Inherits:
-
Object
- Object
- HttpConnectionOptions
- Defined in:
- lib/em-http/http_connection_options.rb
Instance Attribute Summary collapse
-
#connect_timeout ⇒ Object
readonly
Returns the value of attribute connect_timeout.
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#inactivity_timeout ⇒ Object
readonly
Returns the value of attribute inactivity_timeout.
-
#port ⇒ Object
readonly
Returns the value of attribute port.
-
#proxy ⇒ Object
readonly
Returns the value of attribute proxy.
-
#tls ⇒ Object
readonly
Returns the value of attribute tls.
Instance Method Summary collapse
-
#initialize(uri, options) ⇒ HttpConnectionOptions
constructor
A new instance of HttpConnectionOptions.
Constructor Details
#initialize(uri, options) ⇒ HttpConnectionOptions
Returns a new instance of HttpConnectionOptions.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/em-http/http_connection_options.rb', line 5 def initialize(uri, ) @connect_timeout = [:connect_timeout] || 5 # default connection setup timeout @inactivity_timeout = [:inactivity_timeout] ||= 10 # default connection inactivity (post-setup) timeout @tls = [:tls] || [:ssl] || {} @proxy = [:proxy] 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 = [:proxy] @host = proxy[:host] @port = proxy[:port] else @host = uri.host @port = uri.port end end |
Instance Attribute Details
#connect_timeout ⇒ Object (readonly)
Returns the value of attribute connect_timeout.
3 4 5 |
# File 'lib/em-http/http_connection_options.rb', line 3 def connect_timeout @connect_timeout end |
#host ⇒ Object (readonly)
Returns the value of attribute host.
2 3 4 |
# File 'lib/em-http/http_connection_options.rb', line 2 def host @host end |
#inactivity_timeout ⇒ Object (readonly)
Returns the value of attribute inactivity_timeout.
3 4 5 |
# File 'lib/em-http/http_connection_options.rb', line 3 def inactivity_timeout @inactivity_timeout end |
#port ⇒ Object (readonly)
Returns the value of attribute port.
2 3 4 |
# File 'lib/em-http/http_connection_options.rb', line 2 def port @port end |
#proxy ⇒ Object (readonly)
Returns the value of attribute proxy.
2 3 4 |
# File 'lib/em-http/http_connection_options.rb', line 2 def proxy @proxy end |
#tls ⇒ Object (readonly)
Returns the value of attribute tls.
2 3 4 |
# File 'lib/em-http/http_connection_options.rb', line 2 def tls @tls end |