Changeset 6269


Ignore:
Timestamp:
2003-12-16T11:09:46+13:00 (20 years ago)
Author:
mdewsnip
Message:

Added improvements to tidy_URL to work with https, thanks to Doug Carter.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/src/java/org/nzdl/gsdl/Phind/Phind.java

    r3178 r6269  
    498498        // the address has all the necessary components
    499499    } else if (address.startsWith("/")) {
    500         // there is not protocol and host
     500        // there is no protocol and host
    501501        URL document = getDocumentBase();
     502        String protocol = document.getProtocol();
     503        String host = document.getHost();
    502504        String port = "";
    503505        if (document.getPort()!=-1) {
    504506        port = ":" + document.getPort();
    505507        }
    506         address = "http://" + document.getHost() + port + address;
     508        address = protocol + "://" + host + port + address;
    507509    } else {
    508510        // this URL is relative to the directory the document is in
    509511        URL document = getDocumentBase();
     512        String protocol = document.getProtocol();
     513        String host = document.getHost();
    510514        String directory = document.getFile();
    511515        int end = directory.lastIndexOf('/');
    512516        String port = "";
    513         if (document.getPort()!=-1) {
     517        if (document.getPort() != -1) {
    514518        port = ":" + document.getPort();
    515519        }
    516         directory = directory.substring(0,end + 1);
    517         address = "http://" + document.getHost() + port + directory + address;
    518 
    519     }
    520 
    521     // if the URL is a cgi script, make sure it has a "?" in ti,
     520        directory = directory.substring(0, end + 1);
     521        address = protocol + "://" + host + port + directory + address;
     522    }
     523
     524    // if the URL is a cgi script, make sure it has a "?" in it,
    522525    // and that it ends with a "?" or "&"
    523526    if (isCGI) {
Note: See TracChangeset for help on using the changeset viewer.