HTTPS request failing on a request that acts "weird"

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By literalcitrus
:warning: Old Version Published before Godot 3 was released.

I am making a HTTPS requests that, for some reason, on my PC (Win10) takes a long time to complete, around 20 seconds. Doing a wireshark on a curl request of the page shows that the ~20 second delay has no network traffic, and once the delay is over the request is completed as expected without any delay between the request and response. Requests on other urls (https or otherwise) don’t have this delay.

However, when I use a HTTPRequest node to do the same thing in Godot, I get the same ~20 second delay and then an error response saying that the connection failed (RESULT_CANT_CONNECT from HTTPRequest), and wireshark is empty.

Is there some kind of built-in timeout or other possible reason as to why Godot is failing to make this (admittedly flawed) request when other programs are able to complete it after the initial delay?

Edit: Figured out the delay is due to a weird ipv6 configuration on the server in which it fails to connect. Curl hangs on this ipv6 for the 20 seconds, and when it fails it defaults back to the ipv4 connection, which works. It seems that Godot is attempting the same ipv6 connection, and responding with the “Can’t connect” that the ipv6 connection sends back. New question: Is there a way to force ipv4 or let Godot ignore the failed ipv6 connection or is this now a “me and my computer” problem?

Edit 2: In case someone else has this problem, I solved it by using the IP class to resolve the hostname of the server I am connecting to into an IPv4 address with IP.resolve_hostname(host, TYPE_IPV4) and then using the HTTPRequest class as usual with the resolved address. For my server I had to disable SSL validation in the request call as the certificate was failing (which is definitely a me problem, not Godot).