You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by co...@apache.org on 2001/06/09 05:13:27 UTC

cvs commit: jakarta-tomcat-connectors/jk/java/org/apache/ajp/tomcat33 Ajp13Interceptor.java

costin      01/06/08 20:13:26

  Modified:    jk/java/org/apache/ajp/tomcat33 Ajp13Interceptor.java
  Log:
  Added missing method ( last dep on ajp12 )
  
  Revision  Changes    Path
  1.2       +39 -4     jakarta-tomcat-connectors/jk/java/org/apache/ajp/tomcat33/Ajp13Interceptor.java
  
  Index: Ajp13Interceptor.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/ajp/tomcat33/Ajp13Interceptor.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Ajp13Interceptor.java	2001/06/09 02:56:22	1.1
  +++ Ajp13Interceptor.java	2001/06/09 03:13:26	1.2
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/ajp/tomcat33/Ajp13Interceptor.java,v 1.1 2001/06/09 02:56:22 costin Exp $
  - * $Revision: 1.1 $
  - * $Date: 2001/06/09 02:56:22 $
  + * $Header: /home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/ajp/tomcat33/Ajp13Interceptor.java,v 1.2 2001/06/09 03:13:26 costin Exp $
  + * $Revision: 1.2 $
  + * $Date: 2001/06/09 03:13:26 $
    *
    * ====================================================================
    *
  @@ -183,7 +183,7 @@
           try {
   	    // close the socket connection before handling any signal
   	    // but get the addresses first so they are not corrupted			
  -            if(Ajp12.isSameAddress(serverAddr, clientAddr)) {
  +            if(isSameAddress(serverAddr, clientAddr)) {
   		cm.stop();
   		// same behavior as in past, because it seems that
   		// stopping everything doesn't work - need to figure
  @@ -196,6 +196,41 @@
   	log("Shutdown command ignored");
   	return false;
       }
  +
  +    /**
  +     * Return <code>true</code> if the specified client and server addresses
  +     * are the same.  This method works around a bug in the IBM 1.1.8 JVM on
  +     * Linux, where the address bytes are returned reversed in some
  +     * circumstances.
  +     *
  +     * @param server The server's InetAddress
  +     * @param client The client's InetAddress
  +     */
  +    public static boolean isSameAddress(InetAddress server, InetAddress client) {
  +	// Compare the byte array versions of the two addresses
  +	byte serverAddr[] = server.getAddress();
  +	byte clientAddr[] = client.getAddress();
  +	if (serverAddr.length != clientAddr.length)
  +	    return (false);
  +	boolean match = true;
  +	for (int i = 0; i < serverAddr.length; i++) {
  +	    if (serverAddr[i] != clientAddr[i]) {
  +		match = false;
  +		break;
  +	    }
  +	}
  +	if (match)
  +	    return (true);
  +
  +	// Compare the reversed form of the two addresses
  +	for (int i = 0; i < serverAddr.length; i++) {
  +	    if (serverAddr[i] != clientAddr[(serverAddr.length-1)-i])
  +		return (false);
  +	}
  +	return (true);
  +    }
  +
  +
       
   }