]> source.dussan.org Git - archiva.git/commitdiff
[MRM-1861] Proxy behaviour issue migrating from 1.3.x to 2.x 16/head
authorEduardo Souza <eduardomatosouza@gmail.com>
Thu, 11 Jun 2015 23:18:45 +0000 (20:18 -0300)
committerEduardo Souza <eduardomatosouza@gmail.com>
Thu, 11 Jun 2015 23:18:45 +0000 (20:18 -0300)
archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/main/java/org/apache/archiva/scheduler/indexing/DownloadRemoteIndexTask.java
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRemoteRepositoriesService.java

index 6a9a396244731f9d1c7940ec861c07cb71be336c..f8fd42a24465ef59912b73310cf34f21e31310ec 100644 (file)
@@ -156,6 +156,7 @@ public class DownloadRemoteIndexTask
             if ( this.networkProxy != null )
             {
                 proxyInfo = new ProxyInfo();
+                proxyInfo.setType( this.networkProxy.getProtocol() );
                 proxyInfo.setHost( this.networkProxy.getHost() );
                 proxyInfo.setPort( this.networkProxy.getPort() );
                 proxyInfo.setUserName( this.networkProxy.getUsername() );
index 64b8043c779d65a5e2f6fcdeb6092663ed5e3e27..c3528eb4b51be38e4508c651d0978a5b13c74b71 100644 (file)
@@ -34,6 +34,7 @@ import org.apache.maven.wagon.Wagon;
 import org.apache.maven.wagon.providers.http.AbstractHttpClientWagon;
 import org.apache.maven.wagon.providers.http.HttpConfiguration;
 import org.apache.maven.wagon.providers.http.HttpMethodConfiguration;
+import org.apache.maven.wagon.proxy.ProxyInfo;
 import org.apache.maven.wagon.repository.Repository;
 import org.springframework.stereotype.Service;
 
@@ -182,8 +183,19 @@ public class DefaultRemoteRepositoriesService
                 HttpConfiguration httpConfiguration = new HttpConfiguration().setGet( httpMethodConfiguration );
                 AbstractHttpClientWagon.class.cast( wagon ).setHttpConfiguration( httpConfiguration );
             }
-
-            wagon.connect( new Repository( remoteRepository.getId(), remoteRepository.getUrl() ) );
+            
+            ProxyInfo proxyInfo = null;
+            if ( networkProxy != null )
+            {
+                proxyInfo = new ProxyInfo();
+                proxyInfo.setType( networkProxy.getProtocol() );
+                proxyInfo.setHost( networkProxy.getHost() );
+                proxyInfo.setPort( networkProxy.getPort() );
+                proxyInfo.setUserName( networkProxy.getUsername() );
+                proxyInfo.setPassword( networkProxy.getPassword() );
+            }            
+
+            wagon.connect( new Repository( remoteRepository.getId(), remoteRepository.getUrl() ), proxyInfo );
 
             // we only check connectivity as remote repo can be empty
             wagon.getFileList( "/" );