mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 05:07:41 +00:00
GUACAMOLE-38: Handle encoded query parameters.
This commit is contained in:
@@ -19,16 +19,21 @@
|
||||
|
||||
package org.apache.guacamole.auth.quickconnect.utility;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.lang.StringBuilder;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URLDecoder;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import org.apache.guacamole.GuacamoleClientException;
|
||||
import org.apache.guacamole.GuacamoleServerException;
|
||||
import org.apache.guacamole.GuacamoleException;
|
||||
import org.apache.guacamole.protocol.GuacamoleConfiguration;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* A utility class to parse out a URI into the settings necessary
|
||||
@@ -36,6 +41,11 @@ import org.apache.guacamole.protocol.GuacamoleConfiguration;
|
||||
*/
|
||||
public class QCParser {
|
||||
|
||||
/**
|
||||
* Logger for this class.
|
||||
*/
|
||||
private final static Logger logger = LoggerFactory.getLogger(QCParser.class);
|
||||
|
||||
/**
|
||||
* The default protocol to parse to if one is provided in
|
||||
* the incoming URI..
|
||||
@@ -131,7 +141,14 @@ public class QCParser {
|
||||
if (paramList != null) {
|
||||
for (String parameter : paramList) {
|
||||
String[] paramArray = parameter.split("=", 2);
|
||||
qcConfig.setParameter(paramArray[0],paramArray[1]);
|
||||
try {
|
||||
qcConfig.setParameter(URLDecoder.decode(paramArray[0], "UTF-8"),
|
||||
URLDecoder.decode(paramArray[1], "UTF-8"));
|
||||
}
|
||||
catch (UnsupportedEncodingException e) {
|
||||
logger.error("Unexpected lack of UTF-8 encoding support.");
|
||||
throw new GuacamoleServerException("Unexpected lack of UTF-8 encoding support.", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user