about summary refs log tree commit diff
path: root/app
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2019-07-05 22:03:00 +0200
committerEugen Rochko <eugen@zeonfederated.com>2019-07-05 22:03:00 +0200
commited544f3166a2a726a22736ee53d43c29d0f44773 (patch)
tree7a82c217970d5817af84e95fe7d7bea35518aec7 /app
parent0c1b1069c96d3452d43d922a737c522d10e4747b (diff)
Fix HTTP requests to IPv6 hosts (#11240)
Diffstat (limited to 'app')
-rw-r--r--app/lib/request.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/app/lib/request.rb b/app/lib/request.rb
index af49d6c77..e25b9026c 100644
--- a/app/lib/request.rb
+++ b/app/lib/request.rb
@@ -191,7 +191,7 @@ class Request
             begin
               raise Mastodon::HostValidationError if PrivateAddressCheck.private_address?(IPAddr.new(address.to_s))
 
-              sock     = ::Socket.new(::Socket::AF_INET, ::Socket::SOCK_STREAM, 0)
+              sock     = ::Socket.new(address.is_a?(Resolv::IPv6) ? ::Socket::AF_INET6 : ::Socket::AF_INET, ::Socket::SOCK_STREAM, 0)
               sockaddr = ::Socket.pack_sockaddr_in(port, address.to_s)
 
               sock.setsockopt(::Socket::IPPROTO_TCP, ::Socket::TCP_NODELAY, 1)