diff options
author | Dariusz Bywalec <dariusz.bywalec@trapezegroup.pl> | 2014-12-02 17:11:50 +0100 |
---|---|---|
committer | Dariusz Bywalec <dariusz.bywalec@trapezegroup.pl> | 2014-12-02 17:30:14 +0100 |
commit | d86f4a0860704e3bda77fa9622a8d0210265b616 (patch) | |
tree | 4e8e4cb912d6d6024e94dc1bb9efd90c44e7b6c2 /src/main/java/com | |
parent | 9f92fb94aa403928a2efe5e673e118b3b02ba291 (diff) | |
download | gitblit-d86f4a0860704e3bda77fa9622a8d0210265b616.tar.gz gitblit-d86f4a0860704e3bda77fa9622a8d0210265b616.zip |
Add support for configurable HTTP proxy host/port in PluginManager.java
Formerly by default the PluginMaganer would support no proxy setting.
For servers behind firewall and HTTP proxy this would prevent installation of gitblit plugins.
Diffstat (limited to 'src/main/java/com')
-rw-r--r-- | src/main/java/com/gitblit/manager/PluginManager.java | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/main/java/com/gitblit/manager/PluginManager.java b/src/main/java/com/gitblit/manager/PluginManager.java index 3e7bc1ff..a43cbdc8 100644 --- a/src/main/java/com/gitblit/manager/PluginManager.java +++ b/src/main/java/com/gitblit/manager/PluginManager.java @@ -22,6 +22,7 @@ import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.net.HttpURLConnection; +import java.net.InetSocketAddress; import java.net.Proxy; import java.net.URL; import java.net.URLConnection; @@ -586,7 +587,14 @@ public class PluginManager implements IPluginManager, PluginStateListener { } protected Proxy getProxy(URL url) { - return java.net.Proxy.NO_PROXY; + String proxyHost = runtimeManager.getSettings().getString(Keys.plugins.httpProxyHost, ""); + String proxyPort = runtimeManager.getSettings().getString(Keys.plugins.httpProxyPort, ""); + + if (!StringUtils.isEmpty(proxyHost) && !StringUtils.isEmpty(proxyPort)) { + return new Proxy(Proxy.Type.HTTP, new InetSocketAddress(proxyHost, Integer.parseInt(proxyPort))); + } else { + return java.net.Proxy.NO_PROXY; + } } protected String getProxyAuthorization(URL url) { |