Browse Source

Change Request connection logic to try both IPv6 and IPv4 when available (#20108)

Fixes #19751
closed-social-glitch-2
Claire 2 years ago
committed by GitHub
parent
commit
c989faaa62
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions
  1. +2
    -1
      app/lib/request.rb

+ 2
- 1
app/lib/request.rb View File

@ -199,7 +199,8 @@ class Request
rescue IPAddr::InvalidAddressError
Resolv::DNS.open do |dns|
dns.timeouts = 5
addresses = dns.getaddresses(host).take(2)
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
end

Loading…
Cancel
Save