Package: libapache-mod-rpaf
Version: 0.5-2
Severity: important
Tags: patch
When the reverse proxy makes Keepalive requests to the backend server
and passes requests from multiple clients over the
connection. mod_rpaf doesn't set the remote_ip properly for any but
the first request on a keepalive connection. The latest (0.5) release
allocates the remote_ip string from the connection pool, which is
right, but ends up with a different bug. [1]
Severity set to important because the module messes up Apache's
environment and it's logs. Patch included.
- Werner
[1] http://blog.webkist.com/archives/000042.html
--- mod_rpaf-0.5/mod_rpaf.c 2004-03-17 10:47:30.000000000 -0500
+++ mod_rpaf-0.5+cramer/mod_rpaf.c 2004-09-27 10:28:28.000000000 -0400
@@ -130,6 +130,13 @@
return 0;
}
+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;
@@ -147,6 +154,10 @@
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 = 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) {