delphicloudflareindyconnection-timeoutwinhttp

Why do WinHTTP and TNetHTTPClient timeout (error 12002) on one Wi-Fi network but succeed on others?


I'm developing a Delphi application to download files using both WinHTTP (via direct API calls) and TNetHTTPClient. Everything works fine on most networks, but on one specific open Wi-Fi network, both approaches fail consistently with a timeout.

Specifically:

The target URL is hosted on Cloudflare R2, with no enforced bot protection, and works fine from other networks.

What I’ve already tried:

Question: Why would WinHTTP and TNetHTTPClient time out on one specific network, while Indy and browsers succeed? Is there any internal behavior in WinHTTP that makes it more sensitive to certain network environments (e.g., open Wi-Fi, captive portals, DNS behavior, SNI, etc.)?

Update:

I confirmed that WinInet also experiences the same issue on this network. The problem was resolved by enabling the WINHTTP_OPTION_IPV6_FAST_FALLBACK option in WinHTTP, which allowed the client to quickly fall back to IPv4 when IPv6 was slow or unresponsive.


Solution

  • The problem was resolved by enabling the WINHTTP_OPTION_IPV6_FAST_FALLBACK option in WinHTTP, which allowed the client to quickly fall back to IPv4 when IPv6 was slow or unresponsive.