tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From na...@locus.apache.org
Subject cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/service/http HttpRequestAdapter.java
Date Fri, 10 Nov 2000 02:48:41 GMT
nacho       00/11/09 18:48:41

  Modified:    src/share/org/apache/tomcat/service/http Tag: tomcat_32
                        HttpRequestAdapter.java
  Log:
  * Fixing a problem with redirections,  was using the lsocket port
  not the host header port if present
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.16.2.3  +17 -1     jakarta-tomcat/src/share/org/apache/tomcat/service/http/HttpRequestAdapter.java
  
  Index: HttpRequestAdapter.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/service/http/HttpRequestAdapter.java,v
  retrieving revision 1.16.2.2
  retrieving revision 1.16.2.3
  diff -u -r1.16.2.2 -r1.16.2.3
  --- HttpRequestAdapter.java	2000/10/04 20:23:57	1.16.2.2
  +++ HttpRequestAdapter.java	2000/11/10 02:48:40	1.16.2.3
  @@ -247,7 +247,23 @@
       }
   
       public int getServerPort() {
  -        return socket.getLocalPort();
  +        if(serverPort == -1) {
  +            //XXX Which is the default in case we can not get the port
  +            //from the request??
  +            serverPort=socket.getLocalPort();
  +            String hostHeader = this.getHeader("host");
  +            if (hostHeader != null) {
  +                int i = hostHeader.indexOf(':');
  +                if (i > -1) {
  +                    hostHeader = hostHeader.substring(i+1);
  +                    try{
  +                        serverPort=Integer.parseInt(hostHeader);
  +                    }catch(NumberFormatException pex){
  +                    }
  +                }else serverPort=80;
  +            }
  +        }
  +        return serverPort;
       }
   
       public String getServerName() {
  
  
  

Mime
View raw message