Sha256: 0a656a1130183e25d3cc49776c2d2a05f13b7be789c4bfb2c579a25e13703ba2
Contents?: true
Size: 981 Bytes
Versions: 1
Compression:
Stored size: 981 Bytes
Contents
class HttpOptions attr_reader :uri, :method, :host, :port, :options def initialize(method, uri, options) uri.path = '/' if uri.path.empty? @options = options @method = method.to_s.upcase @uri = uri if proxy = options[:proxy] @host = proxy[:host] @port = proxy[:port] else # optional host for cases where you may have # pre-resolved the host, or you need an override @host = options.delete(:host) || uri.host @port = uri.port end @options[:timeout] ||= 10 # default connect & inactivity timeouts @options[:redirects] ||= 0 # default number of redirects to follow @options[:keepalive] ||= false # default to single request per connection # Make sure the ports are set as Addressable::URI doesn't # set the port if it isn't there if uri.scheme == "https" @uri.port ||= 443 @port ||= 443 else @uri.port ||= 80 @port ||= 80 end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
em-http-request-0.3.0 | lib/em-http/http_options.rb |