Author: markt Date: Fri Jun 18 11:19:38 2010 New Revision: 955937 URL: http://svn.apache.org/viewvc?rev=955937&view=rev Log: Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=49443 Use remoteIp... rather then remoteIP... consistently
Modified: tomcat/trunk/java/org/apache/catalina/filters/RemoteIpFilter.java tomcat/trunk/java/org/apache/catalina/valves/RemoteIpValve.java tomcat/trunk/webapps/docs/config/filter.xml tomcat/trunk/webapps/docs/config/valve.xml Modified: tomcat/trunk/java/org/apache/catalina/filters/RemoteIpFilter.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/filters/RemoteIpFilter.java?rev=955937&r1=955936&r2=955937&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/catalina/filters/RemoteIpFilter.java (original) +++ tomcat/trunk/java/org/apache/catalina/filters/RemoteIpFilter.java Fri Jun 18 11:19:38 2010 @@ -64,7 +64,7 @@ import org.apache.juli.logging.LogFactor * If the incoming <code>request.getRemoteAddr()</code> matches the servlet filter's list of internal proxies : * <ul> * <li>Loop on the comma delimited list of IPs and hostnames passed by the preceding load balancer or proxy in the given request's Http - * header named <code>$remoteIPHeader</code> (default value <code>x-forwarded-for</code>). Values are processed in right-to-left order.</li> + * header named <code>$remoteIpHeader</code> (default value <code>x-forwarded-for</code>). Values are processed in right-to-left order.</li> * <li>For each ip/host of the list: * <ul> * <li>if it matches the internal proxies list, the ip/host is swallowed</li> @@ -89,7 +89,7 @@ import org.apache.juli.logging.LogFactor * <th>Default Value</th> * </tr> * <tr> - * <td>remoteIPHeader</td> + * <td>remoteIpHeader</td> * <td>Name of the Http Header read by this servlet filter that holds the list of traversed IP addresses starting from the requesting client * </td> * <td>RemoteIPHeader</td> @@ -110,7 +110,7 @@ import org.apache.juli.logging.LogFactor * <tr> * <td>proxiesHeader</td> * <td>Name of the http header created by this servlet filter to hold the list of proxies that have been processed in the incoming - * <code>remoteIPHeader</code></td> + * <code>remoteIpHeader</code></td> * <td>RemoteIPProxiesHeader</td> * <td>Compliant http header name</td> * <td>x-forwarded-by</td> @@ -176,10 +176,10 @@ import org.apache.juli.logging.LogFactor * <param-name>internalProxies</param-name><param-value>192\.168\.0\.10, 192\.168\.0\.11</param-value> * </init-param> * <init-param> - * <param-name>remoteIPHeader</param-name><param-value>x-forwarded-for</param-value> + * <param-name>remoteIpHeader</param-name><param-value>x-forwarded-for</param-value> * </init-param> * <init-param> - * <param-name>remoteIPProxiesHeader</param-name><param-value>x-forwarded-by</param-value> + * <param-name>remoteIpProxiesHeader</param-name><param-value>x-forwarded-by</param-value> * </init-param> * <init-param> * <param-name>protocolHeader</param-name><param-value>x-forwarded-proto</param-value> @@ -253,10 +253,10 @@ import org.apache.juli.logging.LogFactor * <param-name>internalProxies</param-name><param-value>192\.168\.0\.10, 192\.168\.0\.11</param-value> * </init-param> * <init-param> - * <param-name>remoteIPHeader</param-name><param-value>x-forwarded-for</param-value> + * <param-name>remoteIpHeader</param-name><param-value>x-forwarded-for</param-value> * </init-param> * <init-param> - * <param-name>remoteIPProxiesHeader</param-name><param-value>x-forwarded-by</param-value> + * <param-name>remoteIpProxiesHeader</param-name><param-value>x-forwarded-by</param-value> * </init-param> * <init-param> * <param-name>trustedProxies</param-name><param-value>proxy1, proxy2</param-value> @@ -310,10 +310,10 @@ import org.apache.juli.logging.LogFactor * <param-name>internalProxies</param-name><param-value>192\.168\.0\.10, 192\.168\.0\.11</param-value> * </init-param> * <init-param> - * <param-name>remoteIPHeader</param-name><param-value>x-forwarded-for</param-value> + * <param-name>remoteIpHeader</param-name><param-value>x-forwarded-for</param-value> * </init-param> * <init-param> - * <param-name>remoteIPProxiesHeader</param-name><param-value>x-forwarded-by</param-value> + * <param-name>remoteIpProxiesHeader</param-name><param-value>x-forwarded-by</param-value> * </init-param> * <init-param> * <param-name>trustedProxies</param-name><param-value>proxy1, proxy2</param-value> @@ -368,10 +368,10 @@ import org.apache.juli.logging.LogFactor * <param-name>internalProxies</param-name><param-value>192\.168\.0\.10, 192\.168\.0\.11</param-value> * </init-param> * <init-param> - * <param-name>remoteIPHeader</param-name><param-value>x-forwarded-for</param-value> + * <param-name>remoteIpHeader</param-name><param-value>x-forwarded-for</param-value> * </init-param> * <init-param> - * <param-name>remoteIPProxiesHeader</param-name><param-value>x-forwarded-by</param-value> + * <param-name>remoteIpProxiesHeader</param-name><param-value>x-forwarded-by</param-value> * </init-param> * <init-param> * <param-name>trustedProxies</param-name><param-value>proxy1, proxy2</param-value> @@ -605,7 +605,7 @@ public class RemoteIpFilter implements F protected static final String PROXIES_HEADER_PARAMETER = "proxiesHeader"; - protected static final String REMOTE_IP_HEADER_PARAMETER = "remoteIPHeader"; + protected static final String REMOTE_IP_HEADER_PARAMETER = "remoteIpHeader"; protected static final String TRUSTED_PROXIES_PARAMETER = "trustedProxies"; @@ -700,9 +700,9 @@ public class RemoteIpFilter implements F private String proxiesHeader = "X-Forwarded-By"; /** - * @see #setRemoteIPHeader(String) + * @see #setRemoteIpHeader(String) */ - private String remoteIPHeader = "X-Forwarded-For"; + private String remoteIpHeader = "X-Forwarded-For"; /** * @see #setTrustedProxies(String) @@ -720,11 +720,11 @@ public class RemoteIpFilter implements F // In java 6, proxiesHeaderValue should be declared as a java.util.Deque LinkedList<String> proxiesHeaderValue = new LinkedList<String>(); - String[] remoteIPHeaderValue = commaDelimitedListToStringArray(request.getHeader(remoteIPHeader)); + String[] remoteIpHeaderValue = commaDelimitedListToStringArray(request.getHeader(remoteIpHeader)); int idx; - // loop on remoteIPHeaderValue to find the first trusted remote ip and to build the proxies chain - for (idx = remoteIPHeaderValue.length - 1; idx >= 0; idx--) { - String currentRemoteIp = remoteIPHeaderValue[idx]; + // loop on remoteIpHeaderValue to find the first trusted remote ip and to build the proxies chain + for (idx = remoteIpHeaderValue.length - 1; idx >= 0; idx--) { + String currentRemoteIp = remoteIpHeaderValue[idx]; remoteIp = currentRemoteIp; if (matchesOne(currentRemoteIp, internalProxies)) { // do nothing, internalProxies IPs are not appended to the @@ -735,10 +735,10 @@ public class RemoteIpFilter implements F break; } } - // continue to loop on remoteIPHeaderValue to build the new value of the remoteIPHeader + // continue to loop on remoteIpHeaderValue to build the new value of the remoteIpHeader LinkedList<String> newRemoteIpHeaderValue = new LinkedList<String>(); for (; idx >= 0; idx--) { - String currentRemoteIp = remoteIPHeaderValue[idx]; + String currentRemoteIp = remoteIpHeaderValue[idx]; newRemoteIpHeaderValue.addFirst(currentRemoteIp); } @@ -755,10 +755,10 @@ public class RemoteIpFilter implements F xRequest.setHeader(proxiesHeader, commaDelimitedListOfProxies); } if (newRemoteIpHeaderValue.size() == 0) { - xRequest.removeHeader(remoteIPHeader); + xRequest.removeHeader(remoteIpHeader); } else { String commaDelimitedRemoteIpHeaderValue = listToCommaDelimitedString(newRemoteIpHeaderValue); - xRequest.setHeader(remoteIPHeader, commaDelimitedRemoteIpHeaderValue); + xRequest.setHeader(remoteIpHeader, commaDelimitedRemoteIpHeaderValue); } } @@ -780,12 +780,12 @@ public class RemoteIpFilter implements F if (log.isDebugEnabled()) { log.debug("Incoming request " + request.getRequestURI() + " with originalRemoteAddr '" + request.getRemoteAddr() + "', originalRemoteHost='" + request.getRemoteHost() + "', originalSecure='" + request.isSecure() - + "', originalScheme='" + request.getScheme() + "', original[" + remoteIPHeader + "]='" - + request.getHeader(remoteIPHeader) + ", original[" + protocolHeader + "]='" + + "', originalScheme='" + request.getScheme() + "', original[" + remoteIpHeader + "]='" + + request.getHeader(remoteIpHeader) + ", original[" + protocolHeader + "]='" + (protocolHeader == null ? null : request.getHeader(protocolHeader)) + "' will be seen as newRemoteAddr='" + xRequest.getRemoteAddr() + "', newRemoteHost='" + xRequest.getRemoteHost() + "', newScheme='" - + xRequest.getScheme() + "', newSecure='" + xRequest.isSecure() + "', new[" + remoteIPHeader + "]='" - + xRequest.getHeader(remoteIPHeader) + ", new[" + proxiesHeader + "]='" + xRequest.getHeader(proxiesHeader) + "'"); + + xRequest.getScheme() + "', newSecure='" + xRequest.isSecure() + "', new[" + remoteIpHeader + "]='" + + xRequest.getHeader(remoteIpHeader) + ", new[" + proxiesHeader + "]='" + xRequest.getHeader(proxiesHeader) + "'"); } chain.doFilter(xRequest, response); } else { @@ -829,8 +829,8 @@ public class RemoteIpFilter implements F return proxiesHeader; } - public String getRemoteIPHeader() { - return remoteIPHeader; + public String getRemoteIpHeader() { + return remoteIpHeader; } public Pattern[] getTrustedProxies() { @@ -855,7 +855,7 @@ public class RemoteIpFilter implements F } if (filterConfig.getInitParameter(REMOTE_IP_HEADER_PARAMETER) != null) { - setRemoteIPHeader(filterConfig.getInitParameter(REMOTE_IP_HEADER_PARAMETER)); + setRemoteIpHeader(filterConfig.getInitParameter(REMOTE_IP_HEADER_PARAMETER)); } if (filterConfig.getInitParameter(TRUSTED_PROXIES_PARAMETER) != null) { @@ -972,13 +972,13 @@ public class RemoteIpFilter implements F * Default value : <code>X-Forwarded-For</code> * </p> */ - public void setRemoteIPHeader(String remoteIPHeader) { - this.remoteIPHeader = remoteIPHeader; + public void setRemoteIpHeader(String remoteIpHeader) { + this.remoteIpHeader = remoteIpHeader; } /** * <p> - * Comma delimited list of proxies that are trusted when they appear in the {...@link #remoteIPHeader} header. Can be expressed as a + * Comma delimited list of proxies that are trusted when they appear in the {...@link #remoteIpHeader} header. Can be expressed as a * regular expression. * </p> * <p> Modified: tomcat/trunk/java/org/apache/catalina/valves/RemoteIpValve.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/valves/RemoteIpValve.java?rev=955937&r1=955936&r2=955937&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/catalina/valves/RemoteIpValve.java (original) +++ tomcat/trunk/java/org/apache/catalina/valves/RemoteIpValve.java Fri Jun 18 11:19:38 2010 @@ -54,7 +54,7 @@ import org.apache.juli.logging.LogFactor * If the incoming <code>request.getRemoteAddr()</code> matches the valve's list of internal proxies : * <ul> * <li>Loop on the comma delimited list of IPs and hostnames passed by the preceding load balancer or proxy in the given request's Http - * header named <code>$remoteIPHeader</code> (default value <code>x-forwarded-for</code>). Values are processed in right-to-left order.</li> + * header named <code>$remoteIpHeader</code> (default value <code>x-forwarded-for</code>). Values are processed in right-to-left order.</li> * <li>For each ip/host of the list: * <ul> * <li>if it matches the internal proxies list, the ip/host is swallowed</li> @@ -79,7 +79,7 @@ import org.apache.juli.logging.LogFactor * <th>Default Value</th> * </tr> * <tr> - * <td>remoteIPHeader</td> + * <td>remoteIpHeader</td> * <td>Name of the Http Header read by this valve that holds the list of traversed IP addresses starting from the requesting client</td> * <td>RemoteIPHeader</td> * <td>Compliant http header name</td> @@ -99,7 +99,7 @@ import org.apache.juli.logging.LogFactor * <tr> * <td>proxiesHeader</td> * <td>Name of the http header created by this valve to hold the list of proxies that have been processed in the incoming - * <code>remoteIPHeader</code></td> + * <code>remoteIpHeader</code></td> * <td>RemoteIPProxiesHeader</td> * <td>Compliant http header name</td> * <td>x-forwarded-by</td> @@ -165,8 +165,8 @@ import org.apache.juli.logging.LogFactor * <Valve * className="org.apache.catalina.valves.RemoteIpValve" * internalProxies="192\.168\.0\.10, 192\.168\.0\.11" - * remoteIPHeader="x-forwarded-for" - * remoteIPProxiesHeader="x-forwarded-by" + * remoteIpHeader="x-forwarded-for" + * remoteIpProxiesHeader="x-forwarded-by" * protocolHeader="x-forwarded-proto" * /></pre></code> * <p> @@ -227,8 +227,8 @@ import org.apache.juli.logging.LogFactor * <Valve * className="org.apache.catalina.valves.RemoteIpValve" * internalProxies="192\.168\.0\.10, 192\.168\.0\.11" - * remoteIPHeader="x-forwarded-for" - * remoteIPProxiesHeader="x-forwarded-by" + * remoteIpHeader="x-forwarded-for" + * remoteIpProxiesHeader="x-forwarded-by" * trustedProxies="proxy1, proxy2" * /></pre></code> * <p> @@ -269,8 +269,8 @@ import org.apache.juli.logging.LogFactor * <Valve * className="org.apache.catalina.valves.RemoteIpValve" * internalProxies="192\.168\.0\.10, 192\.168\.0\.11" - * remoteIPHeader="x-forwarded-for" - * remoteIPProxiesHeader="x-forwarded-by" + * remoteIpHeader="x-forwarded-for" + * remoteIpProxiesHeader="x-forwarded-by" * trustedProxies="proxy1, proxy2" * /></pre></code> * <p> @@ -312,8 +312,8 @@ import org.apache.juli.logging.LogFactor * <Valve * className="org.apache.catalina.valves.RemoteIpValve" * internalProxies="192\.168\.0\.10, 192\.168\.0\.11" - * remoteIPHeader="x-forwarded-for" - * remoteIPProxiesHeader="x-forwarded-by" + * remoteIpHeader="x-forwarded-for" + * remoteIpProxiesHeader="x-forwarded-by" * trustedProxies="proxy1, proxy2" * /></pre></code> * <p> @@ -559,11 +559,11 @@ public class RemoteIpValve extends Valve // In java 6, proxiesHeaderValue should be declared as a java.util.Deque LinkedList<String> proxiesHeaderValue = new LinkedList<String>(); - String[] remoteIPHeaderValue = commaDelimitedListToStringArray(request.getHeader(remoteIpHeader)); + String[] remoteIpHeaderValue = commaDelimitedListToStringArray(request.getHeader(remoteIpHeader)); int idx; - // loop on remoteIPHeaderValue to find the first trusted remote ip and to build the proxies chain - for (idx = remoteIPHeaderValue.length - 1; idx >= 0; idx--) { - String currentRemoteIp = remoteIPHeaderValue[idx]; + // loop on remoteIpHeaderValue to find the first trusted remote ip and to build the proxies chain + for (idx = remoteIpHeaderValue.length - 1; idx >= 0; idx--) { + String currentRemoteIp = remoteIpHeaderValue[idx]; remoteIp = currentRemoteIp; if (matchesOne(currentRemoteIp, internalProxies)) { // do nothing, internalProxies IPs are not appended to the @@ -574,10 +574,10 @@ public class RemoteIpValve extends Valve break; } } - // continue to loop on remoteIPHeaderValue to build the new value of the remoteIPHeader + // continue to loop on remoteIpHeaderValue to build the new value of the remoteIpHeader LinkedList<String> newRemoteIpHeaderValue = new LinkedList<String>(); for (; idx >= 0; idx--) { - String currentRemoteIp = remoteIPHeaderValue[idx]; + String currentRemoteIp = remoteIpHeaderValue[idx]; newRemoteIpHeaderValue.addFirst(currentRemoteIp); } if (remoteIp != null) { Modified: tomcat/trunk/webapps/docs/config/filter.xml URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/config/filter.xml?rev=955937&r1=955936&r2=955937&view=diff ============================================================================== --- tomcat/trunk/webapps/docs/config/filter.xml (original) +++ tomcat/trunk/webapps/docs/config/filter.xml Fri Jun 18 11:19:38 2010 @@ -315,11 +315,11 @@ <param-value>192\.168\.0\.10, 192\.168\.0\.11</param-value> </init-param> <init-param> - <param-name>remoteIPHeader</param-name> + <param-name>remoteIpHeader</param-name> <param-value>x-forwarded-for</param-value> </init-param> <init-param> - <param-name>remoteIPProxiesHeader</param-name> + <param-name>remoteIpProxiesHeader</param-name> <param-value>x-forwarded-by</param-value> </init-param> <init-param> @@ -392,11 +392,11 @@ <param-value>192\.168\.0\.10, 192\.168\.0\.11</param-value> </init-param> <init-param> - <param-name>remoteIPHeader</param-name> + <param-name>remoteIpHeader</param-name> <param-value>x-forwarded-for</param-value> </init-param> <init-param> - <param-name>remoteIPProxiesHeader</param-name> + <param-name>remoteIpProxiesHeader</param-name> <param-value>x-forwarded-by</param-value> </init-param> <init-param> @@ -447,11 +447,11 @@ <param-value>192\.168\.0\.10, 192\.168\.0\.11</param-value> </init-param> <init-param> - <param-name>remoteIPHeader</param-name> + <param-name>remoteIpHeader</param-name> <param-value>x-forwarded-for</param-value> </init-param> <init-param> - <param-name>remoteIPProxiesHeader</param-name> + <param-name>remoteIpProxiesHeader</param-name> <param-value>x-forwarded-by</param-value> </init-param> <init-param> @@ -505,11 +505,11 @@ <param-value>192\.168\.0\.10, 192\.168\.0\.11</param-value> </init-param> <init-param> - <param-name>remoteIPHeader</param-name> + <param-name>remoteIpHeader</param-name> <param-value>x-forwarded-for</param-value> </init-param> <init-param> - <param-name>remoteIPProxiesHeader</param-name> + <param-name>remoteIpProxiesHeader</param-name> <param-value>x-forwarded-by</param-value> </init-param> <init-param> @@ -558,7 +558,7 @@ <attributes> - <attribute name="remoteIPHeader" required="false"> + <attribute name="remoteIpHeader" required="false"> <p>Name of the HTTP Header read by this valve that holds the list of traversed IP addresses starting from the requesting client. If not specified, the default of <code>x-forwarded-for</code> is used.</p> Modified: tomcat/trunk/webapps/docs/config/valve.xml URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/config/valve.xml?rev=955937&r1=955936&r2=955937&view=diff ============================================================================== --- tomcat/trunk/webapps/docs/config/valve.xml (original) +++ tomcat/trunk/webapps/docs/config/valve.xml Fri Jun 18 11:19:38 2010 @@ -665,7 +665,7 @@ <strong>org.apache.catalina.valves.RemoteIpValve</strong>.</p> </attribute> - <attribute name="remoteIPHeader" required="false"> + <attribute name="remoteIpHeader" required="false"> <p>Name of the HTTP Header read by this valve that holds the list of traversed IP addresses starting from the requesting client. If not specified, the default of <code>x-forwarded-for</code> is used.</p> --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org