httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pque...@apache.org
Subject svn commit: r737973 - in /httpd/httpd/trunk: CHANGES modules/mappers/mod_rewrite.c
Date Tue, 27 Jan 2009 02:12:37 GMT
Author: pquerna
Date: Tue Jan 27 02:12:37 2009
New Revision: 737973

URL: http://svn.apache.org/viewvc?rev=737973&view=rev
Log:
Add IPv6 variable to mod_rewrite.
Submitted by: Ryan Phillips <ryan-apache trolocsis.com>

Modified:
    httpd/httpd/trunk/CHANGES
    httpd/httpd/trunk/modules/mappers/mod_rewrite.c

Modified: httpd/httpd/trunk/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/CHANGES?rev=737973&r1=737972&r2=737973&view=diff
==============================================================================
--- httpd/httpd/trunk/CHANGES [utf-8] (original)
+++ httpd/httpd/trunk/CHANGES [utf-8] Tue Jan 27 02:12:37 2009
@@ -2,6 +2,9 @@
 Changes with Apache 2.3.2
 [ When backported to 2.2.x, remove entry from this file ]
 
+ *) mod_rewrite: Add IPV6 variable to RewriteCond
+    [Ryan Phillips <ryan-apache trolocsis.com>]
+
  *) core: Enhance KeepAliveTimeout to support a value in milliseconds.
     PR 46275. [Takashi Sato]
 

Modified: httpd/httpd/trunk/modules/mappers/mod_rewrite.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/mappers/mod_rewrite.c?rev=737973&r1=737972&r2=737973&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/mappers/mod_rewrite.c (original)
+++ httpd/httpd/trunk/modules/mappers/mod_rewrite.c Tue Jan 27 02:12:37 2009
@@ -82,6 +82,9 @@
 #if APR_HAVE_CTYPE_H
 #include <ctype.h>
 #endif
+#if APR_HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
 
 #include "ap_config.h"
 #include "httpd.h"
@@ -1946,6 +1949,18 @@
                 rewritelog((r, 1, ctx->perdir, "RESULT='%s'", result));
                 return (char *)result;
             }
+            else if (!strcmp(var, "IPV6")) {
+                int flag = FALSE;
+#if APR_HAVE_IPV6
+                apr_sockaddr_t *addr = r->connection->remote_addr;
+                flag = (addr->family == AF_INET6 &&
+                        !IN6_IS_ADDR_V4MAPPED((struct in6_addr *)addr->ipaddr_ptr));
+                rewritelog((r, 1, ctx->perdir, "IPV6='%s'", flag ? "on" : "off"));
+#else
+                rewritelog((r, 1, ctx->perdir, "IPV6='off' (IPv6 is not enabled)"));
+#endif
+                result = (flag ? "on" : "off");
+            }
             break;
 
         case  5:



Mime
View raw message