Ignore:
Timestamp:
2017-08-02T20:17:30+12:00 (7 years ago)
Author:
ak19
Message:
  1. Adding new Java class URLConnectionManager to get an (Http)URLConnection depending on whether you're using a proxy or not, whether the URL is over Http or Https, and whether to set the no_check_certificate setting for Https URLs. Additional methods to set or unset this flag globally on all subsequent URL connections. 2. DownloadPane.getRedirectURL() now calls this and avoids the SSLHandShakeException discovered on Toro yesterday: not just wget but also Java code that makes a URL connection to an Https site that does not have a valid certificate will need to have no_check_certificate turned on if we want to download from there. Even if getRedirectURL() is found to no longer be useful, the new class URLConnectionManager is reusable. 4. Adding GS copyright header to SafeProcess.java.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/gli/src/org/greenstone/gatherer/gui/DownloadPane.java

    r31839 r31843  
    5555import org.greenstone.gatherer.util.StaticStrings;
    5656import org.greenstone.gatherer.util.Utility;
     57import org.greenstone.gatherer.download.URLConnectionManager;
    5758import org.greenstone.gatherer.download.Download;
    5859import org.greenstone.gatherer.download.DownloadScrollPane;
     
    616617    if(url_str.startsWith("http:") || url_str.startsWith("https:")) { // only test http urls
    617618        try {
    618         URL url = new URL(url_str);
    619         if(this.proxyObject == null) {
    620             connection = (HttpURLConnection)url.openConnection(); //new HttpURLConnection(url);
    621         } else {
    622             connection = (HttpURLConnection)url.openConnection(proxyObject);
    623         }
     619        // URLConnectionManager class has special handling for https URLs,
     620        // so you can control whether you want it to check an HTTPS site's security certificates for you or not
     621        boolean noCheckCertificates = true;
     622        connection = (HttpURLConnection)URLConnectionManager.getConnection(url_str, this.proxyObject, noCheckCertificates);
     623       
    624624        // don't let it automatically follow redirects, since we want to
    625625        // find out whether we are dealing with redirects in the first place
     
    700700    }
    701701
    702    
     702    // TODO: Still need to read up on and test how to set wget proxy on windows
     703    // Need to be on a windows machine that requires proxy, and get wget to work on cmdline
     704    // If that works, then need to check https URLS also work.
     705    // See https://superuser.com/questions/526710/how-to-set-http-proxy-address-for-wget-under-windows
    703706    private boolean checkProxy(){
    704707     
Note: See TracChangeset for help on using the changeset viewer.