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);
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, ':');
if (p == NULL) {