You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2022/10/06 11:19:35 UTC
[tomcat] branch 10.0.x updated: Refactor to reduce code duplication
This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch 10.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/10.0.x by this push:
new 20c8a0cdea Refactor to reduce code duplication
20c8a0cdea is described below
commit 20c8a0cdea53fb3c946a6fddb3569a7df5aa12ab
Author: Mark Thomas <ma...@apache.org>
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 8ea7c42a8f..fcf6e25fa5 100644
--- a/java/org/apache/catalina/filters/RemoteIpFilter.java
+++ b/java/org/apache/catalina/filters/RemoteIpFilter.java
@@ -46,6 +46,7 @@ import org.apache.catalina.connector.RequestFacade;
import org.apache.catalina.util.RequestUtil;
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;
@@ -708,7 +709,10 @@ public class RemoteIpFilter extends GenericFilter {
*
* @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 "";
@@ -855,13 +859,13 @@ public class RemoteIpFilter extends GenericFilter {
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: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org