axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d..@apache.org
Subject cvs commit: xml-axis/java/src/org/apache/axis/utils tcpmon.java
Date Thu, 18 Oct 2001 13:16:25 GMT
dug         01/10/18 06:16:25

  Modified:    java/src/org/apache/axis/utils tcpmon.java
  Log:
  Add http proxy support to tcpmon.
  Missing function noticed by Mark.Volkmann@agedwards.com
  
  Revision  Changes    Path
  1.16      +43 -10    xml-axis/java/src/org/apache/axis/utils/tcpmon.java
  
  Index: tcpmon.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/utils/tcpmon.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- tcpmon.java	2001/10/12 11:51:41	1.15
  +++ tcpmon.java	2001/10/18 13:16:25	1.16
  @@ -377,6 +377,10 @@
           SocketRR     rr2 = null ;
           InputStream  inputStream ;
   
  +        String       proxyHost = null ;
  +        int          proxyPort = 80 ;
  +
  +
           public Connection(Listener l, Socket s ) {
               listener = l ;
               inSocket = s ;
  @@ -393,6 +397,17 @@
               try {
                   active        = true ;
   
  +                proxyHost = System.getProperty( "http.proxyHost" );
  +                if ( proxyHost != null && proxyHost.equals("") )
  +                    proxyHost = null ;
  +                
  +                if ( proxyHost != null ) {
  +                    String tmp = System.getProperty( "http.proxyPort" );
  +                    if ( tmp != null && tmp.equals("") ) tmp = null ;
  +                    if ( tmp == null ) proxyPort = 80 ;
  +                    else proxyPort = Integer.parseInt( tmp );
  +                }
  +
                   if ( inSocket != null ) {
                     InetAddress  h  = inSocket.getInetAddress();
                     fromHost      = h.getHostName();
  @@ -449,7 +464,7 @@
                   String         bufferedData = null ;
                   StringBuffer   buf = null ;
   
  -                if ( listener.isProxyBox.isSelected() ) {
  +                if ( listener.isProxyBox.isSelected() || proxyHost != null ) {
                       // Check if we're a proxy
                       int          ch ;
                       byte[]       b = new byte[1];
  @@ -480,17 +495,35 @@
                           end   = bufferedData.indexOf( ' ', start );
                           String tmp = bufferedData.substring( start, end );
                           if ( tmp.charAt(0) == '/' ) tmp = tmp.substring(1);
  -                        url = new URL( tmp );
  -                        targetHost = url.getHost();
  -                        targetPort = url.getPort();
  -                        if ( targetPort == -1 ) targetPort = 80 ;
  +
                           int index = listener.connections.indexOf( this );
  -                        listener.tableModel.setValueAt( targetHost, index+1, 
  -                                                        OUTHOST_COLUMN );
  +
  +                        if ( listener.isProxyBox.isSelected() ) {
  +                            url = new URL( tmp );
  +                            targetHost = url.getHost();
  +                            targetPort = url.getPort();
  +                            if ( targetPort == -1 ) targetPort = 80 ;
  +
  +                            listener.tableModel.setValueAt( targetHost, index+1,
  +                                                            OUTHOST_COLUMN );
  +                            bufferedData = bufferedData.substring( 0, start) +
  +                                           url.getFile() +
  +                                           bufferedData.substring( end );
  +                        }
  +                        else {
  +                            url = new URL( "http://" + targetHost + ":" + 
  +                                           targetPort + "/" + tmp );
  +
  +                            listener.tableModel.setValueAt( targetHost, index+1,
  +                                                            OUTHOST_COLUMN );
  +                            bufferedData = bufferedData.substring( 0, start) +
  +                                           url.toExternalForm() + 
  +                                           bufferedData.substring( end );
  +
  +                            targetHost = proxyHost ;
  +                            targetPort = proxyPort ;
  +                        }
   
  -                        bufferedData = bufferedData.substring( 0, start) +
  -                                       url.getFile() +
  -                                       bufferedData.substring( end );
                       }
                   }
   
  
  
  

Mime
View raw message