mirror of
https://github.com/HoneyryderChuck/httpx.git
synced 2025-09-23 00:02:01 -04:00
fixed DNS query module, where uncaching entries was just trying to perform a different query after some time, until all record types (A and AAAA) were drained; this also clears the logic on when a tcp connection can't be established cuz EHOSTUNREACH
This commit is contained in:
parent
a72f1981ff
commit
fdeaf1f918
@ -61,7 +61,7 @@ module HTTPX
|
||||
channel.on(:reset) do
|
||||
@timeout.transition(:idle)
|
||||
end
|
||||
channel.once(:unreachable) do
|
||||
channel.on(:unreachable) do
|
||||
@resolver.uncache(channel)
|
||||
resolve_channel(channel)
|
||||
end
|
||||
|
@ -67,7 +67,7 @@ module HTTPX
|
||||
def resolve(channel = @channels.first, hostname = nil)
|
||||
return if @building_channel
|
||||
hostname = hostname || @queries.key(channel) || channel.uri.host
|
||||
type = @_record_types[hostname].shift
|
||||
type = @_record_types[hostname].first
|
||||
log(label: "resolver: ") { "query #{type} for #{hostname}" }
|
||||
begin
|
||||
request = build_request(hostname, type)
|
||||
@ -122,7 +122,9 @@ module HTTPX
|
||||
end
|
||||
if answers.empty?
|
||||
host, channel = @queries.first
|
||||
@_record_types[host].shift
|
||||
if @_record_types[host].empty?
|
||||
@_record_types.delete(host)
|
||||
emit_resolve_error(channel, host)
|
||||
return
|
||||
end
|
||||
|
@ -190,7 +190,9 @@ module HTTPX
|
||||
|
||||
if addresses.empty?
|
||||
hostname, channel = @queries.first
|
||||
@_record_types[hostname].shift
|
||||
if @_record_types[hostname].empty?
|
||||
@_record_types.delete(hostname)
|
||||
emit_resolve_error(channel, hostname)
|
||||
return
|
||||
end
|
||||
@ -221,7 +223,7 @@ module HTTPX
|
||||
return unless @write_buffer.empty?
|
||||
hostname = hostname || @queries.key(channel) || channel.uri.host
|
||||
@queries[hostname] = channel
|
||||
type = @_record_types[hostname].shift
|
||||
type = @_record_types[hostname].first
|
||||
log(label: "resolver: ") { "query #{type} for #{hostname}" }
|
||||
begin
|
||||
@write_buffer << Resolver.encode_dns_query(hostname, type: RECORD_TYPES[type])
|
||||
|
@ -21,6 +21,7 @@ module HTTPX
|
||||
def uncache(channel)
|
||||
hostname = hostname || @queries.key(channel) || channel.uri.host
|
||||
Resolver.uncache(hostname)
|
||||
@_record_types[hostname].shift
|
||||
end
|
||||
|
||||
private
|
||||
|
Loading…
x
Reference in New Issue
Block a user