From 3f38fb87652a34e9bd9fef09883cbd9e2f1e2cc4 Mon Sep 17 00:00:00 2001 From: Jim Jagielski Date: Wed, 16 Sep 2015 13:34:11 +0000 Subject: [PATCH] Merge r1602978, r1683044, r1683884, r1673368, r1701717, r1683047 from trunk: Core filters do not need mod_proxy.h Small speed optimization when parsing , and environment variables Save a few bytes in conf pool Remove some spaces between some return statements and ';' + fix a strange formating in a 'for' loop In order to save a few cycles, delay a hash table lookup which is not necessary needed Constify + save a few bytes in conf pool Submitted by: ylavic, jailletc36, jailletc36, jailletc36, jailletc36, jailletc36 Reviewed/backported by: jim git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1703405 13f79535-47bb-0310-9956-ffa450edef68 --- STATUS | 19 ------------------- modules/dav/main/mod_dav.c | 2 +- modules/dav/main/util.c | 3 ++- modules/filters/mod_deflate.c | 14 +++++++------- modules/proxy/mod_proxy_http.c | 13 ++++++------- server/core.c | 8 ++++---- server/core_filters.c | 1 - 7 files changed, 20 insertions(+), 40 deletions(-) diff --git a/STATUS b/STATUS index 5a0224377c..12ef90c800 100644 --- a/STATUS +++ b/STATUS @@ -109,25 +109,6 @@ RELEASE SHOWSTOPPERS: PATCHES ACCEPTED TO BACKPORT FROM TRUNK: [ start all new proposals below, under PATCHES PROPOSED. ] - *) Easy patches - synch with trunk - - core: Core filters do not need mod_proxy.h - - core: Small speed optimization when parsing , - and environment variables - - mod_dav: Save a few bytes in conf pool - - mod_proxy_http: Remove some spaces between some return statements - and ';' + fix a strange formating in a 'for' loop - - mod_dav: Save a few cycles - - mod_deflate: Constify + save a few bytes in conf pool - trunk patch: - http://svn.apache.org/r1602978 - http://svn.apache.org/r1683044 - http://svn.apache.org/r1683884 - http://svn.apache.org/r1673368 - http://svn.apache.org/r1701717 - http://svn.apache.org/r1683047 - 2.4.x patch: trunk patchs work - +1: jailletc36, ylavic, jim - *) Easy patches - synch with trunk mod_negotiation: simplify type-map body tag lookup, and be safe should it contain a NUL byte. diff --git a/modules/dav/main/mod_dav.c b/modules/dav/main/mod_dav.c index 2319549a42..cd45ef940d 100644 --- a/modules/dav/main/mod_dav.c +++ b/modules/dav/main/mod_dav.c @@ -254,7 +254,7 @@ static const char *dav_cmd_dav(cmd_parms *cmd, void *config, const char *arg1) conf->provider = NULL; } else { - conf->provider_name = apr_pstrdup(cmd->pool, arg1); + conf->provider_name = arg1; } if (conf->provider_name != NULL) { diff --git a/modules/dav/main/util.c b/modules/dav/main/util.c index 3d4b1ec3d8..8d4f64a2bd 100644 --- a/modules/dav/main/util.c +++ b/modules/dav/main/util.c @@ -1823,10 +1823,11 @@ DAV_DECLARE(void) dav_add_vary_header(request_rec *in_req, * so only do this check if there is a versioning provider */ if (vsn_hooks != NULL) { const char *target = apr_table_get(in_req->headers_in, DAV_LABEL_HDR); - const char *vary = apr_table_get(out_req->headers_out, "Vary"); /* If Target-Selector specified, add it to the Vary header */ if (target != NULL) { + const char *vary = apr_table_get(out_req->headers_out, "Vary"); + if (vary == NULL) vary = DAV_LABEL_HDR; else diff --git a/modules/filters/mod_deflate.c b/modules/filters/mod_deflate.c index 0b38e9a3f1..60a136c0ac 100644 --- a/modules/filters/mod_deflate.c +++ b/modules/filters/mod_deflate.c @@ -62,9 +62,9 @@ typedef struct deflate_filter_config_t int memlevel; int compressionlevel; apr_size_t bufferSize; - char *note_ratio_name; - char *note_input_name; - char *note_output_name; + const char *note_ratio_name; + const char *note_input_name; + const char *note_output_name; } deflate_filter_config; typedef struct deflate_dirconf_t { @@ -261,16 +261,16 @@ static const char *deflate_set_note(cmd_parms *cmd, void *dummy, &deflate_module); if (arg2 == NULL) { - c->note_ratio_name = apr_pstrdup(cmd->pool, arg1); + c->note_ratio_name = arg1; } else if (!strcasecmp(arg1, "ratio")) { - c->note_ratio_name = apr_pstrdup(cmd->pool, arg2); + c->note_ratio_name = arg2; } else if (!strcasecmp(arg1, "input")) { - c->note_input_name = apr_pstrdup(cmd->pool, arg2); + c->note_input_name = arg2; } else if (!strcasecmp(arg1, "output")) { - c->note_output_name = apr_pstrdup(cmd->pool, arg2); + c->note_output_name = arg2; } else { return apr_psprintf(cmd->pool, "Unknown note type %s", arg1); diff --git a/modules/proxy/mod_proxy_http.c b/modules/proxy/mod_proxy_http.c index ddb8a12e67..5e95ea2fa0 100644 --- a/modules/proxy/mod_proxy_http.c +++ b/modules/proxy/mod_proxy_http.c @@ -951,7 +951,7 @@ skip_body: break; default: /* shouldn't be possible */ - rv = HTTP_INTERNAL_SERVER_ERROR ; + rv = HTTP_INTERNAL_SERVER_ERROR; break; } @@ -1117,7 +1117,7 @@ static void ap_proxy_read_headers(request_rec *r, request_rec *rr, if (psc->badopt == bad_error) { /* Nope, it wasn't even an extra HTTP header. Give up. */ r->headers_out = NULL; - return ; + return; } else if (psc->badopt == bad_body) { /* if we've already started loading headers_out, then @@ -1131,12 +1131,12 @@ static void ap_proxy_read_headers(request_rec *r, request_rec *rr, "in headers returned by %s (%s)", r->uri, r->method); *pread_len = len; - return ; + return; } else { ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r, APLOGNO(01099) "No HTTP headers returned by %s (%s)", r->uri, r->method); - return ; + return; } } } @@ -1156,15 +1156,14 @@ static void ap_proxy_read_headers(request_rec *r, request_rec *rr, ++value; /* Skip to start of value */ /* should strip trailing whitespace as well */ - for (end = &value[strlen(value)-1]; end > value && apr_isspace(*end); -- -end) + for (end = &value[strlen(value)-1]; end > value && apr_isspace(*end); --end) *end = '\0'; /* make sure we add so as not to destroy duplicated headers * Modify headers requiring canonicalisation and/or affected * by ProxyPassReverse and family with process_proxy_header */ - process_proxy_header(r, dconf, buffer, value) ; + process_proxy_header(r, dconf, buffer, value); saw_headers = 1; /* the header was too long; at the least we should skip extra data */ diff --git a/server/core.c b/server/core.c index 802d8fdcdb..302f90ed4e 100644 --- a/server/core.c +++ b/server/core.c @@ -1230,8 +1230,8 @@ AP_DECLARE(const char *) ap_resolve_env(apr_pool_t *p, const char * word) } if (*s == '$') { - if (s[1] == '{' && (e = ap_strchr_c(s, '}'))) { - char *name = apr_pstrndup(p, s+2, e-s-2); + if (s[1] == '{' && (e = ap_strchr_c(s+2, '}'))) { + char *name = apr_pstrmemdup(p, s+2, e-s-2); word = NULL; if (server_config_defined_vars) word = apr_table_get(server_config_defined_vars, name); @@ -2084,7 +2084,7 @@ AP_CORE_DECLARE_NONSTD(const char *) ap_limit_section(cmd_parms *cmd, return unclosed_directive(cmd); } - limited_methods = apr_pstrndup(cmd->temp_pool, arg, endp - arg); + limited_methods = apr_pstrmemdup(cmd->temp_pool, arg, endp - arg); if (!limited_methods[0]) { return missing_container_arg(cmd); @@ -2101,7 +2101,7 @@ AP_CORE_DECLARE_NONSTD(const char *) ap_limit_section(cmd_parms *cmd, return "TRACE cannot be controlled by , see TraceEnable"; } else if (methnum == M_INVALID) { - /* method has not been registered yet, but resorce restriction + /* method has not been registered yet, but resource restriction * is always checked before method handling, so register it. */ methnum = ap_method_register(cmd->pool, diff --git a/server/core_filters.c b/server/core_filters.c index 61dc2f0ac4..958055ba3d 100644 --- a/server/core_filters.c +++ b/server/core_filters.c @@ -48,7 +48,6 @@ #include "mpm_common.h" #include "scoreboard.h" #include "mod_core.h" -#include "mod_proxy.h" #include "ap_listen.h" #include "mod_so.h" /* for ap_find_loaded_module_symbol */ -- 2.40.0