mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 05:07:41 +00:00
GUACAMOLE-38: Remove default protocol and port, throw errors if not specified.
This commit is contained in:
@@ -41,17 +41,6 @@ import org.apache.guacamole.protocol.GuacamoleConfiguration;
|
||||
*/
|
||||
public class QCParser {
|
||||
|
||||
/**
|
||||
* The default protocol to use if one is not provided in
|
||||
* the incoming URI.
|
||||
*/
|
||||
public static final String DEFAULT_URI_PROTOCOL = "ssh";
|
||||
|
||||
/**
|
||||
* The default host to use if one is not defined.
|
||||
*/
|
||||
public static final String DEFAULT_URI_HOST = "localhost";
|
||||
|
||||
/**
|
||||
* The regex to use to split username and password.
|
||||
*/
|
||||
@@ -89,6 +78,8 @@ public class QCParser {
|
||||
URI qcUri;
|
||||
try {
|
||||
qcUri = new URI(uri);
|
||||
if (!qcUri.isAbsolute())
|
||||
throw new GuacamoleClientException("URI must be absolute.");
|
||||
}
|
||||
catch (URISyntaxException e) {
|
||||
throw new GuacamoleClientException("Invalid URI Syntax", e);
|
||||
@@ -108,7 +99,7 @@ public class QCParser {
|
||||
if (protocol != null && !protocol.isEmpty())
|
||||
qcConfig.setProtocol(protocol);
|
||||
else
|
||||
qcConfig.setProtocol(DEFAULT_URI_PROTOCOL);
|
||||
throw new GuacamoleClientException("No protocol specified.");
|
||||
|
||||
// Check for provided port number
|
||||
if (port > 0)
|
||||
@@ -118,7 +109,7 @@ public class QCParser {
|
||||
if (host != null && !host.isEmpty())
|
||||
qcConfig.setParameter("hostname", host);
|
||||
else
|
||||
qcConfig.setParameter("hostname", DEFAULT_URI_HOST);
|
||||
throw new GuacamoleClientException("No host specified.");
|
||||
|
||||
// Look for extra query parameters and parse them out.
|
||||
if (query != null && !query.isEmpty()) {
|
||||
|
Reference in New Issue
Block a user