Skip to content

Instantly share code, notes, and snippets.

@RaitoBezarius
Created February 12, 2024 15:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RaitoBezarius/8b1b8ba60b51d161948f33933377d734 to your computer and use it in GitHub Desktop.
Save RaitoBezarius/8b1b8ba60b51d161948f33933377d734 to your computer and use it in GitHub Desktop.
Support /etc/hosts in Mastodon patch
diff --git a/app/lib/request.rb b/app/lib/request.rb
index 8d4120868..e640fadd2 100644
--- a/app/lib/request.rb
+++ b/app/lib/request.rb
@@ -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 = []
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment