-
Couldn't load subscription status.
- Fork 4.6k
Transport: Prevent DNS lookup if host not provided #7665
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #7665 +/- ##
==========================================
+ Coverage 81.79% 82.14% +0.34%
==========================================
Files 361 361
Lines 27821 27877 +56
==========================================
+ Hits 22757 22900 +143
+ Misses 3863 3812 -51
+ Partials 1201 1165 -36
|
|
@antonyj7 thanks for the change. Though i think hardcoding to only 127.0.0.1 could cause problems in IPv6-preferred or IPv6-only environments. To ensure broader compatibility and future-proof the code, it would be better to handle both IPv4 (127.0.0.1) and IPv6 (::1) loopback addresses when skipping DNS resolution and that would require some more custom logic. Using localhost and relying on the system's DNS resolution to handle the appropriate mapping between IPv4 (127.0.0.1) and IPv6 (::1) might be better in most cases. Are you facing any specific issues with using localhost? If yes, could you provide more details or logs for that? |
Thanks for the review. We have been having issues with some of our VPN servers whereby the DNS does not resolve localhost and spits out However, the broader point here was - do we even have to go down the route of resolving DNS in case of localhost ?
Its not a big deal for us, and we can live with this :-) but if this can be fixed in the library, then we can remove 127.0.0.1 in our code :-) Meanwhile, I will look at handling both IPv4 and IPv6... |
|
closing this, will raise another PR in case we have a generic solution to cater for IPv6 etc.. |
Thanks @antonyj7. There is a similar issue in discussion here #7429 |
Currently, if the host is not specified, it defaults to localhost. This can lead to issues if the DNS server does not resolve localhost correctly, potentially resulting in errors such as
{"code":14,"message":"dns: A record lookup error: lookup localhost: i/o timeout"}.I believe that if the host is not provided, the system should skip DNS resolution entirely and directly use the host, which would help prevent these unintended behaviors.
RELEASE NOTES: