Method: HTTPX::Connection#initialize
- Defined in:
- lib/httpx/connection.rb
#initialize(uri, options) ⇒ Connection
Returns a new instance of Connection.
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/httpx/connection.rb', line 47 def initialize(uri, ) @current_session = @current_selector = @parser = @sibling = @coalesced_connection = @altsvc_connection = @family = @io = @ssl_session = @timeout = @connected_at = @response_received_at = nil @exhausted = @cloned = @main_sibling = false = Options.new() @type = initialize_type(uri, ) @origins = [uri.origin] @origin = Utils.to_uri(uri.origin) @window_size = .window_size @read_buffer = Buffer.new(.buffer_size) @write_buffer = Buffer.new(.buffer_size) @pending = [] @inflight = 0 @keep_alive_timeout = .timeout[:keep_alive_timeout] if .io # if there's an already open IO, get its # peer address, and force-initiate the parser transition(:already_open) @io = build_socket parser else transition(:idle) end self.addresses = .addresses if .addresses end |