#https://svn.apache.org/r1807754
#
#commit 40e03b310047418c1339823c981182eb36a60e85
#Author: Yann Ylavic <ylavic@apache.org>
#Date:   Fri Sep 8 13:13:11 2017 +0000
#
#    Merge r1807655 from trunk:
#    
#    core: Disallow Methods' registration at run time (.htaccess), they may be
#    used only if registered at init time (httpd.conf).
#    
#    Calling ap_method_register() in children processes is not the right scope
#    since it won't be shared for all requests.
#    
#    Reviewed by: ylavic, covener, icing
#    
#    
#    git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1807754 13f79535-47bb-0310-9956-ffa450edef68
#
--- apache2.orig/server/core.c
+++ apache2/server/core.c
@@ -2262,6 +2262,12 @@ AP_CORE_DECLARE_NONSTD(const char *) ap_
             /* method has not been registered yet, but resource restriction
              * is always checked before method handling, so register it.
              */
+            if (cmd->pool == cmd->temp_pool) {
+                /* In .htaccess, we can't globally register new methods. */
+                return apr_psprintf(cmd->pool, "Could not register method '%s' "
+                                   "for %s from .htaccess configuration",
+                                    method, cmd->cmd->name);
+            }
             methnum = ap_method_register(cmd->pool,
                                          apr_pstrdup(cmd->pool, method));
         }
