Skip to content

Commit

Permalink
Account for more than two IP addresses to be provided
Browse files Browse the repository at this point in the history
  • Loading branch information
guusdk committed Sep 19, 2024
1 parent 5e86840 commit 5899825
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/main/java/org/jivesoftware/site/DownloadStats.java
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ public static void addListingToDatabase( String ipAddress, String product, Strin
{
// Correct for X-Forwarded-For header value sometimes containing a list of IPs. Use the last one.
if (ipAddress != null && ipAddress.contains(",")) {
ipAddress = ipAddress.substring(ipAddress.indexOf(",")+1).trim();
ipAddress = ipAddress.substring(ipAddress.lastIndexOf(",")+1).trim();
}

final DbConnectionManager connectionManager = DbConnectionManager.getInstance();
Expand Down Expand Up @@ -365,7 +365,7 @@ public static void addUpdateToDatabase( String ipAddress, String product, String
{
// Correct for X-Forwarded-For header value sometimes containing a list of IPs. Use the last one.
if (ipAddress != null && ipAddress.contains(",")) {
ipAddress = ipAddress.substring(ipAddress.indexOf(",")+1).trim();
ipAddress = ipAddress.substring(ipAddress.lastIndexOf(",")+1).trim();
}

final DbConnectionManager connectionManager = DbConnectionManager.getInstance();
Expand Down Expand Up @@ -422,7 +422,7 @@ public static void addCheckUpdate( String ipAddress, String os, String currentVe
{
// Correct for X-Forwarded-For header value sometimes containing a list of IPs. Use the last one.
if (ipAddress != null && ipAddress.contains(",")) {
ipAddress = ipAddress.substring(ipAddress.indexOf(",")+1).trim();
ipAddress = ipAddress.substring(ipAddress.lastIndexOf(",")+1).trim();
}

final DbConnectionManager connectionManager = DbConnectionManager.getInstance();
Expand Down

0 comments on commit 5899825

Please sign in to comment.