]> granicus.if.org Git - apache/blobdiff - modules/experimental/mod_noloris.c
Introduce a per connection "peer_ip" and a per request "client_ip" to
[apache] / modules / experimental / mod_noloris.c
index f2c423cf3d6bf91dccf00b4b15ba659091bef6a7..11567cfdd7d50655e2b7b466a1cda783babeb729 100644 (file)
@@ -35,6 +35,7 @@
 
 #include "httpd.h"
 #include "http_config.h"
+#include "http_core.h"
 #include "http_connection.h"
 #include "http_log.h"
 #include "mpm_common.h"
@@ -43,7 +44,6 @@
 #include "scoreboard.h"
 
 module AP_MODULE_DECLARE_DATA noloris_module;
-module AP_MODULE_DECLARE_DATA core_module;
 
 #define ADDR_MAX_SIZE 48
 
@@ -67,11 +67,11 @@ static int noloris_conn(conn_rec *conn)
     /* check the IP is not banned */
     shm_rec = apr_shm_baseaddr_get(shm);
     while (shm_rec[0] != '\0') {
-        if (!strcmp(shm_rec, conn->remote_ip)) {
-            apr_socket_t *csd = ap_get_module_config(conn->conn_config, &core_module);
+        if (!strcmp(shm_rec, conn->peer_ip)) {
+            apr_socket_t *csd = ap_get_conn_socket(conn);
             ap_log_cerror(APLOG_MARK, APLOG_ERR, 0, conn,
                           "Dropping connection from banned IP %s",
-                          conn->remote_ip);
+                          conn->peer_ip);
             apr_socket_close(csd);
 
             return DONE;
@@ -80,7 +80,7 @@ static int noloris_conn(conn_rec *conn)
     }
 
     /* store this client IP for the monitor to pick up */
+
     ap_update_child_status_from_conn(conn->sbh, SERVER_READY, conn);
 
     return DECLINED;