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 {
|
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.
|
* The regex to use to split username and password.
|
||||||
*/
|
*/
|
||||||
@@ -89,6 +78,8 @@ public class QCParser {
|
|||||||
URI qcUri;
|
URI qcUri;
|
||||||
try {
|
try {
|
||||||
qcUri = new URI(uri);
|
qcUri = new URI(uri);
|
||||||
|
if (!qcUri.isAbsolute())
|
||||||
|
throw new GuacamoleClientException("URI must be absolute.");
|
||||||
}
|
}
|
||||||
catch (URISyntaxException e) {
|
catch (URISyntaxException e) {
|
||||||
throw new GuacamoleClientException("Invalid URI Syntax", e);
|
throw new GuacamoleClientException("Invalid URI Syntax", e);
|
||||||
@@ -108,7 +99,7 @@ public class QCParser {
|
|||||||
if (protocol != null && !protocol.isEmpty())
|
if (protocol != null && !protocol.isEmpty())
|
||||||
qcConfig.setProtocol(protocol);
|
qcConfig.setProtocol(protocol);
|
||||||
else
|
else
|
||||||
qcConfig.setProtocol(DEFAULT_URI_PROTOCOL);
|
throw new GuacamoleClientException("No protocol specified.");
|
||||||
|
|
||||||
// Check for provided port number
|
// Check for provided port number
|
||||||
if (port > 0)
|
if (port > 0)
|
||||||
@@ -118,7 +109,7 @@ public class QCParser {
|
|||||||
if (host != null && !host.isEmpty())
|
if (host != null && !host.isEmpty())
|
||||||
qcConfig.setParameter("hostname", host);
|
qcConfig.setParameter("hostname", host);
|
||||||
else
|
else
|
||||||
qcConfig.setParameter("hostname", DEFAULT_URI_HOST);
|
throw new GuacamoleClientException("No host specified.");
|
||||||
|
|
||||||
// Look for extra query parameters and parse them out.
|
// Look for extra query parameters and parse them out.
|
||||||
if (query != null && !query.isEmpty()) {
|
if (query != null && !query.isEmpty()) {
|
||||||
|
Reference in New Issue
Block a user