httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Greg Marr <gr...@alum.wpi.edu>
Subject Re: [PATCH] ap_get_remote_host(), IPv6, mod_access
Date Fri, 09 Mar 2001 18:19:33 GMT
At 01:10 PM 03/09/2001, Jeff Trawick wrote:
>The patch below tells the caller of ap_get_remote_host() when an IP 
>address string is returned.  (I guess I should just commit it, but 
>it seems a little ugly to me
>since most code doesn't care.  Any better ideas?)

How about making NULL valid for the is_ip parameter?  Then the 
functions that don't care can pass NULL.  It'll add one or two 
compares to NULL to the ap_get_remote_host() function, but save a lot 
of local variables in other places.

>  AP_DECLARE(const char *) ap_get_remote_host(conn_rec *conn, void 
> *dir_config,
>-                                           int type)
>+                                           int type, int *str_is_ip)
>  {
>      int hostname_lookups;

+    if(NULL != str_is_ip)
>+    *str_is_ip = 0;
>+
>      /* If we haven't checked the host name, and we want to */
>      if (dir_config) {
>         hostname_lookups =
>@@ -667,6 +669,7 @@
>             return NULL;
>         }
>         else {
+    if(NULL != str_is_ip)
>+            *str_is_ip = 1;
>             return conn->remote_ip;
>         }
>      }

-- 
Greg Marr
gregm@alum.wpi.edu
"We thought you were dead."
"I was, but I'm better now." - Sheridan, "The Summoning"


Mime
View raw message