Open JustArchi opened 6 years ago
however, we need a few DNS APIs to make it easy. Workaround: PInvoke into the DNS APIs
What APIs?
This has been resolved via the API added here in .NET 5: https://github.com/dotnet/runtime/issues/41949
.net 6.0.18
This problem has not been resolved
I know commenting to remind people "why isn't this done yet" isn't the most productive, but I just want to make the weight of this issue clear:
As long as this isn't implemented, HttpClient
is by-default broken for any software distributed to user machines. Sooner or later somebody is going to have a broken IPv6 configuration, and your app will just break. Implementing the workaround is basically required for everybody using HttpClient
. (just look at the amount of issues referencing this one, soon I'm gonna have two myself.)
Sorry to shill my own blog, but for the people stumbling upon this, I made a decently robust implementation you can use: https://slugcat.systems/post/24-06-16-ipv6-is-hard-happy-eyeballs-dotnet-httpclient/#the-implementation
do you want to contribute to runtime @PJB3005? It is on my radar for 9.0 but I did not get to it yet.
Repro: HttpClientBug.zip
I reproduced this one on Linux and I didn't have much luck on Windows.
Run repro with
dotnet run
. After a default timeout of around 60 seconds, you'll get:Doing the same by forcing older curl handler:
Please note that this issue is specific and not reproducible with just any
https
server, as majority of them work just fine. I encountered this issue when accessinghttps://translate.google.com
, which is what I used in my repro above.I reproduced this bug on latest
master
as well as .NET Core 2.1 rc1.This bug could be some sort of regression because previously my app running
master
SDK worked just fine with this URL, includingSocketHttpHandler
that I used for a longer while. It could also be regression caused by Google's servers configuration change that triggered bug existing in the code since quite some time, which is more likely. Of course this one is not reproducible on .NET Core 2.0, since there is noSocketHttpHandler
there.Thank you in advance for looking into this.
[EDIT] Inline C# source code by @karelz