DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=11748>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=11748

Location header for redirection does not contain the port number

[EMAIL PROTECTED] changed:

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



------- Additional Comments From [EMAIL PROTECTED]  2004-09-10 11:54 -------
there is an actual bug here. In HttpProcessor, when the Host: header has no port
(eg because the client is buggy as described above) the code does this:
if (n < 0) {
  if (connector.getScheme().equals("http")) {
     request.setServerPort(80);
  } else if (connector.getScheme().equals("https")) {
     request.setServerPort(443);
  }
  if (proxyName != null)
     request.setServerName(proxyName);
  else
     request.setServerName(value);
}
note that in the above only the proxyName is processed, not the proxyPort. In
other words, if you explicitly tell tomcat to ignore the host header and use
proxy host/port combo, it doesnt in this case, it only uses the host.

the code for host header handling *should* look like this:
            } else if (header.equals(DefaultHeaders.HOST_NAME)) {
                int n = value.indexOf(':');
                // parse and apply host header
                if (n < 0) {
                    if (connector.getScheme().equals("http")) {
                        request.setServerPort(80);
                    } else if (connector.getScheme().equals("https")) {
                        request.setServerPort(443);
                    }
                    request.setServerName(value);
                } else {
                    request.setServerName(value.substring(0, n).trim());
                    int port = 80;
                    try {
                       port = Integer.parseInt(value.substring(n+1).trim());
                    } catch (Exception e) {
                       throw new ServletException
                            (sm.getString
                            ("httpProcessor.parseHeaders.portNumber"));
                    }
                    request.setServerPort(port);
                }

                // apply proxy overrides
                if (proxyName != null)
                   request.setServerName(proxyName);
                if (proxyPort != 0)
                   request.setServerPort(proxyPort);
            } ...

the intent here is that any proxy host/port settings are always applied.

We reproduced the problem following a link from Word 2000, linking to tomcat via
the axis tcpmon proxy. linking to any content that returns a redirect shows the
problem (eg "http://host:port/foo"; redirects to "http://host:port/foo/";) Word
sends a host header without the port, obviously a bug, but tomcat's response
ignores the proxy settings due to the bug described above.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to