]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
PR64066: config: Speed up graceful restarts
authorEric Covener <covener@apache.org>
Fri, 7 Feb 2020 13:41:33 +0000 (13:41 +0000)
committerEric Covener <covener@apache.org>
Fri, 7 Feb 2020 13:41:33 +0000 (13:41 +0000)
... by using pre-hashed command table.

Backports: r1872786.

Submitted By: Giovanni Bechis <giovanni paclan.it>
Reviewed By: jim, jorton, covener

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

CHANGES
server/config.c

diff --git a/CHANGES b/CHANGES
index a39a4a2f2b76e232045679decda01695a7c15ead..b10f1b82011bf327d8529cc33101d7de346e7334 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,9 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache 2.4.42
 
+  *) config: Speed up graceful restarts by using pre-hashed command table. PR 64066.
+     [Giovanni Bechis <giovanni paclan.it>, Jim Jagielski]
+
   *) mod_systemd: New module providing integration with systemd.  [Jan Kaluza]
 
   *) mod_lua: Add r:headers_in_table, r:headers_out_table, r:err_headers_out_table,
index e5ec2b006ea439371e264824b574d3f07556aa86..0380cbe02632647c7081c860832b365a0fbb51e6 100644 (file)
@@ -1118,8 +1118,9 @@ static const char *ap_build_config_sub(apr_pool_t *p, apr_pool_t *temp_pool,
     const char *args;
     char *cmd_name;
     ap_directive_t *newdir;
-    module *mod = ap_top_module;
     const command_rec *cmd;
+    ap_mod_list *ml;
+    char *lname;
 
     if (*l == '#' || *l == '\0')
         return NULL;
@@ -1157,9 +1158,12 @@ static const char *ap_build_config_sub(apr_pool_t *p, apr_pool_t *temp_pool,
     newdir->line_num = parms->config_file->line_number;
     newdir->args = apr_pstrdup(p, args);
 
-    if ((cmd = ap_find_command_in_modules(cmd_name, &mod)) != NULL) {
+    lname = apr_pstrdup(temp_pool, cmd_name);
+    ap_str_tolower(lname);
+    ml = apr_hash_get(ap_config_hash, lname, APR_HASH_KEY_STRING);
+
+    if (ml && (cmd = ml->cmd) != NULL) {
         newdir->directive = cmd->name;
-        
         if (cmd->req_override & EXEC_ON_READ) {
             ap_directive_t *sub_tree = NULL;