Repository navigation
Connect to IP literals using their own address family - #552
Merged
Merged
Conversation
When the address was an IP literal, gen_tcp got the wrong family and treated it as a hostname. Mint then returned :nxdomain from the IPv4 fallback instead of the real error, after an unneeded DNS lookup and timeouts. - connect to IPv6 literals over inet6 and IPv4 literals over inet, ignoring :inet6 and :inet4 - keep the inet6-then-inet4 fallback for hostnames - apply the same change to TCP and SSL
Connect IP literals through one clause for both families, drop the redundant is_tuple/1 guards, and remove the Unreleased changelog section since the changelog is written at release time.
Coverage Report for CI Build 328Coverage increased (+0.09%) to 90.337%Details
Uncovered Changes
Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
Member
Author
|
Thank you @dch! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Connecting to an IPv6 literal such as
"::1"withoutinet6: truealways fails with:nxdomain, even when the port is listening, because:gen_tcpgets the defaultinetfamily and resolves the literal as a hostname. Callers hit this with URLs likehttp://[::1]:4000, sinceURI.parse/1strips the brackets and Mint receives"::1". Withinet6: trueand the defaultinet4: true, a refused connection to"::1"returns:nxdomainfrom the IPv4 fallback instead of:econnrefused.IP literals and IP tuples now connect once using their own family, and
:inet6/:inet4only apply to hostnames. TCP and SSL both get the change.This replaces #546 by @dch, keeping their commit, so maintainers can push to the branch.
Co-authored-by: Dave Cottlehuber dch@skunkwerks.at