This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch 8.5.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/8.5.x by this push:
new 80feb95a6a Refactor to reduce code duplication
80feb95a6a is described below
commit 80feb95a6ad6ab1f87e0c038a4d88ea3d7f0e5eb
Author: Mark Thomas <[email protected]>
AuthorDate: Thu Oct 6 11:58:36 2022 +0100
Refactor to reduce code duplication
---
java/org/apache/catalina/filters/RemoteIpFilter.java | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/java/org/apache/catalina/filters/RemoteIpFilter.java
b/java/org/apache/catalina/filters/RemoteIpFilter.java
index b9916578c7..52c62ed0c5 100644
--- a/java/org/apache/catalina/filters/RemoteIpFilter.java
+++ b/java/org/apache/catalina/filters/RemoteIpFilter.java
@@ -42,6 +42,7 @@ import org.apache.catalina.AccessLog;
import org.apache.catalina.Globals;
import org.apache.juli.logging.Log;
import org.apache.juli.logging.LogFactory;
+import org.apache.tomcat.util.buf.StringUtils;
import org.apache.tomcat.util.http.FastHttpDateFormat;
import org.apache.tomcat.util.http.parser.Host;
import org.apache.tomcat.util.res.StringManager;
@@ -705,7 +706,10 @@ public class RemoteIpFilter implements Filter {
*
* @param stringList List of strings
* @return concatenated string
+ *
+ * @deprecated Unused. Will be removed in Tomcat 11 onwards
*/
+ @Deprecated
protected static String listToCommaDelimitedString(List<String>
stringList) {
if (stringList == null) {
return "";
@@ -857,13 +861,13 @@ public class RemoteIpFilter implements Filter {
if (proxiesHeaderValue.size() == 0) {
xRequest.removeHeader(proxiesHeader);
} else {
- String commaDelimitedListOfProxies =
listToCommaDelimitedString(proxiesHeaderValue);
+ String commaDelimitedListOfProxies =
StringUtils.join(proxiesHeaderValue);
xRequest.setHeader(proxiesHeader,
commaDelimitedListOfProxies);
}
if (newRemoteIpHeaderValue.size() == 0) {
xRequest.removeHeader(remoteIpHeader);
} else {
- String commaDelimitedRemoteIpHeaderValue =
listToCommaDelimitedString(newRemoteIpHeaderValue);
+ String commaDelimitedRemoteIpHeaderValue =
StringUtils.join(newRemoteIpHeaderValue);
xRequest.setHeader(remoteIpHeader,
commaDelimitedRemoteIpHeaderValue);
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]