Github user mike-jumper commented on a diff in the pull request:

    
https://github.com/apache/incubator-guacamole-client/pull/109#discussion_r97835616
  
    --- Diff: guacamole/src/main/java/org/apache/guacamole/rest/APIRequest.java 
---
    @@ -58,6 +68,27 @@ public APIRequest(HttpServletRequest request,
     
             super(request);
     
    +        // Try a few methods to get client info.
    +        if(request.getHeader("X-Guacamole-Client-Hostname") != null && 
request.getHeader("X-Guacamole-Client-Hostname") != "") {
    +            this.remoteHost = 
request.getHeader("X-Guacamole-Client-Hostname");
    +        } else if(request.getHeader("X-Forwarded-For") != null && 
request.getHeader("X-Forwarded-For") != "") {
    +            this.remoteHost = request.getHeader("X-Forwarded-For");
    +        } else if(request.getRemoteHost() != null && 
request.getRemoteHost() != "") {
    +            this.remoteHost = request.getRemoteHost();
    +        } else {
    +            this.remoteHost = "";
    +        }
    +
    +        if(request.getHeader("X-Guacamole-Client-IP") != null && 
request.getHeader("X-Guacamole-Client-IP") != "") {
    --- End diff --
    
    Please follow the same style as the other code in guacamole-client for the 
sake of readability. There should be a space between the `if` and the `(`, as 
`if` is not a function, and we try to avoid:
    
    * Using braces when unnecessary (unless it hurts readability)
    * Cuddling the brace with the `else` or `else if`
    
    If unclear, we also have [general style 
guidelines](http://guacamole.incubator.apache.org/guac-style/), but the best 
way is usually to simply take a quick look around and make sure your code 
doesn't stand out.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to