Tolerate and correct IPv6 without brackets #166
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.
This PR is based on #165 and fixes #124. If #124 is too controversial, I can rebase this PR on master, just tell me :)
Depending on the contexts, people does not always agree on brackets usage with IPv6. For instance, the ipaddress core module handles IPv6 without brackets as do some other low-level python modules. Another example: DNS AAAA records usually handles IPv6 without brackets.
However in a URL context, with a port number being optionally associated with an IP, the brackets become mandatory to distinguish the columns inside the IP from the column that separate the port number from the IP.
As suggested in #124, I think this would be nice if a convenience utility like furl would tolerate and correct any usage. This would allow users to not need to check and correct manually the IPv6 they get from other libraries that may generate IPv6 without brackets because this is relevant in their development context. For instance a DNS SRV record being read with aiodns.
This is what this PR allows. There is not much code here, everything lies here:
This allows this usage: