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 2002/03/07 01:06:00 UTC

DO NOT REPLY [Bug 6942] New: - getRequestURL does not return a port number is request scheme is different then http or https

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

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=6942

getRequestURL does not return a port number is request scheme is different then http or https

           Summary: getRequestURL does not return a port number is request
                    scheme is different then http or https
           Product: Tomcat 4
           Version: 4.0.1 Final
          Platform: Other
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Unknown
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: gawor@mcs.anl.gov


This is a problem in implementation of servlet api - 
javax.servlet.http.HttpUtils - getRequestURL (HttpServletRequest req) method. 
The method only assumes http and https urls. That is, if the request scheme is 
other than http or https then the port number of the server will not be 
included in the reconstructed url. 

The following code:

	if ((scheme.equals ("http") && port != 80)
		|| (scheme.equals ("https") && port != 443)) {
	    url.append (':');
	    url.append (req.getServerPort ());
	}

should be replaced with:

if (! (  (scheme.equals("http") && port == 80) || 
         (scheme.equals("https") && port == 443) ) ) {
	    url.append (':');
	    url.append (req.getServerPort ());
	}

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>