1 package org.apache.maven.wagon.providers.http;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import org.apache.maven.wagon.ConnectionException;
23 import org.apache.maven.wagon.authentication.AuthenticationException;
24 import org.apache.maven.wagon.proxy.ProxyInfo;
25
26
27
28
29
30
31
32
33
34
35
36 public class LightweightHttpsWagon
37 extends LightweightHttpWagon
38 {
39 private String previousHttpsProxyHost;
40
41 private String previousHttpsProxyPort;
42
43 private String previousHttpsProxyExclusions;
44
45 public LightweightHttpsWagon()
46 {
47 super();
48 }
49
50 public void openConnection()
51 throws ConnectionException, AuthenticationException
52 {
53 previousHttpsProxyHost = System.getProperty( "https.proxyHost" );
54 previousHttpsProxyPort = System.getProperty( "https.proxyPort" );
55 previousHttpsProxyExclusions = System.getProperty( "https.nonProxyHosts" );
56
57 final ProxyInfo proxyInfo = getProxyInfo( "https", getRepository().getHost() );
58 if ( proxyInfo != null )
59 {
60 setSystemProperty( "https.proxyHost", proxyInfo.getHost() );
61 setSystemProperty( "https.proxyPort", String.valueOf( proxyInfo.getPort() ) );
62 setSystemProperty( "https.nonProxyHosts", proxyInfo.getNonProxyHosts() );
63 }
64 else
65 {
66 setSystemProperty( "https.proxyHost", null );
67 setSystemProperty( "https.proxyPort", null );
68 }
69
70 super.openConnection();
71 }
72
73 public void closeConnection()
74 throws ConnectionException
75 {
76 super.closeConnection();
77
78 setSystemProperty( "https.proxyHost", previousHttpsProxyHost );
79 setSystemProperty( "https.proxyPort", previousHttpsProxyPort );
80 setSystemProperty( "https.nonProxyHosts", previousHttpsProxyExclusions );
81 }
82 }