th: add support for /etc/hosts
ci/woodpecker/push/woodpecker Pipeline was successful Details

Helped-by: Tim Perry <1526883+pimterry@users.noreply.github.com>
Helped-by: Jonathan de Jong <jo@jo.wtf>
Committed-by: kouhai <kouhai@treehouse.systems>
Fixes: https://github.com/mastodon/mastodon/issues/9436
main-rebase
demize 2024-04-15 00:38:24 -07:00 committed by kouhai
parent 6face4d0ee
commit 086da716d3
1 changed files with 1 additions and 5 deletions

View File

@ -261,11 +261,7 @@ class Request
begin
addresses = [IPAddr.new(host)]
rescue IPAddr::InvalidAddressError
Resolv::DNS.open do |dns|
dns.timeouts = 5
addresses = dns.getaddresses(host)
addresses = addresses.filter { |addr| addr.is_a?(Resolv::IPv6) }.take(2) + addresses.filter { |addr| !addr.is_a?(Resolv::IPv6) }.take(2)
end
addresses = Resolv::getaddresses(host)
end
socks = []