AFAIK, underscores are forbidden from being part of a host name as per RFC 1123 Sec 2.1/RFC 952 (Assummptions Sec 1)

It's also spelled out in RFC 3986:
"
  A registered name intended for lookup in the DNS (...)
  consists of a sequence of domain labels separated by ".",
   each domain label starting and ending with an alphanumeric character
   and possibly also containing "-" characters.

"
  Issac

On 2/2/2017 2:53 PM, Joe Orton wrote:
Another 2.4.25 regression reported from a Fedora user is that
underscores in hostnames are rejected by default now.  I couldn't see a
specific discussion of this, was it deliberate?

Following breadcrumbs...

https://tools.ietf.org/html/rfc7230#section-5.4
      Host = uri-host [ ":" port ] ; Section 2.7.1

https://tools.ietf.org/html/rfc7230#section-2.7
    uri-host = <host, see [RFC3986], Section 3.2.2>

https://tools.ietf.org/html/rfc3986#section-3.2.2
       host        = IP-literal / IPv4address / reg-name
...
       reg-name    = *( unreserved / pct-encoded / sub-delims )

https://tools.ietf.org/html/rfc3986#section-2.3
       unreserved  = ALPHA / DIGIT / "-" / "." / "_" / "~"

From google I can see that _ in hostnames has various issues, so I'm not
sure what is right here.  It's simple enough to relax the check, seems
unlikely allowing ~ is a good idea.

Index: server/vhost.c
===================================================================
--- server/vhost.c      (revision 1781359)
+++ server/vhost.c      (working copy)
@@ -757,7 +757,10 @@
      int is_dotted_decimal = 1, leading_zeroes = 0, dots = 0;

      for (ch = host; *ch; ch++) {
-        if (apr_isalpha(*ch) || *ch == '-') {
+        /* This should allow any character in 'uri-host' per RFC
+         * 7320s5.4, which is 'host' by RFC 3986, which matches any
+         * 'unreserved' character. */
+        if (apr_isalpha(*ch) || *ch == '-' || *ch == '_') {
              is_dotted_decimal = 0;
          }
          else if (ch[0] == '.') {


Reply via email to