]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
config: Speed up graceful restarts by using pre-hashed command table. PR 64066.
authorJim Jagielski <jim@apache.org>
Tue, 14 Jan 2020 17:31:49 +0000 (17:31 +0000)
committerJim Jagielski <jim@apache.org>
Tue, 14 Jan 2020 17:31:49 +0000 (17:31 +0000)
        [Giovanni Bechis <giovanni paclan.it>, Jim Jagielski]

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

CHANGES
server/config.c

diff --git a/CHANGES b/CHANGES
index cac7c0c54b7a9f2deb40d85ad1d59569bf22f121..e0893a94c0fc6469bd591cd69f33dd0d547cf983 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,9 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache 2.5.1
 
+  *) config: Speed up graceful restarts by using pre-hashed command table. PR 64066.
+     [Giovanni Bechis <giovanni paclan.it>, Jim Jagielski]
+
   *) mod_lua: Add r:headers_in_table, r:headers_out_table, r:err_headers_out_table,
      r:notes_table, r:subprocess_env_table as read-only native table alternatives
      that can be iterated over. [Eric Covener]
index f9883687187ada0a8ef06b365eb41db4795c8897..8de2cec945a827f5833625a6afb043494f93b872 100644 (file)
@@ -1120,8 +1120,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;
@@ -1159,9 +1160,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;