Ignore:
Timestamp:
2019-05-06T16:23:43+12:00 (5 years ago)
Author:
ak19
Message:

Tweak to Friday's commit to URL encode param values: can't use nio.StandardCharsets because our release kit JDK is too old to recognise this import, so hardcoding UTF-8 charset name which is what people used to do in the past. Also updated comments. And removed some unnecessary commented out code from GS2PerlConstructor.java

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/build/GS2PerlConstructor.java

    r33046 r33051  
    2020import java.io.InputStream;
    2121import java.io.IOException;
    22 //import java.io.UnsupportedEncodingException;
    23 //import java.net.URLEncoder;
    24 //import java.nio.charset.StandardCharsets;
    2522import java.util.ArrayList;
    2623import java.util.Vector;
     
    334331        // http://www.cgi101.com/class/ch3/text.html
    335332       
    336         // And need to ensure that special characters won't get clobbered on Windows by perl/CGI.pm (https://www.nntp.perl.org/group/perl.perl5.porters/2016/10/msg240120.html),
    337         // URL encode the query_string, as at https://stackoverflow.com/questions/10786042/java-url-encoding-of-query-string-parameters
    338        
    339         // perl/CGI.pm doesn't like us URL encoding the entire query string such as the equal sign between each paramName and paramValue.
    340         // So we URL encode each paramValue separately, which is done in GS2Construct.java::runCommand()
    341         /*
    342         String old_query_string = this.query_string;
    343         try{
    344             this.query_string = URLEncoder.encode(this.query_string, StandardCharsets.UTF_8.name());
    345             //this.query_string = this.query_string.replace("+","%2B"); // https://stackoverflow.com/questions/1211229/in-a-url-should-spaces-be-encoded-using-20-or
    346         } catch(UnsupportedEncodingException uee) {
    347             logger.warn("**** Unable to encode query_string in UTF-8, so attempting to continue with the unencoded value of query_string");
    348             this.query_string = old_query_string;
    349         }
    350         */
     333        // And since we need to ensure that special characters won't get clobbered on Windows by perl/CGI.pm
     334        // (see https://www.nntp.perl.org/group/perl.perl5.porters/2016/10/msg240120.html),
     335        // each param *value* in QUERY_STRING, not QUERY_STRING in entirety, is further URL encoded,
     336        // as at https://stackoverflow.com/questions/10786042/java-url-encoding-of-query-string-parameters
     337        // This URL encoding of paramValues already happened in GS2Construct.java::runCommand(), so QUERY_STRING is ready now.
    351338       
    352339        String[] envvars = {
Note: See TracChangeset for help on using the changeset viewer.