The exact wording is: "They must start with a letter, end with a letter or digit, and have as interior characters only letters, digits, and hyphen."
/*
* Verify that a domain name uses an acceptable character set.
*/
/*
* Note the conspicuous absence of ctype macros in these definitions. On
* non-ASCII hosts, we can't depend on string literals or ctype macros to
* tell us anything about network-format data. The rest of the BIND system
* is not careful about this, but for some reason, we're doing it right here.
*/
#define PERIOD 0x2e
#define hyphenchar(c) ((c) == 0x2d)
#define underscorechar(c) ((c) == 0x5f)
#define bslashchar(c) ((c) == 0x5c)
#define periodchar(c) ((c) == PERIOD)
#define asterchar(c) ((c) == 0x2a)
#define alphachar(c) (((c) >= 0x41 && (c) <= 0x5a) \
|| ((c) >= 0x61 && (c) <= 0x7a))
#define digitchar(c) ((c) >= 0x30 && (c) <= 0x39)
#define borderchar(c) (alphachar(c) || digitchar(c))
#define middlechar(c) (borderchar(c) || hyphenchar(c) || underscorechar(c))
#define domainchar(c) ((c) > 0x20 && (c) < 0x7f)
int
res_hnok(const char *dn) {
int pch = PERIOD, ch = *dn++;
while (ch != '\0') {
int nch = *dn++;
if (periodchar(ch)) {
(void)NULL;
} else if (periodchar(pch)) {
if (!borderchar(ch))
return (0);
} else if (periodchar(nch) || nch == '\0') {
if (!borderchar(ch))
return (0);
} else {
if (!middlechar(ch))
return (0);
}
pch = ch, ch = nch;
}
return (1);
} /*
hnokpre.c: LD_PRELOAD shim to bypass valid hostname checking in glibc
gcc -fPIC -shared hnokpre.c -o libhnokpre.so
LD_PRELOAD=./libhnokpre.so curl http://mattias-.github.io/
*/
int res_hnok(const char* dn)
{
return 1;
}
int __res_hnok(const char* dn)
{
return 1;
} * Note the conspicuous absence of ctype macros in these definitions. On
* non-ASCII hosts, we can't depend on string literals or ctype macros to
* tell us anything about network-format data. The rest of the BIND system
* is not careful about this, but for some reason, we're doing it right here.
Well that is only a problem if the charset is converted to something else. Are there still systems out there without a C compiler that can be told to use ASCII?I just added a custom domain/CNAME to my github pages so it should be reachable at http://blog.ppelgren.se
Are you perhaps using a browser or a DNS stack that rejects this type of domain name?
It's quite interesting... dig seems to resolve the domain just fine, but neither chrome, curl nor firefox seem to be able to open the page. (tested on Fedora/CentOS/Android)
However, curl and firefox seem to be RFC-compliant. RFC952 states: "The last character must not be a minus sign or period."
Edit: Google Chrome works.
randunel@18:~$ curl Mattias-.github.io
curl: (6) Could not resolve host: Mattias-.github.io
randunel@18:~$ dig +short Mattias-.github.io
github.map.fastly.net.
185.31.18.133