You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by wr...@apache.org on 2005/07/06 06:10:53 UTC

svn commit: r209406 - /httpd/httpd/trunk/modules/proxy/mod_proxy.c

Author: wrowe
Date: Tue Jul  5 21:10:50 2005
New Revision: 209406

URL: http://svn.apache.org/viewcvs?rev=209406&view=rev
Log:

  This test for TraceEnable cases cannot be buried within the max-forwards
  logic cases.

Modified:
    httpd/httpd/trunk/modules/proxy/mod_proxy.c

Modified: httpd/httpd/trunk/modules/proxy/mod_proxy.c
URL: http://svn.apache.org/viewcvs/httpd/httpd/trunk/modules/proxy/mod_proxy.c?rev=209406&r1=209405&r2=209406&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/mod_proxy.c (original)
+++ httpd/httpd/trunk/modules/proxy/mod_proxy.c Tue Jul  5 21:10:50 2005
@@ -541,23 +541,7 @@
         if (maxfwd < 1) {
             switch (r->method_number) {
             case M_TRACE: {
-                core_server_config *coreconf = (core_server_config *)
-                                    ap_get_module_config(sconf, &core_module);
                 int access_status;
-
-                if (coreconf->trace_enable == AP_TRACE_DISABLE)
-                    return ap_proxyerror(r, HTTP_NOT_IMPLEMENTED,
-                                         "TRACE denied by server configuration");
-
-                /* Can't test ap_should_client_block, we aren't ready to send
-                 * the client a 100 Continue response till the connection has
-                 * been established
-                 */
-                if (coreconf->trace_enable != AP_TRACE_EXTENDED 
-                    && (r->read_length || (!r->read_chunked && (r->remaining <= 0))))
-                    return ap_proxyerror(r, HTTP_REQUEST_ENTITY_TOO_LARGE,
-                                         "TRACE with request body is not allowed");
-
                 r->proxyreq = PROXYREQ_NONE;
                 if ((access_status = ap_send_http_trace(r)))
                     ap_die(access_status, r);
@@ -588,6 +572,42 @@
     }
     apr_table_set(r->headers_in, "Max-Forwards", 
                   apr_psprintf(r->pool, "%ld", (maxfwd > 0) ? maxfwd : 0));
+
+    if (r->method_number == M_TRACE) {
+        core_server_config *coreconf = (core_server_config *)
+                            ap_get_module_config(sconf, &core_module);
+
+        if (coreconf->trace_enable == AP_TRACE_DISABLE) 
+        {
+            /* Allow "error-notes" string to be printed by ap_send_error_response()
+             * Note; this goes nowhere, canned error response need an overhaul.
+             */
+            apr_table_setn(r->notes, "error-notes",
+                           "TRACE forbidden by server configuration");
+            apr_table_setn(r->notes, "verbose-error-to", "*");
+            ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
+                          "proxy: TRACE forbidden by server configuration");
+            return HTTP_FORBIDDEN;
+        }
+
+        /* Can't test ap_should_client_block, we aren't ready to send
+         * the client a 100 Continue response till the connection has
+         * been established
+         */
+        if (coreconf->trace_enable != AP_TRACE_EXTENDED 
+            && (r->read_length || r->read_chunked || r->remaining))
+        {
+            /* Allow "error-notes" string to be printed by ap_send_error_response()
+             * Note; this goes nowhere, canned error response need an overhaul.
+             */
+            apr_table_setn(r->notes, "error-notes",
+                           "TRACE with request body is not allowed");
+            apr_table_setn(r->notes, "verbose-error-to", "*");
+            ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
+                          "proxy: TRACE with request body is not allowed");
+            return HTTP_REQUEST_ENTITY_TOO_LARGE;
+        }
+    }
 
     uri = r->filename + 6;
     p = strchr(uri, ':');