Browse Source

- added mod_evasive to the autoconf build

- ignore connections from the count which are not yet initialized


git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-merge-1.4.x@919 152afb58-edef-0310-8abb-c4023f1b3aa9
svn/tags/lighttpd-1.4.11
Jan Kneschke 16 years ago
parent
commit
78fe973055
  1. 6
      src/Makefile.am
  2. 6
      src/mod_evasive.c

6
src/Makefile.am

@ -68,6 +68,12 @@ src += $(common_src)
common_libadd =
endif
lib_LTLIBRARIES += mod_evasive.la
mod_evasive_la_SOURCES = mod_evasive.c
mod_evasive_la_LDFLAGS = -module -export-dynamic -avoid-version -no-undefined
mod_evasive_la_LIBADD = $(common_libadd)
lib_LTLIBRARIES += mod_webdav.la
mod_webdav_la_SOURCES = mod_webdav.c
mod_webdav_la_CFLAGS = $(XML_CFLAGS)

6
src/mod_evasive.c

@ -141,7 +141,11 @@ URIHANDLER_FUNC(mod_evasive_uri_handler) {
for (j = 0; j < srv->conns->used; j++) {
connection *c = srv->conns->ptr[j];
if (c->dst_addr.ipv4.sin_addr.s_addr == con->dst_addr.ipv4.sin_addr.s_addr) {
/* check if other connections are already actively serving data for the same IP
* we can only ban connections which are already behind the 'read request' state
* */
if (c->dst_addr.ipv4.sin_addr.s_addr == con->dst_addr.ipv4.sin_addr.s_addr &&
c->state > CON_STATE_REQUEST_END) {
conns_by_ip++;
if (conns_by_ip > p->conf.max_conns) {

Loading…
Cancel
Save