httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lubomir Rintel <lkund...@v3.sk>
Subject [PATCH RESEND 2/4] mod_proxy: Match resolved addresses for NoProxy too
Date Wed, 19 Mar 2014 10:04:15 GMT
From: Lubomir Rintel <lubo.rintel@gooddata.com>

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 c6fcc43..382ff9c 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


Mime
View raw message