mirror of
https://github.com/apache/httpd.git
synced 2025-08-07 04:02:58 +03:00
mod_proxy: Avoid confusion of prefix/regex matching workers at loading. PR 65429.
ap_proxy_get_worker() needs to know whether it should lookup for prefix or match or both matching workers, depending on the context. For instance <Proxy[Match]> or ProxyPass[Match] directives need to lookup for an existing worker with the same type as the directive (*Match or not), because they will define one with that matching type if none exists. On the contrary, "ProxySet <url>" at load time or ap_proxy_pre_request() at run time need to find a worker matching an url whether it's by prefix or by regex. So this commit adds ap_proxy_get_worker_ex() which takes a bitmask for the matching type and calls it appropriately where needed. For consistency, ap_proxy_define_worker_ex() is also added, using the same bitmask flags, deprecating ap_proxy_define_match_worker(). Follow up to r1891206. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1891284 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -764,8 +764,29 @@ PROXY_DECLARE(int) ap_proxy_worker_can_upgrade(apr_pool_t *p,
|
||||
const char *upgrade,
|
||||
const char *dflt);
|
||||
|
||||
/* Bitmask for ap_proxy_{define,get}_worker_ex(). */
|
||||
#define AP_PROXY_WORKER_IS_PREFIX (1u << 0)
|
||||
#define AP_PROXY_WORKER_IS_MATCH (1u << 1)
|
||||
#define AP_PROXY_WORKER_IS_MALLOCED (1u << 2)
|
||||
|
||||
/**
|
||||
* Get the worker from proxy configuration
|
||||
* Get the worker from proxy configuration, looking for either PREFIXED or
|
||||
* MATCHED or both types of workers according to given mask
|
||||
* @param p memory pool used for finding worker
|
||||
* @param balancer the balancer that the worker belongs to
|
||||
* @param conf current proxy server configuration
|
||||
* @param url url to find the worker from
|
||||
* @param mask bitmask of AP_PROXY_WORKER_IS_*
|
||||
* @return proxy_worker or NULL if not found
|
||||
*/
|
||||
PROXY_DECLARE(proxy_worker *) ap_proxy_get_worker_ex(apr_pool_t *p,
|
||||
proxy_balancer *balancer,
|
||||
proxy_server_conf *conf,
|
||||
const char *url,
|
||||
unsigned int mask);
|
||||
|
||||
/**
|
||||
* Get the worker from proxy configuration, both types
|
||||
* @param p memory pool used for finding worker
|
||||
* @param balancer the balancer that the worker belongs to
|
||||
* @param conf current proxy server configuration
|
||||
@@ -776,7 +797,26 @@ PROXY_DECLARE(proxy_worker *) ap_proxy_get_worker(apr_pool_t *p,
|
||||
proxy_balancer *balancer,
|
||||
proxy_server_conf *conf,
|
||||
const char *url);
|
||||
|
||||
/**
|
||||
* Define and Allocate space for the worker to proxy configuration, of either
|
||||
* PREFIXED or MATCHED type according to given mask
|
||||
* @param p memory pool to allocate worker from
|
||||
* @param worker the new worker
|
||||
* @param balancer the balancer that the worker belongs to
|
||||
* @param conf current proxy server configuration
|
||||
* @param url url containing worker name
|
||||
* @param mask bitmask of AP_PROXY_WORKER_IS_*
|
||||
* @return error message or NULL if successful (*worker is new worker)
|
||||
*/
|
||||
PROXY_DECLARE(char *) ap_proxy_define_worker_ex(apr_pool_t *p,
|
||||
proxy_worker **worker,
|
||||
proxy_balancer *balancer,
|
||||
proxy_server_conf *conf,
|
||||
const char *url,
|
||||
unsigned int mask);
|
||||
|
||||
/**
|
||||
* Define and Allocate space for the worker to proxy configuration
|
||||
* @param p memory pool to allocate worker from
|
||||
* @param worker the new worker
|
||||
@@ -803,6 +843,7 @@ PROXY_DECLARE(char *) ap_proxy_define_worker(apr_pool_t *p,
|
||||
* @param url url containing worker name (produces match pattern)
|
||||
* @param do_malloc true if shared struct should be malloced
|
||||
* @return error message or NULL if successful (*worker is new worker)
|
||||
* @deprecated Replaced by ap_proxy_define_worker_ex()
|
||||
*/
|
||||
PROXY_DECLARE(char *) ap_proxy_define_match_worker(apr_pool_t *p,
|
||||
proxy_worker **worker,
|
||||
|
Reference in New Issue
Block a user