X-Git-Url: https://git.tld-linux.org/?p=packages%2Flighttpd.git;a=blobdiff_plain;f=lighttpd-mod_evasive-status_code.patch;h=02cbd9ecd0f2ef8c74318e824169cb102ec80e03;hp=7f8daccda9b64e7959bbbca511b2929b09b6d7eb;hb=HEAD;hpb=82b54184faf5e32cf65c54d52bcecea5c2f03d5c diff --git a/lighttpd-mod_evasive-status_code.patch b/lighttpd-mod_evasive-status_code.patch deleted file mode 100644 index 7f8dacc..0000000 --- a/lighttpd-mod_evasive-status_code.patch +++ /dev/null @@ -1,100 +0,0 @@ ---- lighttpd-1.4.40/src/mod_evasive.c 2016-07-16 10:06:16.000000000 +0000 -+++ lighttpd-1.4.40/src/mod_evasive.c 2016-07-26 12:11:56.730554000 +0000 -@@ -31,12 +31,16 @@ - typedef struct { - unsigned short max_conns; - unsigned short silent; -+ unsigned short http_status_code; -+ unsigned int retry_after; - buffer *location; - } plugin_config; - - typedef struct { - PLUGIN_DATA; - -+ buffer *evasive_rftmp; -+ - plugin_config **config_storage; - - plugin_config conf; -@@ -47,6 +51,10 @@ - - p = calloc(1, sizeof(*p)); - -+ p->evasive_rftmp = buffer_init(); -+ -+ buffer_prepare_copy(p->evasive_rftmp, 255); -+ - return p; - } - -@@ -57,6 +65,8 @@ - - if (!p) return HANDLER_GO_ON; - -+ buffer_free(p->evasive_rftmp); -+ - if (p->config_storage) { - size_t i; - for (i = 0; i < srv->config_context->used; i++) { -@@ -84,6 +94,8 @@ - { "evasive.max-conns-per-ip", NULL, T_CONFIG_SHORT, T_CONFIG_SCOPE_CONNECTION }, /* 0 */ - { "evasive.silent", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 1 */ - { "evasive.location", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION }, /* 2 */ -+ { "evasive.http-status-code", NULL, T_CONFIG_SHORT, T_CONFIG_SCOPE_CONNECTION }, /* 3 */ -+ { "evasive.retry-after", NULL, T_CONFIG_SHORT, T_CONFIG_SCOPE_CONNECTION }, /* 4 */ - { NULL, NULL, T_CONFIG_UNSET, T_CONFIG_SCOPE_UNSET } - }; - -@@ -94,13 +106,17 @@ - plugin_config *s; - - s = calloc(1, sizeof(plugin_config)); -- s->max_conns = 0; -- s->silent = 0; -- s->location = buffer_init(); -+ s->max_conns = 0; -+ s->silent = 0; -+ s->location = buffer_init(); -+ s->http_status_code = 503; -+ s->retry_after = 0; - - cv[0].destination = &(s->max_conns); - cv[1].destination = &(s->silent); - cv[2].destination = s->location; -+ cv[2].destination = &(s->http_status_code); -+ cv[3].destination = &(s->retry_after); - - p->config_storage[i] = s; - -@@ -121,6 +137,8 @@ - PATCH(max_conns); - PATCH(silent); - PATCH(location); -+ PATCH(http_status_code); -+ PATCH(retry_after); - - /* skip the first, the global context */ - for (i = 1; i < srv->config_context->used; i++) { -@@ -140,6 +158,10 @@ - PATCH(silent); - } else if (buffer_is_equal_string(du->key, CONST_STR_LEN("evasive.location"))) { - PATCH(location); -+ } else if (buffer_is_equal_string(du->key, CONST_STR_LEN("evasive.http-status-code"))) { -+ PATCH(http_status_code); -+ } else if (buffer_is_equal_string(du->key, CONST_STR_LEN("evasive.retry-after"))) { -+ PATCH(retry_after); - } - } - } -@@ -205,7 +227,9 @@ - con->http_status = 302; - con->file_finished = 1; - } else { -- con->http_status = 403; -+ con->http_status = p->conf.http_status_code; -+ buffer_copy_long(p->evasive_rftmp, p->conf.retry_after); -+ response_header_overwrite(srv, con, CONST_STR_LEN("Retry-After"), CONST_BUF_LEN(p->evasive_rftmp)); - } - con->mode = DIRECT; - return HANDLER_FINISHED;