Can top-level domains contain a number at the end? Idk nothing about DNS rules etc but when I try to use PHP's filter_var() function with FILTER_VALIDATE_EMAIL for test@null.com1
it returns true.
相关问题
- Views base64 encoded blob in HTML with PHP
- Laravel Option Select - Default Issue
- PHP Recursively File Folder Scan Sorted by Modific
- Can php detect if javascript is on or not?
- Using similar_text and strpos together
Conceptually, there is nothing that disallows numbers in a TLD and in the future, who knows, perhaps there will be numeric TLDs.
There are no TLDs at the moment that do have numbers in them - the function probably does not test against a list of known TLDs (as it is subject to change), but lexically.
Actually there are quite a few TLDs currently in use that contain numbers:
You can see an up to date list here data.iana.org/TLD/tlds-alpha-by-domain.txt or a list with descriptions here swcs.com.au/tld.htm
Yes technically, except if it is purely numerical, then it can not be a TLD, under current rules and for easy reasons to understand (to disambiguate with IP addresses). And it can not contain a number at the end, except if it is an IDN TLD, for reasons enforced by ICANN.
Let us go back to some RFCs to have some clearer definitions of things:
RFC 952: DOD INTERNET HOST TABLE SPECIFICATION (October 1985)
This is the definition of an Internet "hostname" back then:
Note that this also has the following:
Hence at that point:
com1
is a valid TLD3com
is not ("The first character must be an alpha character.")42
is not (same reason)1
is not (same reason)a
is not ("Single character names or nicknames are not allowed.")RFC 1034: DOMAIN NAMES - CONCEPTS AND FACILITIES (November 1987)
This is one of the RFC that created the DNS as we know today. For compatibility reasons it defined hostnames as a sequence of labels, where a label is defined as such:
The TLD is one label among others (the L in TLD). Per the above rule,
com1
is a valid label, and hence a valid TLD, where3com
would not have been. Which directly brings us to the following amendment.RFC 1123: Requirements for Internet Hosts -- Application and Support (October 1989)
This amends the previous RFC by changing one rule:
So at that point:
com1
is a valid TLD3com
is also valid42
is valid1
is valida
is validFor the case of "numerical" TLDs, the following rule in first document applies:
and
RFC 1738: Uniform Resource Locators (URL) (December 1994)
This also speaks about the TLD, but giving:
RFC 3696: Application Techniques for Checking and Transformation of Names (February 2004)
This was needed to introduce IDNs (Internationalized Domain Names) and it has this to say:
In fact as soon as IDNs are involved, and they are IDN TLDs (both ccTLDs and gTLDs now), the encoding chosen generates an ASCII string of the form
xn--something
where the something can have digits, including at the end, like shown in other answers.However it is not really clear from where the "additional rule" in the last sentence comes from.
RFC 4697: Observed DNS Resolution Misbehavior (October 2006)
Not defining anything, but providing some interesting facts:
and
Which clearly shows that indeed, in the wild, there are applications, maybe by mistake but it shows at least that it works technically, sending queries for names that are indeed formatted like IPv4 addresses, so with a fully numerical "TLD".
There was in fact an experience to launch a
.42
registry, obviously completely outside of ICANN ecosystem. You can see a summary of it at http://www.dotsauce.com/experimental-numeric-tld-42-domain/ and an archive of their main explanations at https://web.archive.org/web/20101222151118/http://register.42registry.org:80/ (in French).It did not went far, even if it technically works.
It showed for example that Microsoft based OS by default did not consider purely numeric TLDs at all, but they provided a patch for that: https://support.microsoft.com/en-us/help/947228/error-message-when-you-try-to-join-a-windows-vista-based-client-comput "When you try to join a Windows Vista-based client computer to a top level domain (TLD) that has a purely numeric suffix, the Windows Vista-based client computer cannot join the domain. [..] This behavior is by design."
Internet-Draft draft-liman-tld-names-06: Top Level Domain Name Specification (November 2011)
This finally gives some explanations on why purely numeric TLD or even TLD with one digit are sometimes considered invalid when it is not a clear consequence from above specifications:
(section 2.1 below refers to content in RFC 1123, quoted above)
But it basically just recommend to go with the flow and continue the same restrictions:
Hence it offered this definition:
This draft never converted to an RFC because not everyone agreed with it. You can find a thread with dissenting voices for it at https://www.ietf.org/mail-archive/web/dnsop/current/msg08866.html ; basically it was not clear if there was a restriction in the past that we are now trying to relax a little or if there never was a restriction to begin with and that people implemented systems wrongly.
For example you can see about this Chromium/Chrome bugreport: https://bugs.chromium.org/p/chromium/issues/detail?id=31405 Browsing failed if using a TLD starting with a digit or purely numeric (it worked if it ended with a digit with letters before). This was not considered as a bug, and is not fixed, because the browser ships with a list of TLDs so it can know which ones are valid which are not, besides testing their syntax.
ICANN Application Guidebook for new TLDs (June 2012)
Available at https://newgtlds.icann.org/en/applicants/agb/guidebook-full-04jun12-en.pdf it says the following starting at page 64:
Specially note the: The ASCII label must consist entirely of letters (alphabetic characters a-z)
This immediately forbids any full numerical, as well as in fact any digit, including at end, except for IDN TLDs, the one with the form
xn--something
.Note that someone asked directly ICANN about this, and got the following reply, shown at https://domaingang.com/domain-news/icann-applicant-handbook-this-is-why-we-cannot-have-numeric-gtlds/ :