mirror of
https://github.com/HoneyryderChuck/httpx.git
synced 2025-12-05 00:02:12 -05:00
dns errors: raise error immediately on nxdomain error
no need to loop into candidates.
This commit is contained in:
parent
f56f77d836
commit
04c5b39600
@ -95,12 +95,12 @@ if RUBY_VERSION >= "2.4.0"
|
||||
|
||||
response = HTTPX.get(uri)
|
||||
|
||||
verify_error_response(response, /Can't resolve unexisting/)
|
||||
verify_error_response(response, /name or service not known/)
|
||||
assert response.is_a?(HTTPX::ErrorResponse), "response should contain errors"
|
||||
verify_spans(transaction, response, verb: "GET")
|
||||
crumb = Sentry.get_current_scope.breadcrumbs.peek
|
||||
assert crumb.category == "httpx"
|
||||
assert crumb.data == { error: "Can't resolve unexisting", method: "GET", url: uri.to_s }
|
||||
assert crumb.data == { error: "name or service not known (unexisting)", method: "GET", url: uri.to_s }
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
@ -244,12 +244,10 @@ module HTTPX
|
||||
when :no_domain_found
|
||||
# Indicates no such domain was found.
|
||||
hostname, connection = @queries.first
|
||||
reset_hostname(hostname, reset_candidates: false)
|
||||
reset_hostname(hostname)
|
||||
|
||||
unless @queries.value?(connection)
|
||||
@connections.delete(connection)
|
||||
raise NativeResolveError.new(connection, connection.origin.host)
|
||||
end
|
||||
@connections.delete(connection)
|
||||
raise NativeResolveError.new(connection, connection.origin.host, "name or service not known (#{hostname})")
|
||||
when :message_truncated
|
||||
# TODO: what to do if it's already tcp??
|
||||
return if @socket_type == :tcp
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user