From: Graham Leggett Date: Mon, 17 Jul 2023 20:33:05 +0000 (+0000) Subject: Backport to v2.4: X-Git-Tag: 2.4.58-rc1-candidate~70 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ff2e5a1196c8cedf5d43edc782e78d6795b57115;p=thirdparty%2Fapache%2Fhttpd.git Backport to v2.4: *) Easy patches: synch 2.4.x and trunk - core: constify pointers in ap_expr lookup tables. ~1/2Kb moves to r/o text section - core: Optimize performance in ap_normalize_path() - core: Optimize code flow in log_backtrace() - Fix a typo in README.cmake - Add a missing 'be' in README.CHANGES trunk patch: https://svn.apache.org/r1877350 https://svn.apache.org/r1894021 https://svn.apache.org/r1906379 https://svn.apache.org/r1908657 https://svn.apache.org/r1908150 2.4.x patch: svn merge -c 1877350,1894021,1906379,1908657,1908150 ^/httpd/httpd/trunk . +1: jailletc36, rpluem, gbechis git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1911073 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/CHANGES b/CHANGES index 0a677d39fcf..86c60467144 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,15 @@ -*- coding: utf-8 -*- Changes with Apache 2.4.58 + *) Easy patches: synch 2.4.x and trunk + - core: constify pointers in ap_expr lookup tables. + ~1/2Kb moves to r/o text section + - core: Optimize performance in ap_normalize_path() + - core: Optimize code flow in log_backtrace() + - Fix a typo in README.cmake + - Add a missing 'be' in README.CHANGES + [Christophe Jaillet] + Changes with Apache 2.4.57 *) mod_proxy: Check before forwarding that a nocanon path has not been diff --git a/README.CHANGES b/README.CHANGES index a1d26379aa3..26f8c26197a 100644 --- a/README.CHANGES +++ b/README.CHANGES @@ -15,5 +15,5 @@ afterwards. This make target can be seen in a similar way as the scripts to update the documentation files from its xml sources. It can be executed immediately after the new file in the changes-entries directory has been created / merged -and committed or it can executed later. It should be executed at least before +and committed or it can be executed later. It should be executed at least before a release gets tagged. diff --git a/README.cmake b/README.cmake index 60fcc422da5..f262c143ec6 100644 --- a/README.cmake +++ b/README.cmake @@ -148,7 +148,7 @@ How to build included if it is present. -DNGHTTP2_INCLUDE_DIR=d:/path/to/nghttp2inst/include (which has nghttp2/*.h) - -DNGHTTP2_LIBRARIES=d:/path/to/nghttp2inst/lib/nghttp2.lib" + -DNGHTTP2_LIBRARIES="d:/path/to/nghttp2inst/lib/nghttp2.lib" These will have to be specified if nghttp2 was installed to a different directory than httpd. diff --git a/STATUS b/STATUS index c781dd2f6a4..1fe1f78951c 100644 --- a/STATUS +++ b/STATUS @@ -152,21 +152,6 @@ RELEASE SHOWSTOPPERS: PATCHES ACCEPTED TO BACKPORT FROM TRUNK: [ start all new proposals below, under PATCHES PROPOSED. ] - *) Easy patches: synch 2.4.x and trunk - - core: constify pointers in ap_expr lookup tables. ~1/2Kb moves to r/o text section - - core: Optimize performance in ap_normalize_path() - - core: Optimize code flow in log_backtrace() - - Fix a typo in README.cmake - - Add a missing 'be' in README.CHANGES - trunk patch: - https://svn.apache.org/r1877350 - https://svn.apache.org/r1894021 - https://svn.apache.org/r1906379 - https://svn.apache.org/r1908657 - https://svn.apache.org/r1908150 - 2.4.x patch: svn merge -c 1877350,1894021,1906379,1908657,1908150 ^/httpd/httpd/trunk . - +1: jailletc36, rpluem, gbechis - *) core: Optimize send_brigade_nonblocking() trunk patch: https://svn.apache.org/r1892450 diff --git a/server/core.c b/server/core.c index e1493fd4091..16af0bebcca 100644 --- a/server/core.c +++ b/server/core.c @@ -3951,24 +3951,26 @@ static const char *set_recursion_limit(cmd_parms *cmd, void *dummy, static void log_backtrace(const request_rec *r) { - const request_rec *top = r; - - ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(00121) - "r->uri = %s", r->uri ? r->uri : "(unexpectedly NULL)"); - - while (top && (top->prev || top->main)) { - if (top->prev) { - top = top->prev; - ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(00122) - "redirected from r->uri = %s", - top->uri ? top->uri : "(unexpectedly NULL)"); - } + if (APLOGrdebug(r)) { + const request_rec *top = r; + + ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(00121) + "r->uri = %s", r->uri ? r->uri : "(unexpectedly NULL)"); + + while (top && (top->prev || top->main)) { + if (top->prev) { + top = top->prev; + ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(00122) + "redirected from r->uri = %s", + top->uri ? top->uri : "(unexpectedly NULL)"); + } - if (!top->prev && top->main) { - top = top->main; - ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(00123) - "subrequested from r->uri = %s", - top->uri ? top->uri : "(unexpectedly NULL)"); + if (!top->prev && top->main) { + top = top->main; + ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(00123) + "subrequested from r->uri = %s", + top->uri ? top->uri : "(unexpectedly NULL)"); + } } } } diff --git a/server/util.c b/server/util.c index 2015e430fba..4602c7a16cf 100644 --- a/server/util.c +++ b/server/util.c @@ -502,6 +502,7 @@ AP_DECLARE(int) ap_normalize_path(char *path, unsigned int flags) int ret = 1; apr_size_t l = 1, w = 1, n; int decode_unreserved = (flags & AP_NORMALIZE_DECODE_UNRESERVED) != 0; + int merge_slashes = (flags & AP_NORMALIZE_MERGE_SLASHES) != 0; if (!IS_SLASH(path[0])) { /* Besides "OPTIONS *", a request-target should start with '/' @@ -546,7 +547,7 @@ AP_DECLARE(int) ap_normalize_path(char *path, unsigned int flags) if (w == 0 || IS_SLASH(path[w - 1])) { /* Collapse ///// sequences to / */ - if ((flags & AP_NORMALIZE_MERGE_SLASHES) && IS_SLASH(path[l])) { + if (merge_slashes && IS_SLASH(path[l])) { do { l++; } while (IS_SLASH(path[l])); diff --git a/server/util_expr_eval.c b/server/util_expr_eval.c index 7d6ae1ea7ca..db4be957d80 100644 --- a/server/util_expr_eval.c +++ b/server/util_expr_eval.c @@ -1271,7 +1271,7 @@ static int op_file_subr(ap_expr_eval_ctx_t *ctx, const void *data, const char *a APR_DECLARE_OPTIONAL_FN(int, http2_is_h2, (conn_rec *)); static APR_OPTIONAL_FN_TYPE(http2_is_h2) *is_http2 = NULL; -static const char *conn_var_names[] = { +static const char *const conn_var_names[] = { "HTTPS", /* 0 */ "IPV6", /* 1 */ "CONN_LOG_ID", /* 2 */ @@ -1321,7 +1321,7 @@ static const char *conn_var_fn(ap_expr_eval_ctx_t *ctx, const void *data) } } -static const char *request_var_names[] = { +static const char *const request_var_names[] = { "REQUEST_METHOD", /* 0 */ "REQUEST_SCHEME", /* 1 */ "REQUEST_URI", /* 2 */ @@ -1449,7 +1449,7 @@ static const char *request_var_fn(ap_expr_eval_ctx_t *ctx, const void *data) } } -static const char *req_header_var_names[] = { +static const char *const req_header_var_names[] = { "HTTP_USER_AGENT", /* 0 */ "HTTP_PROXY_CONNECTION", /* 1 */ "HTTP_REFERER", /* 2 */ @@ -1460,7 +1460,7 @@ static const char *req_header_var_names[] = { NULL }; -static const char *req_header_header_names[] = { +static const char *const req_header_header_names[] = { "User-Agent", "Proxy-Connection", "Referer", @@ -1472,7 +1472,7 @@ static const char *req_header_header_names[] = { static const char *req_header_var_fn(ap_expr_eval_ctx_t *ctx, const void *data) { - const char **varname = (const char **)data; + const char **const varname = (const char **)data; int index = (varname - req_header_var_names); const char *name; @@ -1490,7 +1490,7 @@ static const char *req_header_var_fn(ap_expr_eval_ctx_t *ctx, const void *data) return apr_table_get(ctx->r->headers_in, name); } -static const char *misc_var_names[] = { +static const char *const misc_var_names[] = { "TIME_YEAR", /* 0 */ "TIME_MON", /* 1 */ "TIME_DAY", /* 2 */ @@ -1647,7 +1647,7 @@ struct expr_provider_single { struct expr_provider_multi { const void *func; - const char **names; + const char *const *names; }; static const struct expr_provider_multi var_providers[] = { @@ -1716,7 +1716,7 @@ static int core_expr_lookup(ap_expr_lookup_parms *parms) case AP_EXPR_FUNC_VAR: { const struct expr_provider_multi *prov = var_providers; while (prov->func) { - const char **name = prov->names; + const char *const *name = prov->names; while (*name) { if (ap_cstr_casecmp(*name, parms->name) == 0) { *parms->func = prov->func;