Method: HTTP::Connection#initialize
- Defined in:
- lib/http/connection.rb
#initialize(req, options) ⇒ Connection
Returns a new instance of Connection.
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/http/connection.rb', line 31 def initialize(req, ) @persistent = .persistent? @keep_alive_timeout = .keep_alive_timeout.to_f @pending_request = false @pending_response = false @failed_proxy_connect = false @buffer = "".b @parser = Response::Parser.new @socket = .timeout_class.new(.) @socket.connect(.socket_class, req.socket_host, req.socket_port, .nodelay) send_proxy_connect_request(req) start_tls(req, ) reset_timer rescue IOError, SocketError, SystemCallError => e raise ConnectionError, "failed to connect: #{e}", e.backtrace rescue TimeoutError close raise end |