From 6917e54aad49bcc2817aeb34a3d5b2d12ff0c49c Mon Sep 17 00:00:00 2001 From: Yann Ylavic Date: Mon, 22 Jun 2020 20:00:23 +0000 Subject: [PATCH] Follow up to r1879080: rename ProxyMappingDecoded to ProxyUseOriginalURI. Same for proxy_dir_conf field. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1879094 13f79535-47bb-0310-9956-ffa450edef68 --- modules/proxy/mod_proxy.c | 19 ++++++++++--------- modules/proxy/mod_proxy.h | 4 ++-- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/modules/proxy/mod_proxy.c b/modules/proxy/mod_proxy.c index 3e2e3e4319..a2f859e303 100644 --- a/modules/proxy/mod_proxy.c +++ b/modules/proxy/mod_proxy.c @@ -936,7 +936,7 @@ PROXY_DECLARE(int) ap_proxy_trans_match(request_rec *r, struct proxy_alias *ent, * might consider for instance that an original %3B is a delimiter * for path parameters (which is not). */ - if (!dconf->mapping_decoded + if (dconf->use_original_uri > 0 && (ent->flags & PROXYPASS_MAPPING_SERVLET)) { nocanon = 0; /* ignored since servlet's normalization applies */ len = alias_match_servlet(r->pool, r->uri, fake); @@ -1019,10 +1019,10 @@ static int proxy_trans(request_rec *r, int pre_trans) dconf = ap_get_module_config(r->per_dir_config, &proxy_module); - /* Do the work from the hook corresponding to the ProxyMappingDecoded + /* Do the work from the hook corresponding to the ProxyUseOriginalURI * configuration (on/default: translate hook, off: pre_translate hook). */ - if (pre_trans ^ !dconf->mapping_decoded) { + if (pre_trans ^ (dconf->use_original_uri > 0)) { return DECLINED; } @@ -1813,7 +1813,7 @@ static void *create_proxy_dir_config(apr_pool_t *p, char *dummy) new->add_forwarded_headers_set = 0; new->forward_100_continue = 1; new->forward_100_continue_set = 0; - new->mapping_decoded = -1; /* unset (on by default) */ + new->use_original_uri = -1; /* unset (off by default) */ return (void *) new; } @@ -1872,8 +1872,9 @@ static void *merge_proxy_dir_config(apr_pool_t *p, void *basev, void *addv) new->forward_100_continue_set = add->forward_100_continue_set || base->forward_100_continue_set; - new->mapping_decoded = (add->mapping_decoded == -1) ? base->mapping_decoded - : add->mapping_decoded; + new->use_original_uri = (add->use_original_uri == -1) + ? base->use_original_uri + : add->use_original_uri; return new; } @@ -3026,9 +3027,9 @@ static const command_rec proxy_cmds[] = AP_INIT_FLAG("Proxy100Continue", forward_100_continue, NULL, RSRC_CONF|ACCESS_CONF, "on if 100-Continue should be forwarded to the origin server, off if the " "proxy should handle it by itself"), - AP_INIT_FLAG("ProxyMappingDecoded", ap_set_flag_slot_char, - (void*)APR_OFFSETOF(proxy_dir_conf, mapping_decoded), RSRC_CONF|ACCESS_CONF, - "Whether to percent-decode before URI-path mapping"), + AP_INIT_FLAG("ProxyUseOriginalURI", ap_set_flag_slot_char, + (void*)APR_OFFSETOF(proxy_dir_conf, use_original_uri), RSRC_CONF|ACCESS_CONF, + "Whether to use the original/encoded URI-path for mapping"), {NULL} }; diff --git a/modules/proxy/mod_proxy.h b/modules/proxy/mod_proxy.h index 96cc8c26ed..297c831628 100644 --- a/modules/proxy/mod_proxy.h +++ b/modules/proxy/mod_proxy.h @@ -245,8 +245,8 @@ typedef struct { apr_array_header_t *error_override_codes; - /** Whether to map percent-decoded URI-path */ - char mapping_decoded; + /** Whether to use original/encoded URI-path or not (default) */ + char use_original_uri; } proxy_dir_conf; /* if we interpolate env vars per-request, we'll need a per-request