]> granicus.if.org Git - apache/commitdiff
Default to NOT setting Max-Forwards in violation of RFC2616
authorNick Kew <niq@apache.org>
Tue, 2 Oct 2007 00:39:43 +0000 (00:39 +0000)
committerNick Kew <niq@apache.org>
Tue, 2 Oct 2007 00:39:43 +0000 (00:39 +0000)
Leave old behaviour as a configuration option (ProxyMaxForwards)
PR 16137

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@581117 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
modules/proxy/mod_proxy.c
modules/proxy/mod_proxy.h

diff --git a/CHANGES b/CHANGES
index 29e4fa47cfb4ab4334e1550a0096de53f05cd8c5..a1deb00fd3da04c6dbf4cf669c06a2c99001fdb4 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -2,6 +2,11 @@
 Changes with Apache 2.3.0
 [ When backported to 2.2.x, remove entry from this file ]
 
+  *) mod_proxy: Don't by default violate RFC2616 by setting
+     Max-Forwards when the client didn't send it to us.
+     Leave that as a configuration option.
+     PR 16137 [Nick Kew]
+
   *) mod_proxy_http: Remove Warning headers with wrong date
      PR 16138 [Nick Kew]
 
index d5265334bf561f93c0469d16ae9eb3241554587f..31b5d8540df3d606fe539aa5c48cd4f2a921a705 100644 (file)
@@ -784,8 +784,10 @@ static int proxy_handler(request_rec *r)
         /* set configured max-forwards */
         maxfwd = conf->maxfwd;
     }
-    apr_table_set(r->headers_in, "Max-Forwards",
-                  apr_psprintf(r->pool, "%ld", (maxfwd > 0) ? maxfwd : 0));
+    if (maxfwd >= 0) {
+        apr_table_set(r->headers_in, "Max-Forwards",
+                      apr_psprintf(r->pool, "%ld", maxfwd));
+    }
 
     if (r->method_number == M_TRACE) {
         core_server_config *coreconf = (core_server_config *)
@@ -1535,9 +1537,6 @@ static const char *
     proxy_server_conf *psf =
     ap_get_module_config(parms->server->module_config, &proxy_module);
     long s = atol(arg);
-    if (s < 0) {
-        return "ProxyMaxForwards must be greater or equal to zero..";
-    }
 
     psf->maxfwd = s;
     psf->maxfwd_set = 1;
index 32e031315528528318bab219704d658df1271860..de73723a1b31c80850bf4a1946deb63d678b981a 100644 (file)
@@ -94,7 +94,10 @@ enum enctype {
 #endif /*APR_CHARSET_EBCDIC*/
 
 /* default Max-Forwards header setting */
-#define DEFAULT_MAX_FORWARDS    10
+/* Set this to -1, which complies with RFC2616 by not setting
+ * max-forwards if the client didn't send it to us.
+ */
+#define DEFAULT_MAX_FORWARDS    -1
 
 /* static information about a remote proxy */
 struct proxy_remote {