You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by og...@apache.org on 2008/09/19 00:44:50 UTC

svn commit: r696840 - /maven/sandbox/trunk/mercury/mercury-transport/mercury-transport-http/src/main/java/org/apache/maven/mercury/spi/http/client/DestinationRealmResolver.java

Author: ogusakov
Date: Thu Sep 18 15:44:50 2008
New Revision: 696840

URL: http://svn.apache.org/viewvc?rev=696840&view=rev
Log:
fixed stupid java URL implementation bug

Modified:
    maven/sandbox/trunk/mercury/mercury-transport/mercury-transport-http/src/main/java/org/apache/maven/mercury/spi/http/client/DestinationRealmResolver.java

Modified: maven/sandbox/trunk/mercury/mercury-transport/mercury-transport-http/src/main/java/org/apache/maven/mercury/spi/http/client/DestinationRealmResolver.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/mercury/mercury-transport/mercury-transport-http/src/main/java/org/apache/maven/mercury/spi/http/client/DestinationRealmResolver.java?rev=696840&r1=696839&r2=696840&view=diff
==============================================================================
--- maven/sandbox/trunk/mercury/mercury-transport/mercury-transport-http/src/main/java/org/apache/maven/mercury/spi/http/client/DestinationRealmResolver.java (original)
+++ maven/sandbox/trunk/mercury/mercury-transport/mercury-transport-http/src/main/java/org/apache/maven/mercury/spi/http/client/DestinationRealmResolver.java Thu Sep 18 15:44:50 2008
@@ -55,7 +55,14 @@
     {
        InetSocketAddress address = dest.getAddress();
        boolean secure = dest.isSecure();
-       
+
+       if( log.isDebugEnabled() )
+       {
+         log.debug("Dest "+address.getHostName()+":"+address.getPort()+"(secure="+secure+")" );
+         log.debug("Server list: "+_servers );
+         
+       }
+
        //get a username and password appropriate for the destination. Usernames and passwords are
        //associated with Server Credential objects.
        Server server = null;
@@ -68,8 +75,16 @@
                String protocol = s.getURL().getProtocol();
                String host = s.getURL().getHost();
                int port = s.getURL().getPort();
+               if( port == -1 )
+               {
+                 port = "https".equalsIgnoreCase( protocol ) ? 443 : 80;
+               }
+
+               if( log.isDebugEnabled() )
+                 log.debug("Trying dest "+address.getHostName()+":"+address.getPort()+"(secure="+dest.isSecure()
+                     +") against server "+protocol+"://"+host+":"+port );
 
-               if (((dest.isSecure() && "https".equalsIgnoreCase(protocol)) || (!dest.isSecure() && "http".equalsIgnoreCase(protocol)))
+               if (((secure && "https".equalsIgnoreCase(protocol)) || (!secure && "http".equalsIgnoreCase(protocol)))
                    &&
                    (address.getPort() == port))
                {