Detect if the Apache conn_rec
structure uses client_ip
and uses it accordingly.
Fallback is the original `conn_rec->remote_ip`.
This commit is contained in:
parent
d5bc945bc3
commit
d71a0abede
|
@ -43,6 +43,8 @@ APACHE_DIR
|
||||||
# The AC_SUBST macro causes the variable to be saved in config.status
|
# The AC_SUBST macro causes the variable to be saved in config.status
|
||||||
AC_SUBST(apache_dir)
|
AC_SUBST(apache_dir)
|
||||||
|
|
||||||
|
AC_CHECK_MEMBER(conn_rec.client_ip, AC_DEFINE(USE_CONN_REC_CLIENT_IP,1,[Do we have conn_rec.client_ip]),,[#include "httpd.h"])
|
||||||
|
|
||||||
# Write config.status and the Makefile
|
# Write config.status and the Makefile
|
||||||
AC_OUTPUT(Makefile)
|
AC_OUTPUT(Makefile)
|
||||||
|
|
||||||
|
|
|
@ -65,7 +65,11 @@ static int mod_blockinator_method_handler(request_rec *r)
|
||||||
int sqlite3_rc;
|
int sqlite3_rc;
|
||||||
|
|
||||||
/* Capture the relevant information from the inbound request */
|
/* Capture the relevant information from the inbound request */
|
||||||
remote_ip = r->connection->client_ip;
|
#ifdef USE_CONN_REC_CLIENT_IP
|
||||||
|
remote_ip = r->connection->client_ip,
|
||||||
|
#else
|
||||||
|
remote_ip = r->connection->remote_ip,
|
||||||
|
#endif
|
||||||
forwarded_ip = apr_table_get(r->headers_in, "X-Forwarded-For");
|
forwarded_ip = apr_table_get(r->headers_in, "X-Forwarded-For");
|
||||||
useragent = apr_table_get(r->headers_in, "User-Agent");
|
useragent = apr_table_get(r->headers_in, "User-Agent");
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue