Reddit doesn't allow hostnames containing underscore #289

lambda opened this Issue Dec 16, 2011 · 1 comment


None yet

2 participants

lambda commented Dec 16, 2011

When submitting URLs, Reddit appears to reject hostnames that contain an underscore (_). While _ is technically forbidden from hostnames by RFC 1123, it is allowed by DNS, which specifies only that higher level protocols may impose their own syntactic restrictions on domain or host names. HTTP defers to the generic URI syntax, RFC 2396, which is obsoleted by RFC 3896, which imposes almost no restrictions on the hostname (and allows for URI encoding anything that you can't otherwise put in the host name). It does mention the standard letter, digit, hyphen restrictions for DNS based host names, but specifies that other types of host names may contain other character.

It seems that it's relatively common for host names to contain underscores. There are lots of bug reports for other software complaining that they don't support underscores in host names (and most of them are resolved by allowing underscores). And when I looked through Alexa's "Top Million Sites" CSV (not a perfect data set, but one that's somewhat representative), I found more than a dozen that contained an underscore in their host name.

This bug has been previously reported and closed, but I think that it deserves another look. While technically invalid, in practice, it seems that underscores are allowed in hostnames by most software. And it's still tripping up people who are trying to post links to Reddit, such that they have to use URL shorteners as Reddit rejects the link.

@grevian grevian added a commit to grevian/reddit that referenced this issue Dec 12, 2013
@grevian grevian Add _ to list of valid hostname characters
This is in response to reddit#289
@xiongchiamiov xiongchiamiov added a commit that referenced this issue Nov 4, 2014
@grevian grevian Add _ to list of valid hostname characters
This is in response to #289

Fixes #929.

Closed by 52d648c.

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