necouchman commented on code in PR #988:
URL: https://github.com/apache/guacamole-client/pull/988#discussion_r1605097332


##########
guacamole-ext/src/main/java/org/apache/guacamole/net/auth/simple/SimpleConnection.java:
##########
@@ -201,13 +243,28 @@ public void setAttributes(Map<String, String> attributes) 
{
     public GuacamoleTunnel connect(GuacamoleClientInformation info)
             throws GuacamoleException {
 
-        // Retrieve proxy configuration from environment
-        Environment environment = LocalEnvironment.getInstance();
-        GuacamoleProxyConfiguration proxyConfig = 
environment.getDefaultGuacamoleProxyConfiguration();
-
-        // Get guacd connection parameters
-        String hostname = proxyConfig.getHostname();
-        int port = proxyConfig.getPort();
+        // check if we have a proxyConfig
+        if (this.proxyConfig == null) {
+            // are there missplaced attributes in connection parameters?
+            if (this.fullConfig.getParameter("proxy-host") == null) {
+                // Retrieve proxy configuration from environment if we don't 
have other proxy configurations
+                logger.debug("load proxy configuration from environment.");
+                this.proxyConfig = 
LocalEnvironment.getInstance().getDefaultGuacamoleProxyConfiguration();
+            }
+            else {
+                this.proxyConfig = new GuacamoleProxyConfiguration(
+                            this.fullConfig.getParameter("proxy-host"),
+                            
Integer.parseInt(this.fullConfig.getParameter("proxy-port")),
+                            GuacamoleProxyConfiguration.EncryptionMethod.NONE
+                    );
+                logger.debug("missplaced proxy configuration found. use it 
anyway.");
+            }

Review Comment:
   I'm not really in favor of doing this - in this case, checking for 
"misplaced attributes in connection parameters" just encourages people to 
intentionally "misplace" attributes in (as) connection parameters. I don't 
think we should enable a mistaken behavior that 1) we don't really want, and 2) 
up to now hasn't been allowed.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to