Update JMX descriptions, tests, documentation and examples in documentation for using...
authorkkolinko <kkolinko@13f79535-47bb-0310-9956-ffa450edef68>
Sat, 15 Jan 2011 19:33:06 +0000 (19:33 +0000)
committerkkolinko <kkolinko@13f79535-47bb-0310-9956-ffa450edef68>
Sat, 15 Jan 2011 19:33:06 +0000 (19:33 +0000)
git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1059398 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/catalina/filters/RemoteIpFilter.java
java/org/apache/catalina/valves/RemoteIpValve.java
java/org/apache/catalina/valves/mbeans-descriptors.xml
test/org/apache/catalina/filters/TestRemoteIpFilter.java
webapps/docs/config/filter.xml

index a6bf9aa..ca83323 100644 (file)
@@ -99,10 +99,13 @@ import org.apache.juli.logging.LogFactory;
  * </tr>
  * <tr>
  * <td>internalProxies</td>
- * <td>List of internal proxies ip adress. If they appear in the <code>remoteIpHeader</code> value, they will be trusted and will not appear
+ * <td>Regular expression that matches the IP addresses of internal proxies.
+ * If they appear in the <code>remoteIpHeader</code> value, they will be
+ * trusted and will not appear
  * in the <code>proxiesHeader</code> value</td>
  * <td>RemoteIPInternalProxy</td>
- * <td>Regular expression (in the syntax supported by the {@link java.util.regex.Pattern} library)</td>
+ * <td>Regular expression (in the syntax supported by
+ * {@link java.util.regex.Pattern java.util.regex})</td>
  * <td>10\.\d{1,3}\.\d{1,3}\.\d{1,3}|192\.168\.\d{1,3}\.\d{1,3}|169\.254\.\d{1,3}\.\d{1,3}|127\.\d{1,3}\.\d{1,3}\.\d{1,3} <br/>
  * By default, 10/8, 192.168/16, 169.254/16 and 127/8 are allowed ; 172.16/12 has not been enabled by default because it is complex to
  * describe with regular expressions</td>
@@ -118,10 +121,12 @@ import org.apache.juli.logging.LogFactory;
  * </tr>
  * <tr>
  * <td>trustedProxies</td>
- * <td>List of trusted proxies ip adress. If they appear in the <code>remoteIpHeader</code> value, they will be trusted and will appear in
- * the <code>proxiesHeader</code> value</td>
+ * <td>Regular expression that matches the IP addresses of trusted proxies.
+ * If they appear in the <code>remoteIpHeader</code> value, they will be
+ * trusted and will appear in the <code>proxiesHeader</code> value</td>
  * <td>RemoteIPTrustedProxy</td>
- * <td>Regular expression (in the syntax supported by the {@link java.util.regex.Pattern} library)</td>
+ * <td>Regular expression (in the syntax supported by
+ * {@link java.util.regex.Pattern java.util.regex})</td>
  * <td>&nbsp;</td>
  * </tr>
  * <tr>
@@ -174,16 +179,20 @@ import org.apache.juli.logging.LogFactory;
  *    &lt;filter-name&gt;RemoteIpFilter&lt;/filter-name&gt;
  *    &lt;filter-class&gt;org.apache.catalina.filters.RemoteIpFilter&lt;/filter-class&gt;
  *    &lt;init-param&gt;
- *       &lt;param-name&gt;internalProxies&lt;/param-name&gt;&lt;param-value&gt;192\.168\.0\.10, 192\.168\.0\.11&lt;/param-value&gt;
+ *       &lt;param-name&gt;internalProxies&lt;/param-name&gt;
+ *       &lt;param-value&gt;192\.168\.0\.10|192\.168\.0\.11&lt;/param-value&gt;
  *    &lt;/init-param&gt;
  *    &lt;init-param&gt;
- *       &lt;param-name&gt;remoteIpHeader&lt;/param-name&gt;&lt;param-value&gt;x-forwarded-for&lt;/param-value&gt;
+ *       &lt;param-name&gt;remoteIpHeader&lt;/param-name&gt;
+ *       &lt;param-value&gt;x-forwarded-for&lt;/param-value&gt;
  *    &lt;/init-param&gt;
  *    &lt;init-param&gt;
- *       &lt;param-name&gt;remoteIpProxiesHeader&lt;/param-name&gt;&lt;param-value&gt;x-forwarded-by&lt;/param-value&gt;
+ *       &lt;param-name&gt;remoteIpProxiesHeader&lt;/param-name&gt;
+ *       &lt;param-value&gt;x-forwarded-by&lt;/param-value&gt;
  *    &lt;/init-param&gt;
  *    &lt;init-param&gt;
- *       &lt;param-name&gt;protocolHeader&lt;/param-name&gt;&lt;param-value&gt;x-forwarded-proto&lt;/param-value&gt;
+ *       &lt;param-name&gt;protocolHeader&lt;/param-name&gt;
+ *       &lt;param-value&gt;x-forwarded-proto&lt;/param-value&gt;
  *    &lt;/init-param&gt;
  * &lt;/filter&gt;
  * 
@@ -251,16 +260,20 @@ import org.apache.juli.logging.LogFactory;
  *    &lt;filter-name&gt;RemoteIpFilter&lt;/filter-name&gt;
  *    &lt;filter-class&gt;org.apache.catalina.filters.RemoteIpFilter&lt;/filter-class&gt;
  *    &lt;init-param&gt;
- *       &lt;param-name&gt;internalProxies&lt;/param-name&gt;&lt;param-value&gt;192\.168\.0\.10, 192\.168\.0\.11&lt;/param-value&gt;
+ *       &lt;param-name&gt;internalProxies&lt;/param-name&gt;
+ *       &lt;param-value&gt;192\.168\.0\.10|192\.168\.0\.11&lt;/param-value&gt;
  *    &lt;/init-param&gt;
  *    &lt;init-param&gt;
- *       &lt;param-name&gt;remoteIpHeader&lt;/param-name&gt;&lt;param-value&gt;x-forwarded-for&lt;/param-value&gt;
+ *       &lt;param-name&gt;remoteIpHeader&lt;/param-name&gt;
+ *       &lt;param-value&gt;x-forwarded-for&lt;/param-value&gt;
  *    &lt;/init-param&gt;
  *    &lt;init-param&gt;
- *       &lt;param-name&gt;remoteIpProxiesHeader&lt;/param-name&gt;&lt;param-value&gt;x-forwarded-by&lt;/param-value&gt;
+ *       &lt;param-name&gt;remoteIpProxiesHeader&lt;/param-name&gt;
+ *       &lt;param-value&gt;x-forwarded-by&lt;/param-value&gt;
  *    &lt;/init-param&gt;
  *    &lt;init-param&gt;
- *       &lt;param-name&gt;trustedProxies&lt;/param-name&gt;&lt;param-value&gt;proxy1, proxy2&lt;/param-value&gt;
+ *       &lt;param-name&gt;trustedProxies&lt;/param-name&gt;
+ *       &lt;param-value&gt;proxy1|proxy2&lt;/param-value&gt;
  *    &lt;/init-param&gt;
  * &lt;/filter&gt;
  * 
@@ -308,16 +321,20 @@ import org.apache.juli.logging.LogFactory;
  *    &lt;filter-name&gt;RemoteIpFilter&lt;/filter-name&gt;
  *    &lt;filter-class&gt;org.apache.catalina.filters.RemoteIpFilter&lt;/filter-class&gt;
  *    &lt;init-param&gt;
- *       &lt;param-name&gt;internalProxies&lt;/param-name&gt;&lt;param-value&gt;192\.168\.0\.10, 192\.168\.0\.11&lt;/param-value&gt;
+ *       &lt;param-name&gt;internalProxies&lt;/param-name&gt;
+ *       &lt;param-value&gt;192\.168\.0\.10|192\.168\.0\.11&lt;/param-value&gt;
  *    &lt;/init-param&gt;
  *    &lt;init-param&gt;
- *       &lt;param-name&gt;remoteIpHeader&lt;/param-name&gt;&lt;param-value&gt;x-forwarded-for&lt;/param-value&gt;
+ *       &lt;param-name&gt;remoteIpHeader&lt;/param-name&gt;
+ *       &lt;param-value&gt;x-forwarded-for&lt;/param-value&gt;
  *    &lt;/init-param&gt;
  *    &lt;init-param&gt;
- *       &lt;param-name&gt;remoteIpProxiesHeader&lt;/param-name&gt;&lt;param-value&gt;x-forwarded-by&lt;/param-value&gt;
+ *       &lt;param-name&gt;remoteIpProxiesHeader&lt;/param-name&gt;
+ *       &lt;param-value&gt;x-forwarded-by&lt;/param-value&gt;
  *    &lt;/init-param&gt;
  *    &lt;init-param&gt;
- *       &lt;param-name&gt;trustedProxies&lt;/param-name&gt;&lt;param-value&gt;proxy1, proxy2&lt;/param-value&gt;
+ *       &lt;param-name&gt;trustedProxies&lt;/param-name&gt;
+ *       &lt;param-value&gt;proxy1|proxy2&lt;/param-value&gt;
  *    &lt;/init-param&gt;
  * &lt;/filter&gt;
  * 
@@ -366,16 +383,20 @@ import org.apache.juli.logging.LogFactory;
  *    &lt;filter-name&gt;RemoteIpFilter&lt;/filter-name&gt;
  *    &lt;filter-class&gt;org.apache.catalina.filters.RemoteIpFilter&lt;/filter-class&gt;
  *    &lt;init-param&gt;
- *       &lt;param-name&gt;internalProxies&lt;/param-name&gt;&lt;param-value&gt;192\.168\.0\.10, 192\.168\.0\.11&lt;/param-value&gt;
+ *       &lt;param-name&gt;internalProxies&lt;/param-name&gt;
+ *       &lt;param-value&gt;192\.168\.0\.10|192\.168\.0\.11&lt;/param-value&gt;
  *    &lt;/init-param&gt;
  *    &lt;init-param&gt;
- *       &lt;param-name&gt;remoteIpHeader&lt;/param-name&gt;&lt;param-value&gt;x-forwarded-for&lt;/param-value&gt;
+ *       &lt;param-name&gt;remoteIpHeader&lt;/param-name&gt;
+ *       &lt;param-value&gt;x-forwarded-for&lt;/param-value&gt;
  *    &lt;/init-param&gt;
  *    &lt;init-param&gt;
- *       &lt;param-name&gt;remoteIpProxiesHeader&lt;/param-name&gt;&lt;param-value&gt;x-forwarded-by&lt;/param-value&gt;
+ *       &lt;param-name&gt;remoteIpProxiesHeader&lt;/param-name&gt;
+ *       &lt;param-value&gt;x-forwarded-by&lt;/param-value&gt;
  *    &lt;/init-param&gt;
  *    &lt;init-param&gt;
- *       &lt;param-name&gt;trustedProxies&lt;/param-name&gt;&lt;param-value&gt;proxy1, proxy2&lt;/param-value&gt;
+ *       &lt;param-name&gt;trustedProxies&lt;/param-name&gt;
+ *       &lt;param-value&gt;proxy1|proxy2&lt;/param-value&gt;
  *    &lt;/init-param&gt;
  * &lt;/filter&gt;
  * 
@@ -892,7 +913,7 @@ public class RemoteIpFilter implements Filter {
     
     /**
      * <p>
-     * Regular expressions that defines the internal proxies.
+     * Regular expression that defines the internal proxies.
      * </p>
      * <p>
      * Default value : 10\.\d{1,3}\.\d{1,3}\.\d{1,3}|192\.168\.\d{1,3}\.\d{1,3}|169\.254.\d{1,3}.\d{1,3}|127\.\d{1,3}\.\d{1,3}\.\d{1,3}
index ac67681..228f080 100644 (file)
@@ -81,10 +81,13 @@ import org.apache.juli.logging.LogFactory;
  * </tr>
  * <tr>
  * <td>internalProxies</td>
- * <td>List of internal proxies ip adress. If they appear in the <code>remoteIpHeader</code> value, they will be trusted and will not appear
+ * <td>Regular expression that matches the IP addresses of internal proxies.
+ * If they appear in the <code>remoteIpHeader</code> value, they will be
+ * trusted and will not appear
  * in the <code>proxiesHeader</code> value</td>
  * <td>RemoteIPInternalProxy</td>
- * <td>Regular expression (in the syntax supported by the {@link java.util.regex.Pattern} library)</td>
+ * <td>Regular expression (in the syntax supported by
+ * {@link java.util.regex.Pattern java.util.regex})</td>
  * <td>10\.\d{1,3}\.\d{1,3}\.\d{1,3}|192\.168\.\d{1,3}\.\d{1,3}|169\.254\.\d{1,3}\.\d{1,3}|127\.\d{1,3}\.\d{1,3}\.\d{1,3}<br/>
  * By default, 10/8, 192.168/16, 169.254/16 and 127/8 are allowed ; 172.16/12 has not been enabled by default because it is complex to
  * describe with regular expressions</td>
@@ -100,10 +103,12 @@ import org.apache.juli.logging.LogFactory;
  * </tr>
  * <tr>
  * <td>trustedProxies</td>
- * <td>List of trusted proxies ip adress. If they appear in the <code>remoteIpHeader</code> value, they will be trusted and will appear
- * in the <code>proxiesHeader</code> value</td>
+ * <td>Regular expression that matches the IP addresses of trusted proxies.
+ * If they appear in the <code>remoteIpHeader</code> value, they will be
+ * trusted and will appear in the <code>proxiesHeader</code> value</td>
  * <td>RemoteIPTrustedProxy</td>
- * <td>Regular expression (in the syntax supported by the {@link java.util.regex.Pattern} library)</td>
+ * <td>Regular expression (in the syntax supported by
+ * {@link java.util.regex.Pattern java.util.regex})</td>
  * <td>&nbsp;</td>
  * </tr>
  * <tr>
@@ -158,7 +163,7 @@ import org.apache.juli.logging.LogFactory;
  * <code><pre>
  * &lt;Valve 
  *   className="org.apache.catalina.valves.RemoteIpValve"
- *   internalProxies="192\.168\.0\.10192\.168\.0\.11"
+ *   internalProxies="192\.168\.0\.10|192\.168\.0\.11"
  *   remoteIpHeader="x-forwarded-for"
  *   remoteIpProxiesHeader="x-forwarded-by"
  *   protocolHeader="x-forwarded-proto"
@@ -220,10 +225,10 @@ import org.apache.juli.logging.LogFactory;
  * <code><pre>
  * &lt;Valve 
  *   className="org.apache.catalina.valves.RemoteIpValve"
- *   internalProxies="192\.168\.0\.10192\.168\.0\.11"
+ *   internalProxies="192\.168\.0\.10|192\.168\.0\.11"
  *   remoteIpHeader="x-forwarded-for"
  *   remoteIpProxiesHeader="x-forwarded-by"
- *   trustedProxies="proxy1proxy2"
+ *   trustedProxies="proxy1|proxy2"
  *   /&gt;</pre></code>
  * <p>
  * Request values:
@@ -262,10 +267,10 @@ import org.apache.juli.logging.LogFactory;
  * <code><pre>
  * &lt;Valve 
  *   className="org.apache.catalina.valves.RemoteIpValve"
- *   internalProxies="192\.168\.0\.10192\.168\.0\.11"
+ *   internalProxies="192\.168\.0\.10|192\.168\.0\.11"
  *   remoteIpHeader="x-forwarded-for"
  *   remoteIpProxiesHeader="x-forwarded-by"
- *   trustedProxies="proxy1proxy2"
+ *   trustedProxies="proxy1|proxy2"
  *   /&gt;</pre></code>
  * <p>
  * Request values:
@@ -305,10 +310,10 @@ import org.apache.juli.logging.LogFactory;
  * <code><pre>
  * &lt;Valve 
  *   className="org.apache.catalina.valves.RemoteIpValve"
- *   internalProxies="192\.168\.0\.10192\.168\.0\.11"
+ *   internalProxies="192\.168\.0\.10|192\.168\.0\.11"
  *   remoteIpHeader="x-forwarded-for"
  *   remoteIpProxiesHeader="x-forwarded-by"
- *   trustedProxies="proxy1proxy2"
+ *   trustedProxies="proxy1|proxy2"
  *   /&gt;</pre></code>
  * <p>
  * Request values:
@@ -449,7 +454,7 @@ public class RemoteIpValve extends ValveBase {
     
     /**
      * @see #setInternalProxies(String)
-     * @return comma delimited list of internal proxies
+     * @return Regular expression that defines the internal proxies
      */
     public String getInternalProxies() {
         if (internalProxies == null) {
@@ -492,7 +497,7 @@ public class RemoteIpValve extends ValveBase {
 
     /**
      * @see #setTrustedProxies(String)
-     * @return comma delimited list of trusted proxies
+     * @return Regular expression that defines the trusted proxies
      */
     public String getTrustedProxies() {
         if (trustedProxies == null) {
@@ -643,7 +648,7 @@ public class RemoteIpValve extends ValveBase {
     
     /**
      * <p>
-     * Regular expressions that defines the internal proxies.
+     * Regular expression that defines the internal proxies.
      * </p>
      * <p>
      * Default value : 10\.\d{1,3}\.\d{1,3}\.\d{1,3}|192\.168\.\d{1,3}\.\d{1,3}|169\.254.\d{1,3}.\d{1,3}|127\.\d{1,3}\.\d{1,3}\.\d{1,3}
index 3137d33..562e859 100644 (file)
                writeable="false"/>
                
     <attribute name="internalProxies"
-               description="Comma delimited list of internal proxies"
+               description="Regular expression that matches IP addresses of internal proxies"
                type="java.lang.String"
                writeable="false" />
     
                writeable="false"/>
 
     <attribute name="trustedProxies"
-               description="Comma delimited list of trusted proxies"
+               description="Regular expression that matches IP addresses of trusted proxies"
                type="java.lang.String"
                writeable="false" />
                
index a8cfd5d..31de47d 100644 (file)
@@ -215,8 +215,8 @@ public class TestRemoteIpFilter extends TomcatBaseTest {
     public void testInvokeAllowedRemoteAddrWithNullRemoteIpHeader() throws Exception {
         // PREPARE
         FilterDef filterDef = new FilterDef();
-        filterDef.addInitParameter("internalProxies", "192\\.168\\.0\\.10192\\.168\\.0\\.11");
-        filterDef.addInitParameter("trustedProxies", "proxy1, proxy2, proxy3");
+        filterDef.addInitParameter("internalProxies", "192\\.168\\.0\\.10|192\\.168\\.0\\.11");
+        filterDef.addInitParameter("trustedProxies", "proxy1|proxy2|proxy3");
         filterDef.addInitParameter("remoteIpHeader", "x-forwarded-for");
         filterDef.addInitParameter("proxiesHeader", "x-forwarded-by");
 
@@ -247,7 +247,7 @@ public class TestRemoteIpFilter extends TomcatBaseTest {
         // PREPARE
         FilterDef filterDef = new FilterDef();
         filterDef.addInitParameter("internalProxies", "192\\.168\\.0\\.10|192\\.168\\.0\\.11");
-        filterDef.addInitParameter("trustedProxies", "proxy1, proxy2, proxy3");
+        filterDef.addInitParameter("trustedProxies", "proxy1|proxy2|proxy3");
         filterDef.addInitParameter("remoteIpHeader", "x-forwarded-for");
         filterDef.addInitParameter("proxiesHeader", "x-forwarded-by");
 
@@ -375,8 +375,8 @@ public class TestRemoteIpFilter extends TomcatBaseTest {
     public void testInvokeNotAllowedRemoteAddr() throws Exception {
         // PREPARE
         FilterDef filterDef = new FilterDef();
-        filterDef.addInitParameter("internalProxies", "192\\.168\\.0\\.10192\\.168\\.0\\.11");
-        filterDef.addInitParameter("trustedProxies", "proxy1, proxy2, proxy3");
+        filterDef.addInitParameter("internalProxies", "192\\.168\\.0\\.10|192\\.168\\.0\\.11");
+        filterDef.addInitParameter("trustedProxies", "proxy1|proxy2|proxy3");
         filterDef.addInitParameter("remoteIpHeader", "x-forwarded-for");
         filterDef.addInitParameter("proxiesHeader", "x-forwarded-by");
 
index e54c005..1ccc011 100644 (file)
@@ -796,7 +796,7 @@ FINE: Request "/docs/config/manager.html" with response status "200" content-typ
        &lt;/init-param&gt;
        &lt;init-param&gt;
          &lt;param-name&gt;trustedProxies&lt;/param-name&gt;
-         &lt;param-value&gt;proxy1proxy2&lt;/param-value&gt;
+         &lt;param-value&gt;proxy1|proxy2&lt;/param-value&gt;
        &lt;/init-param&gt;
      &lt;/filter&gt;
     </source>
@@ -851,7 +851,7 @@ FINE: Request "/docs/config/manager.html" with response status "200" content-typ
        &lt;/init-param&gt;
        &lt;init-param&gt;
          &lt;param-name&gt;trustedProxies&lt;/param-name&gt;
-         &lt;param-value&gt;proxy1proxy2&lt;/param-value&gt;
+         &lt;param-value&gt;proxy1|proxy2&lt;/param-value&gt;
        &lt;/init-param&gt;
      &lt;/filter&gt;
     </source>
@@ -909,7 +909,7 @@ FINE: Request "/docs/config/manager.html" with response status "200" content-typ
        &lt;/init-param&gt;
        &lt;init-param&gt;
          &lt;param-name&gt;trustedProxies&lt;/param-name&gt;
-         &lt;param-value&gt;proxy1proxy2&lt;/param-value&gt;
+         &lt;param-value&gt;proxy1|proxy2&lt;/param-value&gt;
        &lt;/init-param&gt;
      &lt;/filter&gt;
     </source>