set ndots to 1 when none parsed from resolv.conf

as per https://www.man7.org/linux/man-pages/man5/resolv.conf.5.html, default is 1
This commit is contained in:
HoneyryderChuck 2023-10-21 00:02:25 +01:00
parent 61ce888e47
commit 0cb169afab

View File

@ -30,7 +30,7 @@ module HTTPX
nameserver = nameserver[family] if nameserver.is_a?(Hash)
Array(nameserver)
end
@ndots = @resolver_options[:ndots]
@ndots = @resolver_options.fetch(:ndots, 1)
@search = Array(@resolver_options[:search]).map { |srch| srch.scan(/[^.]+/) }
@_timeouts = Array(@resolver_options[:timeouts])
@timeouts = Hash.new { |timeouts, host| timeouts[host] = @_timeouts.dup }