mirror of
https://github.com/HoneyryderChuck/httpx.git
synced 2025-11-22 00:05:57 -05:00
Implemementing the following fixes: * connections are now marked by IP family of the IO; * connection "mergeable" status dependent on matching origin when conn is already open; * on a connection error, in case it happened while connection, an event is emitted, rather than handling it; if there is another connection for the same origin still doing the handshake, the error is ignored; if not, the error is handled; * a new event, `:tcp_open`, is emitted when the tcp socket conn is established; this allows for concurrent handshakes to be promptly terminated, instead of being dependent on TLS handshake; * connection cloning now happens early, as connection is set for resolving; this way, 2-way callbacks are set as early as possible;
64 lines
1.4 KiB
Plaintext
64 lines
1.4 KiB
Plaintext
module HTTPX
|
|
module Resolver
|
|
class Native < Resolver
|
|
extend Forwardable
|
|
include _ToIO
|
|
|
|
DEFAULTS: Hash[Symbol, untyped]
|
|
DNS_PORT: Integer
|
|
|
|
attr_reader family: ip_family
|
|
|
|
@options: Options
|
|
@ns_index: Integer
|
|
@nameserver: Array[String]?
|
|
@ndots: Integer
|
|
@start_timeout: Float?
|
|
@search: Array[String]
|
|
@_timeouts: Array[Numeric]
|
|
@timeouts: Hash[String, Array[Numeric]]
|
|
@connections: Array[Connection]
|
|
@read_buffer: String
|
|
@write_buffer: Buffer
|
|
|
|
attr_reader state: Symbol
|
|
|
|
def call: () -> void
|
|
|
|
def interests: () -> (:r | :w | nil)
|
|
|
|
def <<: (Connection) -> void
|
|
|
|
def timeout: () -> Numeric?
|
|
|
|
def raise_timeout_error: (Numeric interval) -> void
|
|
|
|
private
|
|
|
|
def initialize: (ip_family family, options options) -> void
|
|
|
|
def calculate_interests: () -> (:r | :w | nil)
|
|
|
|
def consume: () -> void
|
|
|
|
def do_retry: (?Numeric? loop_time) -> void
|
|
|
|
def dread: (Integer) -> void
|
|
| () -> void
|
|
|
|
def dwrite: () -> void
|
|
|
|
def parse: (String) -> void
|
|
|
|
def resolve: (?Connection connection, ?String hostname) -> void
|
|
|
|
def generate_candidates: (String) -> Array[String]
|
|
|
|
def build_socket: () -> void
|
|
|
|
def transition: (Symbol nextstate) -> void
|
|
|
|
def handle_error: (NativeResolveError | StandardError) -> void
|
|
end
|
|
end
|
|
end |