Commit 3d43f62b authored by Tollef Fog Heen's avatar Tollef Fog Heen

Add support for banning on http.status

Fixes: #1076
parent a4e2d478
......@@ -113,9 +113,10 @@ static bgthread_t ban_lurker;
#define BAN_OPER_MATCH 0x12
#define BAN_OPER_NMATCH 0x13
#define BAN_ARG_URL 0x18
#define BAN_ARG_REQHTTP 0x19
#define BAN_ARG_OBJHTTP 0x1a
#define BAN_ARG_URL 0x18
#define BAN_ARG_REQHTTP 0x19
#define BAN_ARG_OBJHTTP 0x1a
#define BAN_ARG_OBJSTATUS 0x1b
/*--------------------------------------------------------------------
* Variables we can purge on
......@@ -609,6 +610,7 @@ ban_evaluate(const uint8_t *bs, const struct http *objhttp,
struct ban_test bt;
const uint8_t *be;
char *arg1;
char buf[10];
be = bs + ban_len(bs);
bs += 13;
......@@ -628,6 +630,10 @@ ban_evaluate(const uint8_t *bs, const struct http *objhttp,
case BAN_ARG_OBJHTTP:
(void)http_GetHdr(objhttp, bt.arg1_spec, &arg1);
break;
case BAN_ARG_OBJSTATUS:
arg1 = buf;
sprintf(buf, "%d", objhttp->status);
break;
default:
INCOMPL();
}
......
......@@ -35,3 +35,4 @@
PVAR("req.url", PVAR_REQ, BAN_ARG_URL)
PVAR("req.http.", PVAR_REQ|PVAR_HTTP, BAN_ARG_REQHTTP)
PVAR("obj.http.", PVAR_HTTP, BAN_ARG_OBJHTTP)
PVAR("obj.status", 0, BAN_ARG_OBJSTATUS)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment