do not try to cast to Options all the time, trust the internal structure

This commit is contained in:
HoneyryderChuck 2024-01-24 22:37:18 +00:00
parent dcbd2f81e3
commit b686119a6f
14 changed files with 16 additions and 14 deletions

View File

@ -48,6 +48,8 @@ module HTTPX
attr_accessor :family
def initialize(uri, options)
@origins = [uri.origin]
@origin = Utils.to_uri(uri.origin)
@options = Options.new(options)
@type = initialize_type(uri, @options)
@origins = [uri.origin]

View File

@ -15,7 +15,7 @@ module HTTPX
attr_accessor :max_concurrent_requests
def initialize(buffer, options)
@options = Options.new(options)
@options = options
@max_concurrent_requests = @options.max_concurrent_requests || MAX_REQUESTS
@max_requests = @options.max_requests
@parser = Parser::HTTP1.new(self)

View File

@ -25,7 +25,7 @@ module HTTPX
attr_reader :streams, :pending
def initialize(buffer, options)
@options = Options.new(options)
@options = options
@settings = @options.http2_settings
@pending = []
@streams = {}

View File

@ -17,7 +17,7 @@ module HTTPX
@state = :idle
@addresses = []
@hostname = origin.host
@options = Options.new(options)
@options = options
@fallback_protocol = @options.fallback_protocol
@port = origin.port
@interests = :w

View File

@ -12,7 +12,7 @@ module HTTPX
@addresses = []
@hostname = origin.host
@state = :idle
@options = Options.new(options)
@options = options
@fallback_protocol = @options.fallback_protocol
if @options.io
@io = case @options.io

View File

@ -89,7 +89,7 @@ module HTTPX
def initialize(buffer, options)
@buffer = buffer
@options = Options.new(options)
@options = options
end
def close; end

View File

@ -141,7 +141,7 @@ module HTTPX
def initialize(buffer, options)
@buffer = buffer
@options = Options.new(options)
@options = options
end
def close; end

View File

@ -33,7 +33,7 @@ module HTTPX
def initialize(family, options)
@family = family
@record_type = RECORD_TYPES[family]
@options = Options.new(options)
@options = options
end
def close; end

View File

@ -251,7 +251,7 @@ module HTTPX
@request = request
@response = request.response if request.response.is_a?(Response)
@error = error
@options = Options.new(options)
@options = options
log_exception(@error)
end

View File

@ -93,9 +93,9 @@ module HTTPX
private
def initialize: (http_uri uri, options) -> void
def initialize: (http_uri uri, Options options) -> void
def initialize_type: (http_uri uri, Options) -> io_type
def initialize_type: (http_uri uri, Options options) -> io_type
def connect: () -> void

View File

@ -58,7 +58,7 @@ module HTTPX
private
def initialize: (Buffer, options) -> untyped
def initialize: (Buffer buffer, Options options) -> untyped
def manage_connection: (Request request, Response response) -> void

View File

@ -42,7 +42,7 @@ module HTTPX
private
def initialize: (Buffer, options) -> untyped
def initialize: (Buffer buffer, Options options) -> untyped
def send_pending: () -> void

View File

@ -15,7 +15,7 @@ module HTTPX
@io: Socket
def initialize: (http_uri origin, String? path, options options) -> void
def initialize: (http_uri origin, String? path, Options options) -> void
def connect: () -> void

View File

@ -26,7 +26,7 @@ module HTTPX
def emit_resolved_connection: (Connection connection, Array[IPAddr] addresses, bool early_resolve) -> void
def initialize: (ip_family? family, options options) -> void
def initialize: (ip_family? family, Options options) -> void
def early_resolve: (Connection connection, ?hostname: String) -> void