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

            Bug ID: 63753
           Summary: unnecessary websocket request host header port number
                    checking
           Product: Tomcat 9
           Version: 9.0.x
          Hardware: All
                OS: All
            Status: NEW
          Severity: trivial
          Priority: P2
         Component: WebSocket
          Assignee: dev@tomcat.apache.org
          Reporter: jongfigh...@gmail.com
  Target Milestone: -----

WsWebSocketContainer::createRequestHeaders intends to check whether the port
number is -1 or not.

        // Host header
        List<String> hostValues = new ArrayList<>(1);
        if (port == -1) {
            hostValues.add(host);
        } else {
            hostValues.add(host + ':' + port);
        }

However, before createRequestHeaders method is called, the port number is set
to 80 and 443 in connectToServerRecursive method. The value of port cannot be
-1.

        if (port == -1) {
            if ("ws".equalsIgnoreCase(scheme)) {
                port = 80;
            } else {
                // Must be wss due to scheme validation above
                port = 443;
            }
        }

I think it is side effect of revision 230c1083fd9f10ec50ccd1d15032f2df29e4de2c.
(git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1780109
13f79535-47bb-0310-9956-ffa450edef68). It is better to remove the code.

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

Reply via email to