From 91acc355fee5232b3e2089cd6cb7b1214c1207b0 Mon Sep 17 00:00:00 2001 From: Steven Oliver <oliver.steven@gmail.com> Date: Fri, 02 Jan 2015 21:00:52 -0500 Subject: [PATCH] GitBlit no longer uses Google charts --- src/main/java/com/gitblit/manager/PluginManager.java | 19 ++++++++++++++++--- 1 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/gitblit/manager/PluginManager.java b/src/main/java/com/gitblit/manager/PluginManager.java index 5830375..bc3be52 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.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; @@ -440,6 +441,10 @@ protected File download(String url, boolean verifyChecksum) throws IOException { File file = downloadFile(url); + if (!verifyChecksum) { + return file; + } + File sha1File = null; try { sha1File = downloadFile(url + ".sha1"); @@ -453,7 +458,7 @@ } - if (sha1File == null && md5File == null && verifyChecksum) { + if (sha1File == null && md5File == null) { throw new IOException("Missing SHA1 and MD5 checksums for " + url); } @@ -582,11 +587,19 @@ } 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) { - return ""; + String proxyAuth = runtimeManager.getSettings().getString(Keys.plugins.httpProxyAuthorization, ""); + return proxyAuth; } /** -- Gitblit v1.9.1