Skip to content
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

IPAddress toString should use existing printTo algorithm and conform to RFC 5952 canonical format for IPv6 addresses #228

Open
sgryphon opened this issue Dec 15, 2023 · 0 comments

Comments

@sgryphon
Copy link
Contributor

sgryphon commented Dec 15, 2023

API component

IPAddress

Description

The toString() for an IPv6 type address has a different output from printTo(), and does not follow the RFC 5952 canonical format. It has an unnecessarily long fixed length format. Note that IPv4 does not use a fixed length format.

Also note that the existing printTo() method already implements the RFC 5952 canonical format algorithm, and has extensive tests (there are no tests for the toString() method).

The recommendation would be for toString() simply to use the existing algorithm from printTo() (and add some unit tests for toString).

Is this a breaking change?

No. Both formats are valid string formats for IPv6, and fromString() handles both of them (and all other valid formats), as should any other system. The canonical format is usually shorter, but will not exceed the fixed length format, so there is no issue with overruns.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant