rlubke      02/02/10 08:34:33

  Modified:    src/tools/org/apache/watchdog/task GTest.java
  Log:
   - Added logic to replace occurances of |host.ip| in a query string
     with the IP address of the client host where watchdog is running.
     This change is primarily for the GetRemoteAddr tests.
  
  Revision  Changes    Path
  1.3       +15 -3     
jakarta-watchdog-4.0/src/tools/org/apache/watchdog/task/GTest.java
  
  Index: GTest.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-watchdog-4.0/src/tools/org/apache/watchdog/task/GTest.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- GTest.java        4 Feb 2002 12:50:43 -0000       1.2
  +++ GTest.java        10 Feb 2002 16:34:33 -0000      1.3
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-watchdog-4.0/src/tools/org/apache/watchdog/task/GTest.java,v 1.2 
2002/02/04 12:50:43 rlubke Exp $ 
  - * $Revision: 1.2 $
  - * $Date: 2002/02/04 12:50:43 $
  + * $Header: 
/home/cvs/jakarta-watchdog-4.0/src/tools/org/apache/watchdog/task/GTest.java,v 1.3 
2002/02/10 16:34:33 rlubke Exp $ 
  + * $Revision: 1.3 $
  + * $Date: 2002/02/10 16:34:33 $
    *
    * ====================================================================
    * The Apache Software License, Version 1.1
  @@ -431,6 +431,7 @@
        * @exception Exception if an error occurs
        */
       public void setRequest ( String s ) throws Exception {
  +
           this.request = s;
           String addressString = request.substring( request.indexOf( "/" ), 
request.indexOf( "HTTP" ) ).trim();
   
  @@ -915,6 +916,17 @@
               }
           }
   
  +     // replace any occurances of |host.ip| found in the
  +        // query string with the IP of the client host
  +     int startIdx = request.indexOf( "|h" );
  +        int endIdx = request.indexOf( "p|" );
  +     if ( startIdx > -1 && endIdx > -1 ) {
  +         String start = request.substring( 0, startIdx );
  +            String stop  = request.substring( endIdx + 2 );
  +         String inetAddr =  InetAddress.getByName( host ).getHostAddress();
  +         request = start + inetAddr + stop;
  +        }
  +         
           if ( debug > 0 ) {
               System.out.println( " REQUEST: " + request );
           }
  
  
  

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

Reply via email to