You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Lubomir Rintel <lk...@v3.sk> on 2014/03/11 15:00:37 UTC

[PATCH 56152 2/4] mod_proxy: Match resolved addresses for NoProxy too

We resolve the names using the configuration parsing, thus we already have the
addresses. It could be redundant for NoProxy, but the same code could be used
with ProxyBlock if it did this.
---
 modules/proxy/proxy_util.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/modules/proxy/proxy_util.c b/modules/proxy/proxy_util.c
index 0081940..22b6ea1 100644
--- a/modules/proxy/proxy_util.c
+++ b/modules/proxy/proxy_util.c
@@ -699,6 +699,7 @@ static int proxy_match_domainname(struct exclude_entry *This, request_rec *r)
 PROXY_DECLARE(int) ap_proxy_is_hostname(struct exclude_entry *This, apr_pool_t *p)
 {
     struct apr_sockaddr_t *addr;
+    struct in_addr *ip;
     char *host = This->name;
     int i;
 
@@ -714,6 +715,9 @@ PROXY_DECLARE(int) ap_proxy_is_hostname(struct exclude_entry *This, apr_pool_t *
     }
 
     This->hostaddr = addr;
+    ip = (struct in_addr *) addr->ipaddr_ptr;
+    This->addr.s_addr = ip->s_addr;
+    This->mask.s_addr = htonl(APR_INADDR_NONE);
 
     /* Strip trailing dots */
     for (i = strlen(host) - 1; i > 0 && host[i] == '.'; --i) {
@@ -736,6 +740,10 @@ static int proxy_match_hostname(struct exclude_entry *This, request_rec *r)
         return 0; /* oops! */
     }
 
+    /* Maybe the ip address matches. */
+    if (proxy_match_ipaddr(This, r))
+        return 1;
+
     h2_len = strlen(host2);
     h1_len = strlen(host);
 
-- 
1.8.3.1