grr, add an all trusting ssl handler when downloading plugin from github

This commit is contained in:
kimchy 2011-07-18 23:05:58 +03:00
parent d905e62209
commit a3c05a35bb
1 changed files with 6 additions and 6 deletions

View File

@ -107,40 +107,40 @@ public class PluginManager {
pluginFile = new File(environment.pluginsFile(), name + ".zip"); pluginFile = new File(environment.pluginsFile(), name + ".zip");
if (version == null) { if (version == null) {
// try with ES version from downloads // try with ES version from downloads
URL pluginUrl = new URL("http://github.com/downloads/" + userName + "/" + repoName + "/" + repoName + "-" + Version.number() + ".zip"); URL pluginUrl = new URL("https://github.com/downloads/" + userName + "/" + repoName + "/" + repoName + "-" + Version.number() + ".zip");
System.out.println("Trying " + pluginUrl.toExternalForm() + "..."); System.out.println("Trying " + pluginUrl.toExternalForm() + "...");
try { try {
downloadHelper.download(pluginUrl, pluginFile, new HttpDownloadHelper.VerboseProgress(System.out)); downloadHelper.download(pluginUrl, pluginFile, new HttpDownloadHelper.VerboseProgress(System.out));
downloaded = true; downloaded = true;
} catch (IOException e) { } catch (IOException e) {
// try a tag with ES version // try a tag with ES version
pluginUrl = new URL("http://github.com/" + userName + "/" + repoName + "/zipball/v" + Version.number()); pluginUrl = new URL("https://github.com/" + userName + "/" + repoName + "/zipball/v" + Version.number());
System.out.println("Trying " + pluginUrl.toExternalForm() + "..."); System.out.println("Trying " + pluginUrl.toExternalForm() + "...");
try { try {
downloadHelper.download(pluginUrl, pluginFile, new HttpDownloadHelper.VerboseProgress(System.out)); downloadHelper.download(pluginUrl, pluginFile, new HttpDownloadHelper.VerboseProgress(System.out));
downloaded = true; downloaded = true;
} catch (IOException e1) { } catch (IOException e1) {
// download master // download master
pluginUrl = new URL("http://github.com/" + userName + "/" + repoName + "/zipball/master"); pluginUrl = new URL("https://github.com/" + userName + "/" + repoName + "/zipball/master");
System.out.println("Trying " + pluginUrl.toExternalForm() + "..."); System.out.println("Trying " + pluginUrl.toExternalForm() + "...");
try { try {
downloadHelper.download(pluginUrl, pluginFile, new HttpDownloadHelper.VerboseProgress(System.out)); downloadHelper.download(pluginUrl, pluginFile, new HttpDownloadHelper.VerboseProgress(System.out));
downloaded = true; downloaded = true;
} catch (IOException e2) { } catch (IOException e2) {
e2.printStackTrace(); // ignore
} }
} }
} }
} else { } else {
// download explicit version // download explicit version
URL pluginUrl = new URL("http://github.com/downloads/" + userName + "/" + repoName + "/" + repoName + "-" + version + ".zip"); URL pluginUrl = new URL("https://github.com/downloads/" + userName + "/" + repoName + "/" + repoName + "-" + version + ".zip");
System.out.println("Trying " + pluginUrl.toExternalForm() + "..."); System.out.println("Trying " + pluginUrl.toExternalForm() + "...");
try { try {
downloadHelper.download(pluginUrl, pluginFile, new HttpDownloadHelper.VerboseProgress(System.out)); downloadHelper.download(pluginUrl, pluginFile, new HttpDownloadHelper.VerboseProgress(System.out));
downloaded = true; downloaded = true;
} catch (IOException e) { } catch (IOException e) {
// try a tag with ES version // try a tag with ES version
pluginUrl = new URL("http://github.com/" + userName + "/" + repoName + "/zipball/v" + version); pluginUrl = new URL("https://github.com/" + userName + "/" + repoName + "/zipball/v" + version);
System.out.println("Trying " + pluginUrl.toExternalForm() + "..."); System.out.println("Trying " + pluginUrl.toExternalForm() + "...");
try { try {
downloadHelper.download(pluginUrl, pluginFile, new HttpDownloadHelper.VerboseProgress(System.out)); downloadHelper.download(pluginUrl, pluginFile, new HttpDownloadHelper.VerboseProgress(System.out));