From: Stefan Fritsch Date: Fri, 14 Oct 2011 19:51:17 +0000 (+0000) Subject: There is absolutely no reason to have two 4k-sized constant strmatch patterns X-Git-Tag: 2.3.15~120 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=40b2bb8f92397ba155cefc2ba0c494bc6f5530cb;p=apache There is absolutely no reason to have two 4k-sized constant strmatch patterns in each per-dir config. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1183475 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/include/ap_mmn.h b/include/ap_mmn.h index d48a1ca44d..171655b79d 100644 --- a/include/ap_mmn.h +++ b/include/ap_mmn.h @@ -358,12 +358,14 @@ * 20110724.10(2.3.15-dev) Export ap_max_mem_free * 20111009.0 (2.3.15-dev) Remove ap_proxy_removestr(), * add ap_unixd_config.group_name + * 20111014.0 (2.3.15-dev) Remove cookie_path_str and cookie_domain_str from + * proxy_dir_conf */ #define MODULE_MAGIC_COOKIE 0x41503234UL /* "AP24" */ #ifndef MODULE_MAGIC_NUMBER_MAJOR -#define MODULE_MAGIC_NUMBER_MAJOR 20111009 +#define MODULE_MAGIC_NUMBER_MAJOR 20111014 #endif #define MODULE_MAGIC_NUMBER_MINOR 0 /* 0...n */ diff --git a/modules/proxy/mod_proxy.c b/modules/proxy/mod_proxy.c index 0a9fbc97c3..d5cf9ea687 100644 --- a/modules/proxy/mod_proxy.c +++ b/modules/proxy/mod_proxy.c @@ -1220,8 +1220,6 @@ static void *create_proxy_dir_config(apr_pool_t *p, char *dummy) new->raliases = apr_array_make(p, 10, sizeof(struct proxy_alias)); new->cookie_paths = apr_array_make(p, 10, sizeof(struct proxy_alias)); new->cookie_domains = apr_array_make(p, 10, sizeof(struct proxy_alias)); - new->cookie_path_str = apr_strmatch_precompile(p, "path=", 0); - new->cookie_domain_str = apr_strmatch_precompile(p, "domain=", 0); new->preserve_host_set = 0; new->preserve_host = 0; new->interpolate_env = -1; /* unset */ @@ -1248,8 +1246,6 @@ static void *merge_proxy_dir_config(apr_pool_t *p, void *basev, void *addv) = apr_array_append(p, base->cookie_paths, add->cookie_paths); new->cookie_domains = apr_array_append(p, base->cookie_domains, add->cookie_domains); - new->cookie_path_str = base->cookie_path_str; - new->cookie_domain_str = base->cookie_domain_str; new->interpolate_env = (add->interpolate_env == -1) ? base->interpolate_env : add->interpolate_env; new->preserve_host = (add->preserve_host_set == 0) ? base->preserve_host @@ -2299,6 +2295,8 @@ static int proxy_post_config(apr_pool_t *pconf, apr_pool_t *plog, proxy_ssl_disable = APR_RETRIEVE_OPTIONAL_FN(ssl_engine_disable); proxy_is_https = APR_RETRIEVE_OPTIONAL_FN(ssl_is_https); proxy_ssl_val = APR_RETRIEVE_OPTIONAL_FN(ssl_var_lookup); + ap_proxy_strmatch_path = apr_strmatch_precompile(pconf, "path=", 0); + ap_proxy_strmatch_domain = apr_strmatch_precompile(pconf, "domain=", 0); return OK; } diff --git a/modules/proxy/mod_proxy.h b/modules/proxy/mod_proxy.h index 85886e2bf4..1f269f921e 100644 --- a/modules/proxy/mod_proxy.h +++ b/modules/proxy/mod_proxy.h @@ -193,8 +193,6 @@ typedef struct { apr_array_header_t *raliases; apr_array_header_t* cookie_paths; apr_array_header_t* cookie_domains; - const apr_strmatch_pattern* cookie_path_str; - const apr_strmatch_pattern* cookie_domain_str; signed char p_is_fnmatch; /* Is the path an fnmatch candidate? */ signed char interpolate_env; struct proxy_alias *alias; @@ -907,6 +905,8 @@ int ap_proxy_lb_workers(void); extern module PROXY_DECLARE_DATA proxy_module; extern int PROXY_DECLARE_DATA proxy_lb_workers; +extern const apr_strmatch_pattern * PROXY_DECLARE_DATA ap_proxy_strmatch_path; +extern const apr_strmatch_pattern * PROXY_DECLARE_DATA ap_proxy_strmatch_domain; #endif /*MOD_PROXY_H*/ /** @} */ diff --git a/modules/proxy/proxy_util.c b/modules/proxy/proxy_util.c index 3b91d9e97d..5c1f842366 100644 --- a/modules/proxy/proxy_util.c +++ b/modules/proxy/proxy_util.c @@ -65,6 +65,8 @@ static struct wstat { /* Global balancer counter */ int PROXY_DECLARE_DATA proxy_lb_workers = 0; static int lb_workers_limit = 0; +const apr_strmatch_pattern * PROXY_DECLARE_DATA ap_proxy_strmatch_path; +const apr_strmatch_pattern * PROXY_DECLARE_DATA ap_proxy_strmatch_domain; static int proxy_match_ipaddr(struct dirconn_entry *This, request_rec *r); static int proxy_match_domainname(struct dirconn_entry *This, request_rec *r); @@ -1170,7 +1172,7 @@ PROXY_DECLARE(const char *) ap_proxy_cookie_reverse_map(request_rec *r, * Find the match and replacement, but save replacing until we've done * both path and domain so we know the new strlen */ - if ((pathp = apr_strmatch(conf->cookie_path_str, str, len)) != NULL) { + if ((pathp = apr_strmatch(ap_proxy_strmatch_path, str, len)) != NULL) { pathp += 5; poffs = pathp - str; pathe = ap_strchr_c(pathp, ';'); @@ -1192,7 +1194,7 @@ PROXY_DECLARE(const char *) ap_proxy_cookie_reverse_map(request_rec *r, } } - if ((domainp = apr_strmatch(conf->cookie_domain_str, str, len)) != NULL) { + if ((domainp = apr_strmatch(ap_proxy_strmatch_domain, str, len)) != NULL) { domainp += 7; doffs = domainp - str; domaine = ap_strchr_c(domainp, ';');