]> granicus.if.org Git - apache/commitdiff
Merge r1828920 from trunk:
authorJim Jagielski <jim@apache.org>
Thu, 26 Apr 2018 17:35:44 +0000 (17:35 +0000)
committerJim Jagielski <jim@apache.org>
Thu, 26 Apr 2018 17:35:44 +0000 (17:35 +0000)
PR62186: preserve %<m for ErrorDocument internal redirects

  *) 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

Submitted by: covener
Reviewed by: covener, jhriggs, jim

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1830248 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
STATUS
modules/http/http_request.c

diff --git a/CHANGES b/CHANGES
index 791f4b95168f2685c2a428dc8fc202195cc0ab0d..c55dccc09811d461081e3df235564e1369f6be8d 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,10 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache 2.4.34
 
+  *) 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_remoteip: make proxy-protocol work on slave connections, e.g. in HTTP/2
      requests. See also https://github.com/roadrunner2/mod-proxy-protocol/issues/6
      [Stefan Eissing]
diff --git a/STATUS b/STATUS
index b0918860eb377c0d1a4649e1e8f80ef73719cc98..f8d63f24cfec0da918215affc886ab8e182bef6c 100644 (file)
--- a/STATUS
+++ b/STATUS
@@ -132,11 +132,6 @@ RELEASE SHOWSTOPPERS:
 PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
   [ start all new proposals below, under PATCHES PROPOSED. ]
 
-  *) core: restore r->method after internal redirect to errordocument so %<m
-     can be logged. PR62186
-     trunk patch: https://svn.apache.org/r1828920
-     2.4.x patch: svn merge -c 1828920 ^/httpd/httpd/trunk .
-     +1: covener, jhriggs, jim
 
 
 PATCHES PROPOSED TO BACKPORT FROM TRUNK:
index 8d1607cfc23ca070bdc40d44d904390e580fbf29..ba16622d74c762dd3790e3fe29fb274c499bf6f6 100644 (file)
@@ -186,7 +186,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! */
             /*
@@ -204,9 +205,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 {