From 81c69056a3c07f96ecf8b51815889d880aaea683 Mon Sep 17 00:00:00 2001 From: Lubomir Rintel Date: Mon, 17 Feb 2014 21:56:29 +0100 Subject: [PATCH 1/4] mod_proxy: Rename dirconn_entry to exclude_entry Currently they are used for NoProxy, but could be reusable to ProxyBlock. Rename them to something more generic. --- modules/proxy/mod_proxy.c | 8 ++++---- modules/proxy/mod_proxy.h | 4 ++-- modules/proxy/proxy_util.c | 24 ++++++++++++------------ modules/proxy/proxy_util.h | 8 ++++---- 4 files changed, 22 insertions(+), 22 deletions(-) diff --git a/modules/proxy/mod_proxy.c b/modules/proxy/mod_proxy.c index 329e805..e7c78ee 100644 --- a/modules/proxy/mod_proxy.c +++ b/modules/proxy/mod_proxy.c @@ -924,7 +924,7 @@ static int proxy_handler(request_rec *r) proxy_balancer *balancer = NULL; proxy_worker *worker = NULL; int attempts = 0, max_attempts = 0; - struct dirconn_entry *list = (struct dirconn_entry *)conf->dirconn->elts; + struct exclude_entry *list = (struct exclude_entry *)conf->dirconn->elts; /* is this for us? */ if (!r->proxyreq || !r->filename || strncmp(r->filename, "proxy:", 6) != 0) @@ -1203,7 +1203,7 @@ static void * create_proxy_config(apr_pool_t *p, server_rec *s) ps->proxies = apr_array_make(p, 10, sizeof(struct proxy_remote)); ps->aliases = apr_array_make(p, 10, sizeof(struct proxy_alias)); ps->noproxies = apr_array_make(p, 10, sizeof(struct noproxy_entry)); - ps->dirconn = apr_array_make(p, 10, sizeof(struct dirconn_entry)); + ps->dirconn = apr_array_make(p, 10, sizeof(struct exclude_entry)); ps->workers = apr_array_make(p, 10, sizeof(proxy_worker)); ps->balancers = apr_array_make(p, 10, sizeof(proxy_balancer)); ps->forward = NULL; @@ -1766,8 +1766,8 @@ static const char * server_rec *s = parms->server; proxy_server_conf *conf = ap_get_module_config(s->module_config, &proxy_module); - struct dirconn_entry *New; - struct dirconn_entry *list = (struct dirconn_entry *) conf->dirconn->elts; + struct exclude_entry *New; + struct exclude_entry *list = (struct exclude_entry *) conf->dirconn->elts; int found = 0; int i; diff --git a/modules/proxy/mod_proxy.h b/modules/proxy/mod_proxy.h index b99ee17..392c4d0 100644 --- a/modules/proxy/mod_proxy.h +++ b/modules/proxy/mod_proxy.h @@ -115,11 +115,11 @@ struct proxy_alias { proxy_balancer *balancer; /* only valid for reverse-proxys */ }; -struct dirconn_entry { +struct exclude_entry { char *name; struct in_addr addr, mask; struct apr_sockaddr_t *hostaddr; - int (*matcher) (struct dirconn_entry * This, request_rec *r); + int (*matcher) (struct exclude_entry * This, request_rec *r); }; struct noproxy_entry { diff --git a/modules/proxy/proxy_util.c b/modules/proxy/proxy_util.c index 6017b82..0081940 100644 --- a/modules/proxy/proxy_util.c +++ b/modules/proxy/proxy_util.c @@ -79,10 +79,10 @@ const apr_strmatch_pattern PROXY_DECLARE_DATA *ap_proxy_strmatch_domain; extern apr_global_mutex_t *proxy_mutex; -static int proxy_match_ipaddr(struct dirconn_entry *This, request_rec *r); -static int proxy_match_domainname(struct dirconn_entry *This, request_rec *r); -static int proxy_match_hostname(struct dirconn_entry *This, request_rec *r); -static int proxy_match_word(struct dirconn_entry *This, request_rec *r); +static int proxy_match_ipaddr(struct exclude_entry *This, request_rec *r); +static int proxy_match_domainname(struct exclude_entry *This, request_rec *r); +static int proxy_match_hostname(struct exclude_entry *This, request_rec *r); +static int proxy_match_word(struct exclude_entry *This, request_rec *r); APR_IMPLEMENT_OPTIONAL_HOOK_RUN_ALL(proxy, PROXY, int, create_req, (request_rec *r, request_rec *pr), (r, pr), @@ -426,7 +426,7 @@ static const char * } /* Return TRUE if addr represents an IP address (or an IP network address) */ -PROXY_DECLARE(int) ap_proxy_is_ipaddr(struct dirconn_entry *This, apr_pool_t *p) +PROXY_DECLARE(int) ap_proxy_is_ipaddr(struct exclude_entry *This, apr_pool_t *p) { const char *addr = This->name; long ip_addr[4]; @@ -547,7 +547,7 @@ PROXY_DECLARE(int) ap_proxy_is_ipaddr(struct dirconn_entry *This, apr_pool_t *p) } /* Return TRUE if addr represents an IP address (or an IP network address) */ -static int proxy_match_ipaddr(struct dirconn_entry *This, request_rec *r) +static int proxy_match_ipaddr(struct exclude_entry *This, request_rec *r) { int i, ip_addr[4]; struct in_addr addr, *ip; @@ -635,7 +635,7 @@ static int proxy_match_ipaddr(struct dirconn_entry *This, request_rec *r) } /* Return TRUE if addr represents a domain name */ -PROXY_DECLARE(int) ap_proxy_is_domainname(struct dirconn_entry *This, apr_pool_t *p) +PROXY_DECLARE(int) ap_proxy_is_domainname(struct exclude_entry *This, apr_pool_t *p) { char *addr = This->name; int i; @@ -672,7 +672,7 @@ PROXY_DECLARE(int) ap_proxy_is_domainname(struct dirconn_entry *This, apr_pool_t } /* Return TRUE if host "host" is in domain "domain" */ -static int proxy_match_domainname(struct dirconn_entry *This, request_rec *r) +static int proxy_match_domainname(struct exclude_entry *This, request_rec *r) { const char *host = proxy_get_host_of_request(r); int d_len = strlen(This->name), h_len; @@ -696,7 +696,7 @@ static int proxy_match_domainname(struct dirconn_entry *This, request_rec *r) } /* Return TRUE if host represents a host name */ -PROXY_DECLARE(int) ap_proxy_is_hostname(struct dirconn_entry *This, apr_pool_t *p) +PROXY_DECLARE(int) ap_proxy_is_hostname(struct exclude_entry *This, apr_pool_t *p) { struct apr_sockaddr_t *addr; char *host = This->name; @@ -725,7 +725,7 @@ PROXY_DECLARE(int) ap_proxy_is_hostname(struct dirconn_entry *This, apr_pool_t * } /* Return TRUE if host "host" is equal to host2 "host2" */ -static int proxy_match_hostname(struct dirconn_entry *This, request_rec *r) +static int proxy_match_hostname(struct exclude_entry *This, request_rec *r) { char *host = This->name; const char *host2 = proxy_get_host_of_request(r); @@ -762,14 +762,14 @@ static int proxy_match_hostname(struct dirconn_entry *This, request_rec *r) } /* Return TRUE if addr is to be matched as a word */ -PROXY_DECLARE(int) ap_proxy_is_word(struct dirconn_entry *This, apr_pool_t *p) +PROXY_DECLARE(int) ap_proxy_is_word(struct exclude_entry *This, apr_pool_t *p) { This->matcher = proxy_match_word; return 1; } /* Return TRUE if string "str2" occurs literally in "str1" */ -static int proxy_match_word(struct dirconn_entry *This, request_rec *r) +static int proxy_match_word(struct exclude_entry *This, request_rec *r) { const char *host = proxy_get_host_of_request(r); return host != NULL && ap_strstr_c(host, This->name) != NULL; diff --git a/modules/proxy/proxy_util.h b/modules/proxy/proxy_util.h index 202be8d..9cdad90 100644 --- a/modules/proxy/proxy_util.h +++ b/modules/proxy/proxy_util.h @@ -26,10 +26,10 @@ * @{ */ -PROXY_DECLARE(int) ap_proxy_is_ipaddr(struct dirconn_entry *This, apr_pool_t *p); -PROXY_DECLARE(int) ap_proxy_is_domainname(struct dirconn_entry *This, apr_pool_t *p); -PROXY_DECLARE(int) ap_proxy_is_hostname(struct dirconn_entry *This, apr_pool_t *p); -PROXY_DECLARE(int) ap_proxy_is_word(struct dirconn_entry *This, apr_pool_t *p); +PROXY_DECLARE(int) ap_proxy_is_ipaddr(struct exclude_entry *This, apr_pool_t *p); +PROXY_DECLARE(int) ap_proxy_is_domainname(struct exclude_entry *This, apr_pool_t *p); +PROXY_DECLARE(int) ap_proxy_is_hostname(struct exclude_entry *This, apr_pool_t *p); +PROXY_DECLARE(int) ap_proxy_is_word(struct exclude_entry *This, apr_pool_t *p); PROXY_DECLARE_DATA extern int proxy_lb_workers; PROXY_DECLARE_DATA extern const apr_strmatch_pattern *ap_proxy_strmatch_path; -- 1.8.3.1