From b719cc9de2c34561a80f879627e855d7bf254b94 Mon Sep 17 00:00:00 2001 From: Pierre-Luc Paour Date: Mon, 28 Feb 2005 08:20:57 +0000 Subject: [PATCH] 2005-02-28 Pierre-Luc Paour (1.4.2-b11) * Fixed setting proxy info for downloading images already on server. * Yet another attempt at fixing applet URL logic. Added a manual gr_url_override applet parameter as a fix for people whose Gallery URLs hopelessly confuse GR. * Applet jars are signed with the new cert, which expires in 2007. --- ChangeLog | 10 +++++++ com/gallery/GalleryRemote/GRApplet.java | 30 ++++++++++++++------ com/gallery/GalleryRemote/GalleryComm.java | 14 ++++++++- com/gallery/GalleryRemote/model/Gallery.java | 8 +++++- defaults.properties | 4 +-- 5 files changed, 53 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index b3c4c0e..2bfa690 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2005-02-28 Pierre-Luc Paour (1.4.2-b11) + + * Fixed setting proxy info for downloading images already + on server. + * Yet another attempt at fixing applet URL logic. Added a + manual gr_url_override applet parameter as a fix + for people whose Gallery URLs hopelessly confuse GR. + * Applet jars are signed with the new cert, which expires + in 2007. + 2005-01-23 Pierre-Luc Paour (1.4.2-b10) * Fixed mis-caching of files downloaded from the server diff --git a/com/gallery/GalleryRemote/GRApplet.java b/com/gallery/GalleryRemote/GRApplet.java index 223614a..6d08719 100644 --- a/com/gallery/GalleryRemote/GRApplet.java +++ b/com/gallery/GalleryRemote/GRApplet.java @@ -90,6 +90,7 @@ protected AppletInfo getGRAppletInfo() { String url = getParameter("gr_url"); String urlFull = getParameter("gr_url_full"); + String urlOverride = getParameter("gr_url_override"); String cookieName = getParameter("gr_cookie_name"); String cookieValue = getParameter("gr_cookie_value"); String cookieDomain = getParameter("gr_cookie_domain"); @@ -101,6 +102,7 @@ protected AppletInfo getGRAppletInfo() { Log.log(Log.LEVEL_INFO, MODULE, "Applet parameters:"); Log.log(Log.LEVEL_INFO, MODULE, "gr_url: " + url); Log.log(Log.LEVEL_INFO, MODULE, "gr_url_full: " + urlFull); + Log.log(Log.LEVEL_INFO, MODULE, "gr_url_override: " + urlOverride); Log.log(Log.LEVEL_INFO, MODULE, "gr_cookie_name: " + cookieName); Log.log(Log.LEVEL_INFO, MODULE, "gr_cookie_domain: " + cookieDomain); Log.log(Log.LEVEL_INFO, MODULE, "gr_cookie_path: " + cookiePath); @@ -126,7 +128,11 @@ protected AppletInfo getGRAppletInfo() { } } - if (urlFull != null) { + if (urlOverride != null) { + info.gallery.setType(Gallery.TYPE_APPLET); + info.gallery.setApUrlString(urlOverride); + urlFull = urlOverride; + } else if (urlFull != null) { // the server specified a full URL, we're probably in embedded mode // and we have to recreate the URL @@ -151,19 +157,25 @@ protected AppletInfo getGRAppletInfo() { Log.log(Log.LEVEL_TRACE, MODULE, "urlFull is not a valid URL: recomposing it from documentBase"); try { - - String path = documentBase.getPath(); - int i = path.lastIndexOf("/"); - if (i != -1) { - path = path.substring(0, i); + String path = null; + + if (urlFull.startsWith("/")) { + path = urlFull; + } else { + path = documentBase.getPath(); + int i = path.lastIndexOf("/"); + if (i != -1) { + path = path.substring(0, i); + } + + path += "/" + urlFull; } urlFull = new URL(documentBase.getProtocol(), documentBase.getHost(), documentBase.getPort(), - path + "/" + urlFull).toString(); + path).toString(); info.gallery.setType(Gallery.TYPE_APPLET); info.gallery.setApUrlString(urlFull); - info.gallery.setUserAgent(userAgent); Log.log(Log.LEVEL_TRACE, MODULE, "Full URL: " + urlFull); } catch (MalformedURLException ee) { @@ -177,9 +189,9 @@ protected AppletInfo getGRAppletInfo() { // old versions of Gallery, or bad urlFull info.gallery.setType(Gallery.TYPE_STANDALONE); info.gallery.setStUrlString(url); - info.gallery.setUserAgent(userAgent); } + info.gallery.setUserAgent(userAgent); info.gallery.cookieLogin = true; CookieModule.discardAllCookies(); diff --git a/com/gallery/GalleryRemote/GalleryComm.java b/com/gallery/GalleryRemote/GalleryComm.java index 9261076..f2dea61 100644 --- a/com/gallery/GalleryRemote/GalleryComm.java +++ b/com/gallery/GalleryRemote/GalleryComm.java @@ -38,6 +38,7 @@ import java.net.URL; import java.net.UnknownHostException; import java.util.StringTokenizer; +import java.util.Properties; /** * This interface is a temporary mechanism to let us use version @@ -81,17 +82,22 @@ public boolean sendCookie(Cookie cookie, RoRequest req) { } }); + // http://cvs.sourceforge.net/viewcvs.py/jameleon/jameleon/src/java/net/sf/jameleon/util/JsseSettings.java?rev=1.4&view=markup + // http://tp.its.yale.edu/pipermail/cas/2004-March/000348.html // Create a trust manager that does not validate certificate chains TrustManager[] trustAllCerts = new TrustManager[]{ new X509TrustManager() { public java.security.cert.X509Certificate[] getAcceptedIssuers() { - return null; + Log.log(Log.LEVEL_INFO, MODULE, "TrustManager.getAcceptedIssuers"); + return new java.security.cert.X509Certificate[0]; } public void checkClientTrusted( java.security.cert.X509Certificate[] certs, String authType) { + Log.log(Log.LEVEL_INFO, MODULE, "TrustManager.checkClientTrusted"); } public void checkServerTrusted( java.security.cert.X509Certificate[] certs, String authType) { + Log.log(Log.LEVEL_INFO, MODULE, "TrustManager.checkServerTrusted"); } } }; @@ -246,6 +252,12 @@ public static GalleryComm getCommInstance(StatusUpdate su, URL url, Gallery g) { AuthorizationInfo.addBasicAuthorization(proxyHost, proxyPort, "", proxyUsername, proxyPassword); } + + // also set Java URLConnection proxy + Properties sprops = System.getProperties(); + sprops.setProperty("http.proxySet", "true"); + sprops.setProperty("http.proxyHost", proxyHost); + sprops.setProperty("http.proxyPort", ""+proxyPort); } else { HTTPConnection.setProxyServer(null, 0); } diff --git a/com/gallery/GalleryRemote/model/Gallery.java b/com/gallery/GalleryRemote/model/Gallery.java index 464c8ae..7157082 100644 --- a/com/gallery/GalleryRemote/model/Gallery.java +++ b/com/gallery/GalleryRemote/model/Gallery.java @@ -115,7 +115,13 @@ public void treeStructureChanged(TreeModelEvent e) { */ public void doUploadFiles(StatusUpdate su) { - getComm(su).uploadFiles(su, true); + GalleryComm comm = getComm(su); + + if (comm != null) { + comm.uploadFiles(su, true); + } else { + // don't worry about it, an error message is displayed somewhere else. + } } public void doFetchAlbums(StatusUpdate su) { diff --git a/defaults.properties b/defaults.properties index df48163..116d528 100644 --- a/defaults.properties +++ b/defaults.properties @@ -242,6 +242,6 @@ updateUrlBeta=http://gallery.sourceforge.net/gallery_remote_version_check_beta.p # # --- Do not edit below this line --- # -version=1.4.2-b10 -releaseDate=2005/01/23 +version=1.4.2-b11 +releaseDate=2005/02/28 aboutText=Gallery Remote\n \n \nA part of the Gallery Open-Source Project\nhttp://gallery.sourceforge.net\n \n \nMaintained by:\n \nPierre-Luc Paour\n \n \nInitial version by Chris Smith\n \n \nContributors:\n \nTim Miller\nDolan Halbrook\nMarkus Cozowicz\nScott Gartner\nAmedeo Paglione\nChris Schwerdt\nSeth Ladd\n \n \nArtwork by Ross A. Reyman\n \n \nBundled software:\n \nImageMagick\nJava look and feel Graphics Repository icons\njpegtran, Guido Vollbeding's version\nMetadataExtractor