error on deb-diff - was diff whis rebuilded package - change auto gen control

---
Иван Борзенков <ivan1...@list.ru>
diff -Nru libapache2-mod-rpaf-0.5/CHANGES libapache2-mod-rpaf-0.6/CHANGES
--- libapache2-mod-rpaf-0.5/CHANGES	2004-03-17 18:47:30.000000000 +0300
+++ libapache2-mod-rpaf-0.6/CHANGES	2008-01-02 07:03:08.000000000 +0300
@@ -3,3 +3,22 @@
 mod_rpaf was incorrectly using r->pool to allocate memory for the
 ip. The correct pool for this when you are dealing wth keep-alive
 requests was r->connection->pool.
+
+Adding configurable header to work with common Russian setups that
+use X-Real-Ip instead of X-Forwarded-For.
+
+Fixing problems with keep-alive connections reusing the original
+X-Forwarded-For ip as the 'remote_ip'. 
+
+Move the `change_remote_ip' handler from being APR_HOOK_MIDDLE to
+APR_HOOK_FIRST to make the module run before modules like mod_geoip.
+
+Thanks to bug reports from 
+
+Yar Odin
+Michael Cramer
+Sridhar Komandur
+Heddy Boubaker
+Mitar
+Sergey Mokryshev
+Günter Knaf
diff -Nru libapache2-mod-rpaf-0.5/debian/changelog libapache2-mod-rpaf-0.6/debian/changelog
--- libapache2-mod-rpaf-0.5/debian/changelog	2010-06-01 10:46:39.000000000 +0400
+++ libapache2-mod-rpaf-0.6/debian/changelog	2010-06-01 10:46:39.000000000 +0400
@@ -1,3 +1,23 @@
+libapache2-mod-rpaf (0.6-0.2) unstable; urgency=low
+
+  * Non-maintainer upload.
+  * fix version number in last changelog
+  * Bump Standards-Version to 3.8.4
+  * change section from web to httpd
+
+ -- Ivan Borzenkov <ivan1...@list.ru>  Wed, 19 May 2010 15:44:59 +0400
+
+libapache2-mod-rpaf (0.6-0.1) UNRELEASE; urgency=low
+
+  * Non-maintainer upload for new upstream release. Closes: #468460.
+    Added the ability to change which header Apache looks at.
+  * Removed debian/patches/020_keepalive.patch and debian/patches/030_ipv6.patch
+    as it probably fixed in upstream.
+  * Updated 040_multiple_hostnames.patch to patch right source file.
+    Support for multiple hostnames in X-Forwarded-Host header in apache2 version.
+
+ -- Pavel V. Rochnyack <r...@nikolas.ru>  Mon, 02 Nov 2009 13:15:17 +0600
+
 libapache2-mod-rpaf (0.5-3) unstable; urgency=low
 
   * Rename source package name from libapache-mod-rpaf to libapache2-mod-rpaf.
diff -Nru libapache2-mod-rpaf-0.5/debian/conf/rpaf.conf libapache2-mod-rpaf-0.6/debian/conf/rpaf.conf
--- libapache2-mod-rpaf-0.5/debian/conf/rpaf.conf	2010-06-01 10:46:39.000000000 +0400
+++ libapache2-mod-rpaf-0.6/debian/conf/rpaf.conf	2010-06-01 10:46:39.000000000 +0400
@@ -2,4 +2,5 @@
 RPAFenable On
 RPAFsethostname On
 RPAFproxy_ips 127.0.0.1
+RPAFheader X-Forwarded-For
 </IfModule>
diff -Nru libapache2-mod-rpaf-0.5/debian/control libapache2-mod-rpaf-0.6/debian/control
--- libapache2-mod-rpaf-0.5/debian/control	2010-06-01 10:46:39.000000000 +0400
+++ libapache2-mod-rpaf-0.6/debian/control	2010-06-01 10:46:39.000000000 +0400
@@ -1,17 +1,18 @@
 Source: libapache2-mod-rpaf
 Maintainer: Piotr Roszatycki <dex...@debian.org>
-Section: web
+Section: httpd
 Priority: extra
-Standards-Version: 3.7.2
-Build-Depends: apache2-threaded-dev (>= 2.0.50-10), yada (>= 0.54)
+Standards-Version: 3.8.4
+Build-Depends: apache2-threaded-dev (>= 2.0.50-10), yada (>= 0.55)
 Homepage: http://stderr.net/apache/rpaf/
 Vcs-Browser: http://svn.debian.org/wsvn/cvsdebuild/trunk/debian/dists/libapache2-mod-rpaf/
 Vcs-Svn: svn://svn.debian.org/cvsdebuild/trunk/debian/dists/libapache2-mod-rpaf
 
 Package: libapache2-mod-rpaf
 Architecture: any
-Depends: apache2.2-common (>= 2.2.6-2), ${libapache2-mod-rpaf:Depends}
-Description: module for Apache2 which takes the last IP from the 'X-Forwarded-For' header
+Depends: apache2.2-common (>= 2.2.15-5), ${libapache2-mod-rpaf:Depends}
+Description: module for Apache2 which takes the last IP from the
+ 'X-Forwarded-For' header or from other header specified in config.
  rpaf is short for reverse proxy add forward.
  .
  rpaf is for backend Apache servers what mod_proxy_add_forward is for
@@ -22,5 +23,5 @@
  when two conditions are satisfied. First condition is that the remote client
  is actually a proxy that is defined in httpd.conf. Secondly if there is an
  incoming X-Forwarded-For header and the proxy is in its list of known
- proxies it takes the last IP from the incoming X-Forwarded-For header and
+ proxies. It takes the last IP from the incoming X-Forwarded-For header and
  changes the remote address of the client in the request structure.
diff -Nru libapache2-mod-rpaf-0.5/debian/packages libapache2-mod-rpaf-0.6/debian/packages
--- libapache2-mod-rpaf-0.5/debian/packages	2010-06-01 10:46:39.000000000 +0400
+++ libapache2-mod-rpaf-0.6/debian/packages	2010-06-01 10:46:39.000000000 +0400
@@ -10,10 +10,10 @@
 
 
 Source: libapache2-mod-rpaf
-Section: web
+Section: httpd
 Priority: extra
 Maintainer: Piotr Roszatycki <dex...@debian.org>
-Standards-Version: 3.7.2
+Standards-Version: 3.8.4
 Upstream-Source: http://stderr.net/apache/rpaf/download/
 %if %`dpkg --compare-versions %{YADA_VERSION} ge 0.54 && echo 1`
 Homepage: http://stderr.net/apache/rpaf/
@@ -98,7 +98,8 @@
 Package: libapache2-mod-rpaf
 Architecture: any
 Depends: apache2.2-common (>= %{apache2_version}), []
-Description: module for Apache2 which takes the last IP from the 'X-Forwarded-For' header
+Description: module for Apache2 which takes the last IP from the 
+ 'X-Forwarded-For' header or from other header specified in config.
  rpaf is short for reverse proxy add forward.
  .
  rpaf is for backend Apache servers what mod_proxy_add_forward is for
@@ -109,7 +110,7 @@
  when two conditions are satisfied. First condition is that the remote client
  is actually a proxy that is defined in httpd.conf. Secondly if there is an
  incoming X-Forwarded-For header and the proxy is in its list of known
- proxies it takes the last IP from the incoming X-Forwarded-For header and
+ proxies. It takes the last IP from the incoming X-Forwarded-For header and
  changes the remote address of the client in the request structure.
 Install: sh
  APXS2=${APXS2:-apxs2}
diff -Nru libapache2-mod-rpaf-0.5/debian/patches/010_multiple_proxies.patch libapache2-mod-rpaf-0.6/debian/patches/010_multiple_proxies.patch
--- libapache2-mod-rpaf-0.5/debian/patches/010_multiple_proxies.patch	2010-06-01 10:46:39.000000000 +0400
+++ libapache2-mod-rpaf-0.6/debian/patches/010_multiple_proxies.patch	2010-06-01 10:46:39.000000000 +0400
@@ -1,8 +1,8 @@
-diff -ur mod_rpaf-0.5/mod_rpaf-2.0.c libapache-mod-rpaf-0.5/mod_rpaf-2.0.c
---- mod_rpaf-0.5/mod_rpaf-2.0.c	2004-03-17 15:47:30.000000000 +0000
-+++ libapache-mod-rpaf-0.5/mod_rpaf-2.0.c	2006-06-16 18:04:05.000000000 +0100
-@@ -130,6 +130,16 @@
-     return 0;
+diff -u mod_rpaf-0.6/mod_rpaf-2.0.c libapache-mod-rpaf-0.6/mod_rpaf-2.0.c
+--- mod_rpaf-0.6/mod_rpaf-2.0.c	2008-01-01 09:05:40.000000000 +0600
++++ libapache-mod-rpaf-0.6/mod_rpaf-2.0.c	2009-11-02 13:32:55.000000000 +0600
+@@ -152,6 +152,16 @@
+     return APR_SUCCESS;
  }
  
 +static char* last_not_in_array(apr_array_header_t *forwarded_for,
@@ -18,12 +18,12 @@
  static int change_remote_ip(request_rec *r) {
      const char *fwdvalue;
      char *val;
-@@ -147,7 +157,7 @@
-                 if (*fwdvalue != '\0')
-                     ++fwdvalue;
-             }
+@@ -183,7 +193,7 @@
+             rcr->old_ip = apr_pstrdup(r->connection->pool, r->connection->remote_ip);
+             rcr->r = r;
+             apr_pool_cleanup_register(r->pool, (void *)rcr, rpaf_cleanup, apr_pool_cleanup_null);
 -            r->connection->remote_ip = apr_pstrdup(r->connection->pool, ((char **)arr->elts)[((arr->nelts)-1)]);
 +            r->connection->remote_ip = apr_pstrdup(r->connection->pool, last_not_in_array(arr, cfg->proxy_ips));
-             r->connection->remote_addr->sa.sin.sin_addr.s_addr = inet_addr(r->connection->remote_ip);
+             r->connection->remote_addr->sa.sin.sin_addr.s_addr = apr_inet_addr(r->connection->remote_ip);
              if (cfg->sethostname) {
                  const char *hostvalue;
diff -Nru libapache2-mod-rpaf-0.5/debian/patches/020_keepalive.patch libapache2-mod-rpaf-0.6/debian/patches/020_keepalive.patch
--- libapache2-mod-rpaf-0.5/debian/patches/020_keepalive.patch	2010-06-01 10:46:39.000000000 +0400
+++ libapache2-mod-rpaf-0.6/debian/patches/020_keepalive.patch	1970-01-01 03:00:00.000000000 +0300
@@ -1,26 +0,0 @@
-diff -ru mod_rpaf-0.5/mod_rpaf-2.0.c mod_rpaf-0.5.new/mod_rpaf-2.0.c
---- mod_rpaf-0.5/mod_rpaf-2.0.c	2007-10-30 14:32:16.000000000 +0100
-+++ mod_rpaf-0.5.new/mod_rpaf-2.0.c	2007-10-30 14:34:27.000000000 +0100
-@@ -140,6 +140,13 @@
-     return ((char **)forwarded_for->elts)[i];
- }
- 
-+static void rpaf_cleanup(void *data) {
-+    const char *old_ip;
-+    request_rec *r = (request_rec *)data;
-+    if (old_ip = ap_table_get(r->notes, "rpaf_orig_ip"))
-+        r->connection->remote_ip = ap_pstrdup(r->connection->pool, old_ip);
-+}
-+
- static int change_remote_ip(request_rec *r) {
-     const char *fwdvalue;
-     char *val;
-@@ -157,6 +164,8 @@
-                 if (*fwdvalue != '\0')
-                     ++fwdvalue;
-             }
-+            ap_table_set(r->notes, "rpaf_orig_ip", r->connection->remote_ip);
-+            ap_register_cleanup(r->pool, (void *)r, rpaf_cleanup, ap_null_cleanup);
-             r->connection->remote_ip = apr_pstrdup(r->connection->pool, last_not_in_array(arr, cfg->proxy_ips));
-             r->connection->remote_addr->sa.sin.sin_addr.s_addr = inet_addr(r->connection->remote_ip);
-             if (cfg->sethostname) {
diff -Nru libapache2-mod-rpaf-0.5/debian/patches/030_ipv6.patch libapache2-mod-rpaf-0.6/debian/patches/030_ipv6.patch
--- libapache2-mod-rpaf-0.5/debian/patches/030_ipv6.patch	2010-06-01 10:46:39.000000000 +0400
+++ libapache2-mod-rpaf-0.6/debian/patches/030_ipv6.patch	1970-01-01 03:00:00.000000000 +0300
@@ -1,33 +0,0 @@
-diff -ru mod_rpaf-0.5/mod_rpaf-2.0.c mod_rpaf-0.5.new/mod_rpaf-2.0.c
---- mod_rpaf-0.5/mod_rpaf-2.0.c	2007-10-30 14:36:51.000000000 +0100
-+++ mod_rpaf-0.5.new/mod_rpaf-2.0.c	2007-10-30 14:37:47.000000000 +0100
-@@ -72,6 +72,8 @@
- #include "http_vhost.h"
- #include "apr_strings.h"
- 
-+#include <arpa/inet.h>
-+
- module AP_MODULE_DECLARE_DATA rpaf_module;
- 
- typedef struct {
-@@ -150,6 +150,8 @@
- static int change_remote_ip(request_rec *r) {
-     const char *fwdvalue;
-     char *val;
-+    apr_port_t tmpport;
-+    apr_pool_t *tmppool;
-     rpaf_server_cfg *cfg = (rpaf_server_cfg *)ap_get_module_config(r->server->module_config,
-                                                                    &rpaf_module);
- 
-@@ -168,6 +170,11 @@
-             ap_register_cleanup(r->pool, (void *)r, rpaf_cleanup, ap_null_cleanup);
-             r->connection->remote_ip = apr_pstrdup(r->connection->pool, last_not_in_array(arr, cfg->proxy_ips));
-             r->connection->remote_addr->sa.sin.sin_addr.s_addr = inet_addr(r->connection->remote_ip);
-+            tmppool = r->connection->remote_addr->pool;
-+            tmpport = r->connection->remote_addr->port;
-+            memset(r->connection->remote_addr, '\0', sizeof(apr_sockaddr_t));
-+            r->connection->remote_addr = NULL;
-+            apr_sockaddr_info_get(&(r->connection->remote_addr), r->connection->remote_ip, APR_UNSPEC, tmpport, 0, tmppool);
-             if (cfg->sethostname) {
-                 const char *hostvalue;
-                 if (hostvalue = apr_table_get(r->headers_in, "X-Forwarded-Host")) {
diff -Nru libapache2-mod-rpaf-0.5/debian/patches/040_multiple_hostnames.patch libapache2-mod-rpaf-0.6/debian/patches/040_multiple_hostnames.patch
--- libapache2-mod-rpaf-0.5/debian/patches/040_multiple_hostnames.patch	2010-06-01 10:46:39.000000000 +0400
+++ libapache2-mod-rpaf-0.6/debian/patches/040_multiple_hostnames.patch	2010-06-01 10:46:39.000000000 +0400
@@ -1,22 +1,20 @@
---- libapache-mod-rpaf-0.5/mod_rpaf.c  2004-03-17 16:47:30.000000000 +0100
-+++ libapache-mod-rpaf-0.5/mod_rpaf.c.new      2007-03-27 16:16:29.000000000 +0200
-@@ -151,10 +151,16 @@
-             r->connection->remote_addr.sin_addr.s_addr = inet_addr(r->connection->remote_ip);
+--- mod_rpaf-0.6/mod_rpaf-2.0.c	2009-11-02 13:32:55.000000000 +0600
++++ libapache-mod-rpaf-0.6/mod_rpaf-2.0.c	2009-11-02 13:55:18.000000000 +0600
+@@ -198,9 +198,15 @@
              if (cfg->sethostname) {
                  const char *hostvalue;
--                if (hostvalue = ap_table_get(r->headers_in, "X-Forwarded-Host")) {
-+                if (hostvalue = ap_table_get(r->headers_in, "X-Forwarded-Host")) {
-+                    array_header *arr = ap_make_array(r->pool, 0, sizeof(char*));
+                 if (hostvalue = apr_table_get(r->headers_in, "X-Forwarded-Host")) {
++                    apr_array_header_t *arr = apr_array_make(r->pool, 0, sizeof(char*));
 +                    while (*hostvalue && (val = ap_get_token(r->pool, &hostvalue, 1))) {
-+                           *(char **)ap_push_array(arr) = ap_pstrdup(r->pool, val);
++                           *(char **)apr_array_push(arr) = apr_pstrdup(r->pool, val);
 +                           if (*hostvalue != '\0')
 +                                   ++hostvalue;
 +                    }
                      /* 2.0 proxy frontend or 1.3 => 1.3.25 proxy frontend */
--                    ap_table_set(r->headers_in, "Host", ap_pstrdup(r->pool, hostvalue));
--                    r->hostname = ap_pstrdup(r->pool, hostvalue);
-+                    ap_table_set(r->headers_in, "Host", ap_pstrdup(r->pool, ((char **)arr->elts)[((arr->nelts)-1)]));
-+                    r->hostname = ap_pstrdup(r->pool, ((char **)arr->elts)[((arr->nelts)-1)]);
+-                    apr_table_set(r->headers_in, "Host", apr_pstrdup(r->pool, hostvalue));
+-                    r->hostname = apr_pstrdup(r->pool, hostvalue);
++                    apr_table_set(r->headers_in, "Host", apr_pstrdup(r->pool, ((char **)arr->elts)[((arr->nelts)-1)]));
++                    r->hostname = apr_pstrdup(r->pool, ((char **)arr->elts)[((arr->nelts)-1)]);
                      ap_update_vhost_from_headers(r);
-                 } else if (hostvalue = ap_table_get(r->headers_in, "X-Host")) {
+                 } else if (hostvalue = apr_table_get(r->headers_in, "X-Host")) {
                      /* 1.3 proxy frontend with mod_proxy_add_forward */
diff -Nru libapache2-mod-rpaf-0.5/debian/rules libapache2-mod-rpaf-0.6/debian/rules
--- libapache2-mod-rpaf-0.5/debian/rules	2010-06-01 10:46:39.000000000 +0400
+++ libapache2-mod-rpaf-0.6/debian/rules	2010-06-01 10:46:39.000000000 +0400
@@ -1,6 +1,6 @@
 #!/usr/bin/make -f
 # Generated automatically from debian/packages
-# by yada v0.54, of Sun, 28 Oct 2007
+# by yada v0.55, of Tue, 15 Dec 2009
 
 DEB_HOST_ARCH        := $(shell dpkg-architecture -qDEB_HOST_ARCH 2>/dev/null)
 DEB_HOST_ARCH_OS     := $(shell dpkg-architecture -qDEB_HOST_ARCH_OS 2>/dev/null)
diff -Nru libapache2-mod-rpaf-0.5/gen_tests.sh libapache2-mod-rpaf-0.6/gen_tests.sh
--- libapache2-mod-rpaf-0.5/gen_tests.sh	1970-01-01 03:00:00.000000000 +0300
+++ libapache2-mod-rpaf-0.6/gen_tests.sh	2007-12-13 06:40:22.000000000 +0300
@@ -0,0 +1,26 @@
+#!/bin/sh
+PATH=$PATH:/home/thomas/build/apache-dev/bin
+DIRECTORY=`pwd`/t
+HTTPD=`which httpd`
+HTTPD2=`which apache2`
+
+cat test-Makefile-template | sed -s "s|\...@\@htt...@\@|$HTTPD|" | sed -s "s|\...@\@http...@\@|$HTTPD2|" > t/Makefile
+
+
+if [ "$HTTPD" != "" ]; then
+  echo "Found httpd as $HTTPD"
+  echo "Creating test configuration for apache 1.3.x"
+  echo "in directory $DIRECTORY"
+  cat httpd-rpaf.conf-template | sed -s "s|\...@\@d...@\@|$DIRECTORY|" > t/httpd-rpaf.conf
+fi
+
+APACHE2=`which apache2`
+
+if [ "$APACHE2" != "" ]; then
+  echo "Found apache2 as $HTTPD"
+  echo "Creating test configuration for apache 2.x.x"
+  echo "in directory $DIRECTORY"
+  cat httpd-rpaf.conf-template-2.0 | sed -s "s|\...@\@d...@\@|$DIRECTORY|" > t/httpd-rpaf.conf-2.0
+fi
+
+
diff -Nru libapache2-mod-rpaf-0.5/httpd-rpaf.conf-template libapache2-mod-rpaf-0.6/httpd-rpaf.conf-template
--- libapache2-mod-rpaf-0.5/httpd-rpaf.conf-template	1970-01-01 03:00:00.000000000 +0300
+++ libapache2-mod-rpaf-0.6/httpd-rpaf.conf-template	2008-01-01 06:03:15.000000000 +0300
@@ -0,0 +1,54 @@
+ServerType standalone
+PidFile httpd.pid
+Port 2500
+ServerName 127.0.0.1
+#ServerRoot @@DIR@@
+DocumentRoot @@DIR@@/htdocs/
+ErrorLog rpaf-error_log
+LoadModule rpaf_module ../mod_rpaf.so
+ScriptAlias /cgi-bin @@DIR@@/htdocs/cgi-bin
+TypesConfig /dev/null
+<IfDefine test1>
+  RPAFenable Off
+</IfDefine>
+<IfDefine test2>
+  RPAFenable On
+  RPAFsethostname Off
+  RPAFproxy_ips 127.0.0.1
+</IfDefine>
+<IfDefine test3>
+  RPAFenable On
+  RPAFsethostname On
+  RPAFproxy_ips 127.0.0.1
+</IfDefine>
+<IfDefine test4>
+  RPAFenable On
+  RPAFsethostname On
+  RPAFproxy_ips 127.0.0.1
+  RPAFheader X-Forwarded-For
+</IfDefine>
+<IfDefine test5>
+  RPAFenable On
+  RPAFsethostname On
+  RPAFproxy_ips 127.0.0.1
+  RPAFheader X-Real-IP
+</IfDefine>
+<IfDefine test6>
+  RPAFenable On
+  RPAFsethostname On
+  RPAFproxy_ips 127.0.0.1
+  KeepAlive On
+  KeepAlivetimeout 15
+  LogFormat "%h" rpaf
+  CustomLog rpaf-access_log rpaf
+</IfDefine>
+<IfDefine test7>
+  RPAFenable On
+  RPAFsethostname On
+  RPAFproxy_ips 127.0.0.1
+  KeepAlive On
+  KeepAlivetimeout 15
+  LogFormat "%h" rpaf
+  CustomLog rpaf-access_log rpaf
+  HostNameLookups On
+</IfDefine>
diff -Nru libapache2-mod-rpaf-0.5/httpd-rpaf.conf-template-2.0 libapache2-mod-rpaf-0.6/httpd-rpaf.conf-template-2.0
--- libapache2-mod-rpaf-0.5/httpd-rpaf.conf-template-2.0	1970-01-01 03:00:00.000000000 +0300
+++ libapache2-mod-rpaf-0.6/httpd-rpaf.conf-template-2.0	2008-01-01 06:03:15.000000000 +0300
@@ -0,0 +1,54 @@
+PidFile httpd.pid
+Listen 2500
+ServerName 127.0.0.1
+#ServerRoot @@DIR@@
+DocumentRoot @@DIR@@/htdocs/
+ErrorLog rpaf-error_log
+LoadModule rpaf_module @@DIR@@/../.libs/mod_rpaf-2.0.so
+LoadModule cgi_module /usr/lib/apache2/modules/mod_cgi.so
+LoadModule alias_module /usr/lib/apache2/modules/mod_alias.so
+ScriptAlias /cgi-bin @@DIR@@/htdocs/cgi-bin
+<IfDefine test1>
+  RPAFenable Off
+</IfDefine>
+<IfDefine test2>
+  RPAFenable On
+  RPAFsethostname Off
+  RPAFproxy_ips 127.0.0.1
+</IfDefine>
+<IfDefine test3>
+  RPAFenable On
+  RPAFsethostname On
+  RPAFproxy_ips 127.0.0.1
+</IfDefine>
+<IfDefine test4>
+  RPAFenable On
+  RPAFsethostname On
+  RPAFproxy_ips 127.0.0.1
+  RPAFheader X-Forwarded-For
+</IfDefine>
+<IfDefine test5>
+  RPAFenable On
+  RPAFsethostname On
+  RPAFproxy_ips 127.0.0.1
+  RPAFheader X-Real-IP
+</IfDefine>
+<IfDefine test6>
+  RPAFenable On
+  RPAFsethostname On
+  RPAFproxy_ips 127.0.0.1
+  KeepAlive On
+  KeepAliveTimeout 15
+  LogFormat "%h" rpaf
+  CustomLog rpaf-access_log rpaf
+</IfDefine>
+<IfDefine test7>
+  RPAFenable On
+  RPAFsethostname On
+  RPAFproxy_ips 127.0.0.1
+  KeepAlive On
+  KeepAliveTimeout 15
+  LogFormat "%h" rpaf
+  CustomLog rpaf-access_log rpaf
+  HostNameLookups On
+</IfDefine>
diff -Nru libapache2-mod-rpaf-0.5/Makefile libapache2-mod-rpaf-0.6/Makefile
--- libapache2-mod-rpaf-0.5/Makefile	2004-03-17 18:47:30.000000000 +0300
+++ libapache2-mod-rpaf-0.6/Makefile	2007-12-13 06:40:22.000000000 +0300
@@ -1,8 +1,7 @@
 # Makefile for mod_rpaf.c (gmake)
-# $Id: Makefile,v 1.4 2002/06/18 15:05:07 thomas Exp $
-#APXS=$(shell which apxs) 
-APXS=/home/thomas/build/apache-dev/bin/apxs
-#APXS=/pat/to/your/apxs
+# $Id: Makefile 16 2007-12-13 03:40:22Z thomas $
+APXS=$(shell which apxs) 
+APXS2=$(shell which apxs2)
 
 default:
 	@echo mod_rpaf:
@@ -10,26 +9,39 @@
 	@echo
 	@echo following options available:
 	@echo \"make rpaf\" to compile the 1.3 version
+	@echo \"make test\" to test 1.3 version
 	@echo \"make install\" to install the 1.3 version
 	@echo \"make rpaf-2.0\" to compile the 2.0 version
+	@echo \"make test-2.0\" to test 2.0 version
 	@echo \"make install-2.0\" to install the 2.0 version
 	@echo
 	@echo change path to apxs if this is not it: \"$(APXS)\"
 
 
 rpaf: mod_rpaf.so
-	@echo make done, type \"make install\" to install mod_rpaf
+	@echo make done
+	@echo type \"make test\" to test mod_rpaf
+	@echo type \"make install\" to install mod_rpaf
+
+test: rpaf
+	@./gen_tests.sh
+	cd t && $(MAKE) test
+	@echo all done
 
 rpaf-2.0: mod_rpaf-2.0.o
 	@echo make done, type \"make install-2.0\" to install mod_rpaf-2.0
 
+test-2.0: rpaf-2.0
+	@./gen_tests.sh
+	cd t && make test-2.0
+
 mod_rpaf.so: mod_rpaf.c
 	$(APXS) -c -o $@ mod_rpaf.c
 
 mod_rpaf.c:
 
 mod_rpaf-2.0.o: mod_rpaf-2.0.c
-	$(APXS) -c -n $@ mod_rpaf-2.0.c
+	$(APXS2) -c -n $@ mod_rpaf-2.0.c
 
 mod_rpaf-2.0.c:
 
@@ -37,7 +49,8 @@
 	$(APXS) -i -n mod_rpaf mod_rpaf.so
 
 install-2.0: mod_rpaf-2.0.o
-	$(APXS) -i -n mod_rpaf-2.0.so mod_rpaf-2.0.la
+	$(APXS2) -i -n mod_rpaf-2.0.so mod_rpaf-2.0.la
 
 clean:
-	rm -rf *~ *.o *.so *.lo *.la *.slo .libs/
+	rm -rf *~ *.o *.so *.lo *.la *.slo *.loT .libs/ 
+	cd t && make clean
diff -Nru libapache2-mod-rpaf-0.5/mod_rpaf-2.0.c libapache2-mod-rpaf-0.6/mod_rpaf-2.0.c
--- libapache2-mod-rpaf-0.5/mod_rpaf-2.0.c	2004-03-17 18:47:30.000000000 +0300
+++ libapache2-mod-rpaf-0.6/mod_rpaf-2.0.c	2008-01-01 06:05:40.000000000 +0300
@@ -52,7 +52,7 @@
  */
 
 /*
- * $Id: mod_rpaf-2.0.c,v 1.1 2002/06/08 19:25:06 thomas Exp $
+ * $Id: mod_rpaf-2.0.c 18 2008-01-01 03:05:40Z thomas $
  *
  * Author: Thomas Eibner, <tho...@stderr.net>
  * URL: http://stderr.net/apache/rpaf/
@@ -75,11 +75,17 @@
 module AP_MODULE_DECLARE_DATA rpaf_module;
 
 typedef struct {
-    int enable;
-    int sethostname;
+    int                enable;
+    int                sethostname;
+    const char         *headername;
     apr_array_header_t *proxy_ips;
 } rpaf_server_cfg;
 
+typedef struct {
+    const char  *old_ip;
+    request_rec *r;
+} rpaf_cleanup_rec;
+
 static void *rpaf_create_server_cfg(apr_pool_t *p, server_rec *s) {
     rpaf_server_cfg *cfg = (rpaf_server_cfg *)apr_pcalloc(p, sizeof(rpaf_server_cfg));
     if (!cfg)
@@ -92,7 +98,7 @@
     return (void *)cfg;
 }
 
-static const char *rpaf_set_proxy_ip(cmd_parms *cmd, void *dummy, char *proxy_ip) {
+static const char *rpaf_set_proxy_ip(cmd_parms *cmd, void *dummy, const char *proxy_ip) {
     server_rec *s = cmd->server;
     rpaf_server_cfg *cfg = (rpaf_server_cfg *)ap_get_module_config(s->module_config, 
                                                                    &rpaf_module);
@@ -102,6 +108,15 @@
     return NULL;
 }
 
+static const char *rpaf_set_headername(cmd_parms *cmd, void *dummy, const char *headername) {
+    server_rec *s = cmd->server;
+    rpaf_server_cfg *cfg = (rpaf_server_cfg *)ap_get_module_config(s->module_config, 
+                                                                   &rpaf_module);
+
+    cfg->headername = headername; 
+    return NULL;
+}
+
 static const char *rpaf_enable(cmd_parms *cmd, void *dummy, int flag) {
     server_rec *s = cmd->server;
     rpaf_server_cfg *cfg = (rpaf_server_cfg *)ap_get_module_config(s->module_config, 
@@ -130,6 +145,13 @@
     return 0;
 }
 
+static apr_status_t rpaf_cleanup(void *data) {
+    rpaf_cleanup_rec *rcr = (rpaf_cleanup_rec *)data;
+    rcr->r->connection->remote_ip   = apr_pstrdup(rcr->r->connection->pool, rcr->old_ip);
+    rcr->r->connection->remote_addr->sa.sin.sin_addr.s_addr = apr_inet_addr(rcr->r->connection->remote_ip);
+    return APR_SUCCESS;
+}
+
 static int change_remote_ip(request_rec *r) {
     const char *fwdvalue;
     char *val;
@@ -140,15 +162,29 @@
         return DECLINED;
 
     if (is_in_array(r->connection->remote_ip, cfg->proxy_ips) == 1) {
-        if (fwdvalue = apr_table_get(r->headers_in, "X-Forwarded-For")) {
+        /* check if cfg->headername is set and if it is use
+           that instead of X-Forwarded-For by default */
+        if (cfg->headername && (fwdvalue = apr_table_get(r->headers_in, cfg->headername))) {
+            //
+        } else if (fwdvalue = apr_table_get(r->headers_in, "X-Forwarded-For")) {
+            //
+        } else {
+            return DECLINED;
+        }
+
+        if (fwdvalue) {
+            rpaf_cleanup_rec *rcr = (rpaf_cleanup_rec *)apr_pcalloc(r->pool, sizeof(rpaf_cleanup_rec));
             apr_array_header_t *arr = apr_array_make(r->pool, 0, sizeof(char*));
             while (*fwdvalue && (val = ap_get_token(r->pool, &fwdvalue, 1))) {
                 *(char **)apr_array_push(arr) = apr_pstrdup(r->pool, val);
                 if (*fwdvalue != '\0')
                     ++fwdvalue;
             }
+            rcr->old_ip = apr_pstrdup(r->connection->pool, r->connection->remote_ip);
+            rcr->r = r;
+            apr_pool_cleanup_register(r->pool, (void *)rcr, rpaf_cleanup, apr_pool_cleanup_null);
             r->connection->remote_ip = apr_pstrdup(r->connection->pool, ((char **)arr->elts)[((arr->nelts)-1)]);
-            r->connection->remote_addr->sa.sin.sin_addr.s_addr = inet_addr(r->connection->remote_ip);
+            r->connection->remote_addr->sa.sin.sin_addr.s_addr = apr_inet_addr(r->connection->remote_ip);
             if (cfg->sethostname) {
                 const char *hostvalue;
                 if (hostvalue = apr_table_get(r->headers_in, "X-Forwarded-Host")) {
@@ -191,11 +227,18 @@
                     RSRC_CONF,
                     "IP(s) of Proxy server setting X-Forwarded-For header"
                     ),
+    AP_INIT_TAKE1(
+                    "RPAFheader",
+                    rpaf_set_headername,
+                    NULL,
+                    RSRC_CONF,
+                    "Which header to look for when trying to find the real ip of the client in a proxy setup"
+                    ),
     { NULL }
 };
 
 static void register_hooks(apr_pool_t *p) {
-    ap_hook_post_read_request(change_remote_ip, NULL, NULL, APR_HOOK_MIDDLE);
+    ap_hook_post_read_request(change_remote_ip, NULL, NULL, APR_HOOK_FIRST);
 }
 
 module AP_MODULE_DECLARE_DATA rpaf_module = {
diff -Nru libapache2-mod-rpaf-0.5/mod_rpaf.c libapache2-mod-rpaf-0.6/mod_rpaf.c
--- libapache2-mod-rpaf-0.5/mod_rpaf.c	2004-03-17 18:47:30.000000000 +0300
+++ libapache2-mod-rpaf-0.6/mod_rpaf.c	2008-01-01 06:03:15.000000000 +0300
@@ -52,7 +52,7 @@
  */
 
 /*
- * $Id: mod_rpaf.c,v 1.6 2002/06/08 19:24:29 thomas Exp $
+ * $Id: mod_rpaf.c 17 2008-01-01 03:03:15Z thomas $
  *
  * Author: Thomas Eibner, <tho...@stderr.net>
  * URL: http://stderr.net/apache/rpaf/
@@ -74,11 +74,17 @@
 module MODULE_VAR_EXPORT rpaf_module;
 
 typedef struct {
-    int enable;
-    int sethostname;
+    int          enable;
+    int          sethostname;
+    const char   *headername;
     array_header *proxy_ips;
 } rpaf_server_cfg;
 
+typedef struct {
+    const char  *old_ip;
+    request_rec *r;
+} rpaf_cleanup_rec;
+
 static void *rpaf_create_server_cfg(pool *p, server_rec *s) {
     rpaf_server_cfg *cfg = (rpaf_server_cfg *)ap_pcalloc(p, sizeof(rpaf_server_cfg));
     if (!cfg)
@@ -102,11 +108,20 @@
     return NULL;
 }
 
-static const char *rpaf_enable(cmd_parms *cmd, void *dummy, int flag) {
+static const char *rpaf_set_headername(cmd_parms *cmd, void *dummy, char *headername) {
     server_rec *s = cmd->server;
     rpaf_server_cfg *cfg = (rpaf_server_cfg *)ap_get_module_config(s->module_config, 
                                                                    &rpaf_module);
 
+    cfg->headername = headername; 
+    return NULL;
+}
+
+static const char *rpaf_enable(cmd_parms *cmd, void *dummy, int flag) {
+   server_rec *s = cmd->server;
+    rpaf_server_cfg *cfg = (rpaf_server_cfg *)ap_get_module_config(s->module_config, 
+                                                                   &rpaf_module);
+
     cfg->enable = flag;
     return NULL;
 }
@@ -130,6 +145,12 @@
     return 0;
 }
 
+static void rpaf_cleanup(void *data) {
+    rpaf_cleanup_rec *rcr = (rpaf_cleanup_rec *)data;
+    rcr->r->connection->remote_ip   = ap_pstrdup(rcr->r->connection->pool, rcr->old_ip);
+    rcr->r->connection->remote_addr.sin_addr.s_addr = inet_addr(rcr->r->connection->remote_ip);
+}
+
 static int change_remote_ip(request_rec *r) {
     const char *fwdvalue;
     char *val;
@@ -140,13 +161,27 @@
         return DECLINED;
 
     if (is_in_array(r->connection->remote_ip, cfg->proxy_ips) == 1) {
-        if (fwdvalue = ap_table_get(r->headers_in, "X-Forwarded-For")) {
+        /* check if cfg->headername is set and if it is use 
+           that instead of X-Forwarded-For by default */
+        if (cfg->headername && (fwdvalue = ap_table_get(r->headers_in, cfg->headername))) {
+            //
+        } else if (fwdvalue = ap_table_get(r->headers_in, "X-Forwarded-For")) {
+            //
+        } else { 
+            return DECLINED;
+        }
+
+        if (fwdvalue) {
+            rpaf_cleanup_rec *rcr = (rpaf_cleanup_rec *)ap_pcalloc(r->pool, sizeof(rpaf_cleanup_rec));
             array_header *arr = ap_make_array(r->pool, 0, sizeof(char*));
             while (*fwdvalue && (val = ap_get_token(r->pool, &fwdvalue, 1))) {
                 *(char **)ap_push_array(arr) = ap_pstrdup(r->pool, val);
                 if (*fwdvalue != '\0')
                     ++fwdvalue;
             }
+            rcr->old_ip = ap_pstrdup(r->connection->pool, r->connection->remote_ip);
+            rcr->r = r;
+            ap_register_cleanup(r->pool, (void *)rcr, rpaf_cleanup, ap_null_cleanup);
             r->connection->remote_ip = ap_pstrdup(r->connection->pool, ((char **)arr->elts)[((arr->nelts)-1)]);
             r->connection->remote_addr.sin_addr.s_addr = inet_addr(r->connection->remote_ip);
             if (cfg->sethostname) {
@@ -163,7 +198,6 @@
                     ap_update_vhost_from_headers(r);
                 }
             }
-
         }
     }
     return DECLINED;
@@ -176,6 +210,8 @@
       RSRC_CONF, FLAG, "Let mod_rpaf set the hostname from the X-Host header and update vhosts" },
     { "RPAFproxy_ips", rpaf_set_proxy_ip, NULL,
       RSRC_CONF, ITERATE, "IP(s) of Proxy server setting X-Forwarded-For header" },
+    { "RPAFheader", rpaf_set_headername, NULL,
+      RSRC_CONF, TAKE1, "Which header to look for when trying to find the real ip of the client in a proxy setup" },
     { NULL }
 };
 
diff -Nru libapache2-mod-rpaf-0.5/README libapache2-mod-rpaf-0.6/README
--- libapache2-mod-rpaf-0.5/README	2004-03-17 18:47:30.000000000 +0300
+++ libapache2-mod-rpaf-0.6/README	2007-11-26 05:01:59.000000000 +0300
@@ -23,6 +23,10 @@
 # let rpaf update vhost settings 
 # allows to have the same hostnames as in the "real"
 # configuration for the forwarding Apache
+RPAFheader X-Forwarded-For
+# Allows you to change which header mod_rpaf looks
+# for when trying to find the ip the that is forwarding
+# our requests
 
 Author:
 Thomas Eibner <tho...@stderr.net>
diff -Nru libapache2-mod-rpaf-0.5/t/htdocs/cgi-bin/env.cgi libapache2-mod-rpaf-0.6/t/htdocs/cgi-bin/env.cgi
--- libapache2-mod-rpaf-0.5/t/htdocs/cgi-bin/env.cgi	1970-01-01 03:00:00.000000000 +0300
+++ libapache2-mod-rpaf-0.6/t/htdocs/cgi-bin/env.cgi	2007-11-26 03:19:53.000000000 +0300
@@ -0,0 +1,11 @@
+#!/usr/bin/perl
+# $Id: env.cgi 13 2007-11-26 00:19:53Z thomas $
+print qq{Content-Type: text/plain\r\n\r\n};
+print qq{HTTP_X_FORWARDED_FOR = } . (defined($ENV{HTTP_X_FORWARDED_FOR}) ? $ENV{HTTP_X_FORWARDED_FOR} : '');
+print qq{\n};
+print qq{REMOTE_ADDR = } . (defined($ENV{REMOTE_ADDR}) ? $ENV{REMOTE_ADDR} : '');
+print qq{\n};
+print qq{HTTP_HOST = } . (defined($ENV{HTTP_HOST}) ? $ENV{HTTP_HOST} : '');
+print qq{\n};
+print qq{HTTP_X_REAL_IP = } . (defined($ENV{HTTP_X_REAL_IP}) ? $ENV{HTTP_X_REAL_IP} : '');
+print qq{\n};
diff -Nru libapache2-mod-rpaf-0.5/t/htdocs/index.html libapache2-mod-rpaf-0.6/t/htdocs/index.html
--- libapache2-mod-rpaf-0.5/t/htdocs/index.html	1970-01-01 03:00:00.000000000 +0300
+++ libapache2-mod-rpaf-0.6/t/htdocs/index.html	2008-01-01 06:03:15.000000000 +0300
@@ -0,0 +1,3 @@
+<html>
+test
+</html>
diff -Nru libapache2-mod-rpaf-0.5/t/run_apache.sh libapache2-mod-rpaf-0.6/t/run_apache.sh
--- libapache2-mod-rpaf-0.5/t/run_apache.sh	1970-01-01 03:00:00.000000000 +0300
+++ libapache2-mod-rpaf-0.6/t/run_apache.sh	2007-11-25 21:12:43.000000000 +0300
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+~/build/apache-dev/bin/httpd -d . -f `pwd`/httpd-rpaf.conf -X 
diff -Nru libapache2-mod-rpaf-0.5/t/run_test.pl libapache2-mod-rpaf-0.6/t/run_test.pl
--- libapache2-mod-rpaf-0.5/t/run_test.pl	1970-01-01 03:00:00.000000000 +0300
+++ libapache2-mod-rpaf-0.6/t/run_test.pl	2008-01-01 06:03:15.000000000 +0300
@@ -0,0 +1,151 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+use Data::Dumper;
+use LWP::UserAgent;
+use HTTP::Request;
+
+my $localhost_ip    = '127.0.0.1';
+my $forward_ip      = '140.211.11.130';
+my $x_forwarded_for = "$localhost_ip; $forward_ip";
+my $http_host       = "$localhost_ip:2500";
+my $x_host          = 'www.apache.org';
+
+my $test = shift || die("Missing a testcase");
+my $ua;
+if ($test ne 'test6') {
+    $ua = LWP::UserAgent->new();
+} else {
+    $ua = LWP::UserAgent->new(keep_alive => 1);
+}
+my $request = HTTP::Request->new(GET => 'http://127.0.0.1:2500/cgi-bin/env.cgi');
+
+run_test1() if $test eq 'test1';
+run_test2() if $test eq 'test2';
+run_test3() if $test eq 'test3';
+run_test4() if $test eq 'test4';
+run_test5() if $test eq 'test5';
+run_test6() if $test eq 'test6';
+run_test6() if $test eq 'test7';
+
+sub run_test1 {
+    # two tests - one without X-Forwarded-For and one with 
+
+    execute_test($request, { REMOTE_ADDR => $localhost_ip, HTTP_HOST => $http_host, HTTP_X_FORWARDED_FOR => ''});
+    
+    $request->header('X-Forwarded-For' => $x_forwarded_for);
+    execute_test($request, { REMOTE_ADDR => $localhost_ip, HTTP_HOST => $http_host, HTTP_X_FORWARDED_FOR => $x_forwarded_for});
+}
+
+sub run_test2 {
+    # three tests - one without X-Forwarded-For; one with; and one with X-Host
+
+    execute_test($request, { REMOTE_ADDR => $localhost_ip, HTTP_HOST => $http_host, HTTP_X_FORWARDED_FOR => ''});
+    
+    $request->header('X-Forwarded-For' => $x_forwarded_for);
+    execute_test($request, { REMOTE_ADDR => $forward_ip, HTTP_HOST => $http_host, HTTP_X_FORWARDED_FOR => $x_forwarded_for});
+
+    $request->header('X-Host' => $x_host);
+    execute_test($request, { REMOTE_ADDR => $forward_ip, HTTP_HOST => $http_host, HTTP_X_FORWARDED_FOR => $x_forwarded_for});
+}
+
+sub run_test3 {
+    # three tests one without X-Host; one with; and one with X-Forwarded-Host
+    
+    $request->header('X-Forwarded-For' => $x_forwarded_for);
+    execute_test($request, { REMOTE_ADDR => $forward_ip, HTTP_HOST => $http_host, HTTP_X_FORWARDED_FOR => $x_forwarded_for});
+
+    $request->header('X-Host' => $x_host);
+    execute_test($request, { REMOTE_ADDR => $forward_ip, HTTP_HOST => $x_host, HTTP_X_FORWARDED_FOR => $x_forwarded_for});
+
+    $request->remove_header('X-Host');
+    $request->header('X-Forwarded-Host' => $x_host);
+    execute_test($request, { REMOTE_ADDR => $forward_ip, HTTP_HOST => $x_host, HTTP_X_FORWARDED_FOR => $x_forwarded_for});
+}
+
+sub run_test4 {
+    # three tests one without X-Host; one with; and one with X-Forwarded-Host
+    
+    $request->header('X-Forwarded-For' => $x_forwarded_for);
+    execute_test($request, { REMOTE_ADDR => $forward_ip, HTTP_HOST => $http_host, HTTP_X_FORWARDED_FOR => $x_forwarded_for});
+
+    $request->header('X-Host' => $x_host);
+    execute_test($request, { REMOTE_ADDR => $forward_ip, HTTP_HOST => $x_host, HTTP_X_FORWARDED_FOR => $x_forwarded_for});
+
+    $request->remove_header('X-Host');
+    $request->header('X-Forwarded-Host' => $x_host);
+    execute_test($request, { REMOTE_ADDR => $forward_ip, HTTP_HOST => $x_host, HTTP_X_FORWARDED_FOR => $x_forwarded_for});
+}
+
+sub run_test5 {
+    # two tests with X-Real-IP; one without X-Host; one with
+    $request->remove_header('X-Forwarded-For');
+    $request->header('X-Real-IP' => $x_forwarded_for);
+    execute_test($request, { REMOTE_ADDR => $forward_ip, HTTP_HOST => $http_host, HTTP_X_REAL_IP => $x_forwarded_for});
+
+    $request->header('X-Host' => $x_host);
+    execute_test($request, { REMOTE_ADDR => $forward_ip, HTTP_HOST => $x_host, HTTP_X_REAL_IP => $x_forwarded_for});
+
+}
+
+sub run_test6 {
+    # attempt to test keep-alive
+    print "Testing Keep-Alive\n";
+    my $static_request = HTTP::Request->new(GET => 'http://127.0.0.1:2500/index.html');
+    print "First using X-F-F: $x_forwarded_for\n";
+    $static_request->header('X-Forwarded-For' => $x_forwarded_for);
+    my $response = $ua->request($static_request);
+    if ($response->is_success()) {
+	
+    } else {
+	print "Something went wrong in requesting file..";
+    }
+    my $reverse_xff = "$localhost_ip; " . (join ".", reverse split /\./, $forward_ip);
+    print "Then using X-F-F: $reverse_xff\n";
+    $static_request->header('X-Forwarded-For' => $reverse_xff);
+    $response = $ua->request($static_request);
+    if ($response->is_success()) {
+	
+    } else {
+	print "Something went wrong in requesting file..";
+    }
+    print "Now requesting without X-F-F\n";
+    $static_request->remove_header('X-Forwarded-For');
+    $response = $ua->request($static_request);
+    if ($response->is_success()) {
+	
+    } else {
+	print "Something went wrong in requesting file..";
+    }
+    print "Done\n";
+}
+
+
+sub execute_test {
+    my $request = shift;
+    my $expected = shift;
+
+    my $response = $ua->request($request);
+    if ($response->is_success()) {
+	my $returned = {};
+	my $content = $response->content();
+	my @rows = split /\n/, $content;
+	foreach my $row (@rows) {
+	    my ($key,$value) = split / \= /, $row;
+	    $returned->{$key} = $value;
+	}
+	# compare with $expected
+	foreach my $key (sort keys %$expected) {
+	    print qq{Expected $key "$expected->{$key}" };
+	    print qq{Response "$returned->{$key}" } if defined($returned->{$key});
+	    my $status = (defined($returned->{$key}) && $returned->{$key} eq $expected->{$key} ? 'OK' : 'NOT OK' );
+	    print qq{$status\n};
+	    die(Dumper($response)) if $status ne 'OK';
+	}
+	# Everything looks like it worked
+	print qq{*** Test passed ***\n};
+    } else {
+	die($response);
+    }
+}
diff -Nru libapache2-mod-rpaf-0.5/test-Makefile-template libapache2-mod-rpaf-0.6/test-Makefile-template
--- libapache2-mod-rpaf-0.5/test-Makefile-template	1970-01-01 03:00:00.000000000 +0300
+++ libapache2-mod-rpaf-0.6/test-Makefile-template	2008-01-02 05:55:18.000000000 +0300
@@ -0,0 +1,121 @@
+# Makefile for mod_rpaf.c tests (gmake)
+# $Id: test-Makefile-template 19 2008-01-02 02:55:18Z thomas $
+HTTPD=@@HTTPD@@ -d . -f httpd-rpaf.conf -X
+HTTPD2=@@HTTPD2@@ -d . -f httpd-rpaf.conf-2.0 -X
+
+default:
+	@echo please run make test or make test-2.0 
+	@echo from the root directory of your rpaf sources
+
+test:
+	rm -f rpaf-error_log rpaf_access_log
+	@echo running rpaf apache 1.3.x tests
+	@echo test 1 - no rpaf
+	@echo starting apache ..
+	@$(HTTPD) -D test1 &
+	@./run_test.pl test1
+	@echo stopping apache ..
+	@kill -HUP `cat httpd.pid`
+	@rm httpd.pid
+	@echo test 2 - rpaf enabled
+	@echo starting apache ..
+	@$(HTTPD) -D test2 &
+	@./run_test.pl test2
+	@echo stopping apache ..
+	@kill -HUP `cat httpd.pid`
+	@rm httpd.pid
+	@echo test 3 - rpaf enabled - sethostname enabled
+	@echo starting apache ..
+	@$(HTTPD) -D test3 &
+	@./run_test.pl test3
+	@echo stopping apache ..
+	@kill -HUP `cat httpd.pid`
+	@rm httpd.pid
+	@echo test 4 - rpaf enabled - sethostname enabled - specifying header
+	@echo setting X-Forwarded-For
+	@echo starting apache ..
+	@$(HTTPD) -D test4 &
+	@./run_test.pl test4
+	@echo stopping apache ..
+	@kill -HUP `cat httpd.pid`
+	@rm httpd.pid
+	@echo test 5 - rpaf enabled - sethostname enabled - specifying header
+	@echo setting X-Real-IP
+	@echo starting apache ..
+	@$(HTTPD) -D test5 &
+	@./run_test.pl test5
+	@echo stopping apache ..
+	@kill -HUP `cat httpd.pid`
+	@rm httpd.pid
+	@echo test 6 - X-Forwarded-For Keep-Alive test
+	@echo starting apache ..
+	@$(HTTPD) -D test6 &
+	@./run_test.pl test6
+	@echo stopping apache ..
+	@kill -HUP `cat httpd.pid`
+	@rm httpd.pid
+	@echo test 7 - X-Forwarded-For Keep-Alive test with HostNameLookups On
+	@echo starting apache ..
+	@$(HTTPD) -D test7 &
+	@./run_test.pl test7
+	@echo stopping apache ..
+	@kill -HUP `cat httpd.pid`
+	@rm httpd.pid
+
+test-2.0:
+	rm -f rpaf-error_log rpaf-access_log
+	@echo running rpaf apache 2.x.x tests
+	@echo test 1 - no rpaf
+	@echo starting apache ..
+	@$(HTTPD2) -D test1 &
+	@./run_test.pl test1
+	@echo stopping apache ..
+	@kill -9 `cat httpd.pid`
+	@rm httpd.pid
+	@echo test 2 - rpaf enabled
+	@echo starting apache ..
+	@$(HTTPD2) -D test2 &
+	@./run_test.pl test2
+	@echo stopping apache ..
+	@kill -9 `cat httpd.pid`
+	@rm httpd.pid
+	@echo test 3 - rpaf enabled - sethostname enabled
+	@echo starting apache ..
+	@$(HTTPD2) -D test3 &
+	@./run_test.pl test3
+	@echo stopping apache ..
+	@kill -9 `cat httpd.pid`
+	@rm httpd.pid
+	@echo test 4 - rpaf enabled - sethostname enabled - specifying header
+	@echo setting X-Forwarded-For
+	@echo starting apache ..
+	@$(HTTPD2) -D test4 &
+	@./run_test.pl test4
+	@echo stopping apache ..
+	@kill -9 `cat httpd.pid`
+	@rm httpd.pid
+	@echo test 5 - rpaf enabled - sethostname enabled - specifying header
+	@echo setting X-Real-IP
+	@echo starting apache ..
+	@$(HTTPD2) -D test5 &
+	@./run_test.pl test5
+	@echo stopping apache ..
+	@kill -9 `cat httpd.pid`
+	@rm httpd.pid
+	@echo test 6 - X-Forwarded-For Keep-Alive test
+	@echo starting apache ..
+	@$(HTTPD2) -D test6 &
+	@./run_test.pl test6
+	@echo stopping apache ..
+	@kill -9 `cat httpd.pid`
+	@rm httpd.pid
+	@echo test 7 - X-Forwarded-For Keep-Alive test with HostNameLookups On
+	@echo starting apache ..
+	@$(HTTPD2) -D test7 &
+	@./run_test.pl test7
+	@echo stopping apache ..
+	@kill -9 `cat httpd.pid`
+	@rm httpd.pid
+
+clean:
+	rm -rf httpd.pid rpaf-access_log rpaf-error_log httpd-rpaf.conf httpd-rpaf.conf-2.0 Makefile
diff -Nru libapache2-mod-rpaf-0.5/test.pl libapache2-mod-rpaf-0.6/test.pl
--- libapache2-mod-rpaf-0.5/test.pl	2004-03-17 18:47:30.000000000 +0300
+++ libapache2-mod-rpaf-0.6/test.pl	1970-01-01 03:00:00.000000000 +0300
@@ -1,26 +0,0 @@
-#!/usr/bin/perl -w
-
-use strict;
-use LWP::UserAgent;
-use HTTP::Request;
-use HTTP::Headers;
-
-my $ip = shift || '10.0.0.1';
-
-my $ua = LWP::UserAgent->new;
-my $headers = HTTP::Headers->new();
-
-$headers->header('X-Forwarded-For' => "192.168.0.1, " . $ip);
-$headers->header('X-Host' => 'localhost');
-
-my $request = HTTP::Request->new('GET', 'http://localhost:8080/', $headers);
-
-my $response = $ua->request($request);
-
-if ($response->is_success) {
-    print "Ok! Please check your server log for a supposed connection from $ip\n";
-} else {
-    print "Something went wrong\n";
-}
-
-__END__

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to