]> granicus.if.org Git - apache/commitdiff
PR62186: preserve %<m for ErrorDocument internal redirects
authorEric Covener <covener@apache.org>
Wed, 11 Apr 2018 18:49:05 +0000 (18:49 +0000)
committerEric Covener <covener@apache.org>
Wed, 11 Apr 2018 18:49:05 +0000 (18:49 +0000)
  *) core: Preserve the original HTTP request method in the '%<m' LogFormat
     when an path-based ErrorDocument is used.  PR 62186.
     [Micha Lenk <micha lenk.info>]

Submitted By: Micha Lenk
Committed By: covener

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

CHANGES
modules/http/http_request.c

diff --git a/CHANGES b/CHANGES
index f3d8e69eb67e0a9be690bb278527855522e8b9da..3ce88899e4d9df16f9a0f2965153d8f163893a06 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,10 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache 2.5.1
 
+  *) core: Preserve the original HTTP request method in the '%<m' LogFormat
+     when an path-based ErrorDocument is used.  PR 62186. 
+     [Micha Lenk <micha lenk.info>]
+
   *) mod_proxy_balancer: Add hot spare member type and corresponding flag (R). Hot spare members are
      used as drop-in replacements for unusable workers in the same load balancer set. This differs
      from hot standbys which are only used when all workers in a set are unusable. PR 61140. [Jim
index 6e6e35c7d394046ad95e3e3a4d62308c871508c2..bb28d9c8ddf43e75c6799930cdf69d7445f1c2e0 100644 (file)
@@ -187,7 +187,8 @@ static void ap_die_r(int type, request_rec *r, int recursive_error)
             apr_table_setn(r->headers_out, "Location", custom_response);
         }
         else if (custom_response[0] == '/') {
-            const char *error_notes;
+            const char *error_notes, *original_method;
+            int original_method_number;
             r->no_local_copy = 1;       /* Do NOT send HTTP_NOT_MODIFIED for
                                          * error documents! */
             /*
@@ -205,9 +206,14 @@ static void ap_die_r(int type, request_rec *r, int recursive_error)
                                              "error-notes")) != NULL) {
                 apr_table_setn(r->subprocess_env, "ERROR_NOTES", error_notes);
             }
+            original_method = r->method;
+            original_method_number = r->method_number;
             r->method = "GET";
             r->method_number = M_GET;
             ap_internal_redirect(custom_response, r);
+            /* preserve ability to see %<m in the access log */
+            r->method = original_method;
+            r->method_number = original_method_number;
             return;
         }
         else {