From: Jim Jagielski Date: Tue, 14 Jan 2020 17:31:49 +0000 (+0000) Subject: config: Speed up graceful restarts by using pre-hashed command table. PR 64066. X-Git-Tag: 2.5.0-alpha2-ci-test-only~1698 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7b406d6d74ce1ddd38da75071426845386d1d3a0;p=thirdparty%2Fapache%2Fhttpd.git config: Speed up graceful restarts by using pre-hashed command table. PR 64066. [Giovanni Bechis , Jim Jagielski] git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1872786 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/CHANGES b/CHANGES index cac7c0c54b7..e0893a94c0f 100644 --- 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 , 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] diff --git a/server/config.c b/server/config.c index f9883687187..8de2cec945a 100644 --- a/server/config.c +++ b/server/config.c @@ -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;