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

hostname_rfc1123 and hostname_port do not support IP addresses #1327

Open
2 tasks done
nf-brentsaner opened this issue Nov 8, 2024 · 0 comments
Open
2 tasks done

Comments

@nf-brentsaner
Copy link

nf-brentsaner commented Nov 8, 2024

  • I have looked at the documentation here first?
  • I have looked at the examples provided that may showcase my question here?

Package version eg. v9, v10:

v10

Issue, Question or Enhancement:

There is no validator that satisfies <ip>:<port>. This is fully compatible with the net functions that accept a connection address, and most others as well.

hostname_port WILL match e.g. 203.0.113.1, but not 203.0.113.1:123 nor 2001:DB8::1, [2001:DB8::1], nor [2001:DB8::1]:123.

This violates RFC 1123 recommendation (see below), thus rather than creating a new validator, the regex pattern hostnameRegexStringRFC1123 should be directly fixed.

(...)
Whenever a user inputs the identity of an Internet host, it SHOULD
be possible to enter either (1) a host domain name or (2) an IP
address in dotted-decimal ("#.#.#.#") form
. The host SHOULD check
the string syntactically for a dotted-decimal number before
looking it up in the Domain Name System.
(...)
(source, emphasis added)

I presume one of the updates to RFC 1123 also provides for IPv6 addresses in addition to IPv4 addresses, given 1123 was written in 1989, so these should also be allowed by the pattern.

Code sample, to showcase or reproduce:

N/A

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

No branches or pull requests

1 participant