Fix HTTP requests to IPv6 hosts (#11240)
parent
d9f42ba34b
commit
33607c43a5
|
@ -191,7 +191,7 @@ class Request
|
||||||
begin
|
begin
|
||||||
raise Mastodon::HostValidationError if PrivateAddressCheck.private_address?(IPAddr.new(address.to_s))
|
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)
|
sockaddr = ::Socket.pack_sockaddr_in(port, address.to_s)
|
||||||
|
|
||||||
sock.setsockopt(::Socket::IPPROTO_TCP, ::Socket::TCP_NODELAY, 1)
|
sock.setsockopt(::Socket::IPPROTO_TCP, ::Socket::TCP_NODELAY, 1)
|
||||||
|
|
Loading…
Reference in New Issue