You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by di...@apache.org on 2004/06/19 23:11:26 UTC

cvs commit: ws-axis/java/src/org/apache/axis/transport/http CommonsHTTPSender.java

dims        2004/06/19 14:11:26

  Modified:    java/src/org/apache/axis/transport/http
                        CommonsHTTPSender.java
  Log:
  Simplify the logic for setting the proxy
  
  Revision  Changes    Path
  1.25      +14 -10    ws-axis/java/src/org/apache/axis/transport/http/CommonsHTTPSender.java
  
  Index: CommonsHTTPSender.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/transport/http/CommonsHTTPSender.java,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- CommonsHTTPSender.java	28 May 2004 23:22:42 -0000	1.24
  +++ CommonsHTTPSender.java	19 Jun 2004 21:11:26 -0000	1.25
  @@ -285,19 +285,23 @@
           if (port == -1) {
               port = 80;          // even for https
           }
  -        if (tcp.getProxyHost().length() > 0 &&
  -        tcp.getProxyPort().length() > 0 &&
  -        !hostInNonProxyList) {
  +        
  +        if(hostInNonProxyList){
               config.setHost(targetURL.getHost(), port, targetURL.getProtocol());
           } else {
  -            if (tcp.getProxyUser().length() != 0) {
  -                Credentials proxyCred =
  -                new UsernamePasswordCredentials(tcp.getProxyUser(),
  -                tcp.getProxyPassword());
  -                client.getState().setProxyCredentials(null, null, proxyCred);
  +            if (tcp.getProxyHost().length() == 0 ||
  +            tcp.getProxyPort().length() == 0) {
  +                config.setHost(targetURL.getHost(), port, targetURL.getProtocol());
  +            } else {
  +                if (tcp.getProxyUser().length() != 0) {
  +                    Credentials proxyCred =
  +                    new UsernamePasswordCredentials(tcp.getProxyUser(),
  +                    tcp.getProxyPassword());
  +                    client.getState().setProxyCredentials(null, null, proxyCred);
  +                }
  +                int proxyPort = new Integer(tcp.getProxyPort()).intValue();
  +                config.setProxy(tcp.getProxyHost(), proxyPort);
               }
  -            int proxyPort = new Integer(tcp.getProxyPort()).intValue();
  -            config.setProxy(tcp.getProxyHost(), proxyPort);
           }
           return config;
       }