You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2018/05/18 01:03:58 UTC

[Bug 62383] New: HttpParser.DomainParserState fails valid hostname gateway.demo-ilt-latest-demo:9000

https://bz.apache.org/bugzilla/show_bug.cgi?id=62383

            Bug ID: 62383
           Summary: HttpParser.DomainParserState fails valid hostname
                    gateway.demo-ilt-latest-demo:9000
           Product: Tomcat 8
           Version: 8.5.31
          Hardware: All
                OS: All
            Status: NEW
          Severity: major
          Priority: P2
         Component: Util
          Assignee: dev@tomcat.apache.org
          Reporter: socialguy@outlook.com
  Target Milestone: ----

We recently upgraded to Tomcat 8.5.31 and found that it's rejecting the
hostname gateway.demo-ilt-latest-demo:9000 with the following message:

The character [:] is not valid after a letter in a domain name.

I traced the code on GitHub to
https://github.com/apache/tomcat/blob/trunk/java/org/apache/tomcat/util/http/parser/HttpParser.java#L875

Looking at the history of this file, it appears that there have been quite a
few problems with the hostname verification. I'd like to know why the above
hostname is considered invalid. FWIW, name
gateway.demo-ilt-latest-demo.svc.cluster.local works.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 62383] HttpParser.DomainParserState fails valid hostname gateway.demo-ilt-latest-demo:9000

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=62383

Abhijit Sarkar <so...@outlook.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|DUPLICATE                   |---

--- Comment #6 from Abhijit Sarkar <so...@outlook.com> ---
Reopening to draw attention to my last comment, which is "port is not part of
the hostname". Any argument that applies to hostname validation doesn't apply
to port.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 62383] HttpParser.DomainParserState fails valid hostname gateway.demo-ilt-latest-demo:9000

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=62383

--- Comment #5 from Abhijit Sarkar <so...@outlook.com> ---
(In reply to Mark Thomas from comment #4)
> It is the same problem and the problem has been fixed.

Let me try again because what I was saying didn't get across. The port is *not*
part of the hostname. Since hyphen is allowed in the last segment of a
hostname, a.b-c is a valid hostname: You add a valid port to it and get a valid
URI; where is the problem with that?

The parser should only validate what's on the left of the last ':', if any.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 62383] HttpParser.DomainParserState fails valid hostname gateway.demo-ilt-latest-demo:9000

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=62383

Abhijit Sarkar <so...@outlook.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|DUPLICATE                   |---
             Status|RESOLVED                    |REOPENED

--- Comment #3 from Abhijit Sarkar <so...@outlook.com> ---
(In reply to Mark Thomas from comment #1)
> However, a valid host name can never have the dotted-decimal form #.#.#.#,

62371 appears to be about hyphen in the hostname, whereas my problem is the
colon. Clearly, the hostname verifier is getting greedy and trying to parse
what's really not the hostname. If you insist, please point me the section in
the RFC that says port can't be part of a URL.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 62383] HttpParser.DomainParserState fails valid hostname gateway.demo-ilt-latest-demo:9000

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=62383

Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|---                         |DUPLICATE

--- Comment #7 from Mark Thomas <ma...@apache.org> ---
This has been fixed. It is a duplicate of 62371.

Please re-read comment #4. It explains why Tomcat was incorrectly complaining
about the ':' and why the problem you are reporting is a duplicate. If comment
#4 is not sufficiently clear, please follow-up on the users mailing list.

If you continue to re-open this issue your bugzilla account will be disabled.

*** This bug has been marked as a duplicate of bug 62371 ***

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 62383] HttpParser.DomainParserState fails valid hostname gateway.demo-ilt-latest-demo:9000

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=62383

--- Comment #2 from Michael Osipov <19...@gmx.net> ---
(In reply to Abhijit Sarkar from comment #0)

> FWIW, name gateway.demo-ilt-latest-demo.svc.cluster.local works.

It shouldn't because .local is reseved for link-local mDNS (Avahi, zeroconf,
etc.). The are no subdomains. I refused to merge something like this to Commons
Validator.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 62383] HttpParser.DomainParserState fails valid hostname gateway.demo-ilt-latest-demo:9000

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=62383

Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |DUPLICATE
             Status|REOPENED                    |RESOLVED

--- Comment #4 from Mark Thomas <ma...@apache.org> ---
It is the same problem and the problem has been fixed.

The parser complains about the ':' because it sees the '-' in the final segment
and therefore expects a '.' followed by a purely alphabetic segment. Rather
than the alphabetic segment, it sees the ':' and complains.

To prove the point I've added a test case for this example and it passes.

*** This bug has been marked as a duplicate of bug 62371 ***

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 62383] HttpParser.DomainParserState fails valid hostname gateway.demo-ilt-latest-demo:9000

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=62383

--- Comment #8 from Abhijit Sarkar <so...@outlook.com> ---
(In reply to Mark Thomas from comment #7)
> If you continue to re-open this issue your bugzilla account will be disabled.

If you don't continue to close it without waiting for my response, I won't need
to reopen it. The mailing list is a 2-way street; threatening to use your admin
privileges is a cheap gimmick.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 62383] HttpParser.DomainParserState fails valid hostname gateway.demo-ilt-latest-demo:9000

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=62383

Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |DUPLICATE

--- Comment #1 from Mark Thomas <ma...@apache.org> ---
The short answer is because of this text from RFC 1123:
<quote>
However, a valid host name can never have the dotted-decimal form #.#.#.#,
since at least the highest-level component label will be alphabetic.
</quote>

However, there is some interesting discussion of this in the errata. For a full
discussion of how this relates to Tomcat, see the duplicate. The summary of
that discussion is that '-' should be allowed in the final segment and the
parsing has been updated to permit this.

*** This bug has been marked as a duplicate of bug 62371 ***

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org