From 3c2ecf75c834b9c374f9fc8a46507f90b1f51f3f Mon Sep 17 00:00:00 2001 From: Christopher Faulet Date: Wed, 27 Feb 2019 16:41:27 +0100 Subject: [PATCH] MINOR: stats: Add the status code STAT_STATUS_IVAL to handle invalid requests This patch must be backported to 1.9 because a bug fix depends on it. --- include/types/proto_http.h | 1 + src/proto_http.c | 1 + src/stats.c | 10 ++++++++++ 3 files changed, 12 insertions(+) diff --git a/include/types/proto_http.h b/include/types/proto_http.h index 21910a9..4af1361 100644 --- a/include/types/proto_http.h +++ b/include/types/proto_http.h @@ -193,6 +193,7 @@ enum { STAT_STATUS_NONE, /* nothing happened (no action chosen or servers state didn't change) */ STAT_STATUS_PART, /* the action is partially successful */ STAT_STATUS_UNKN, /* an unknown error occurred, shouldn't happen */ + STAT_STATUS_IVAL, /* invalid requests (chunked or invalid post) */ STAT_STATUS_SIZE }; diff --git a/src/proto_http.c b/src/proto_http.c index 4361d6d..0127e23 100644 --- a/src/proto_http.c +++ b/src/proto_http.c @@ -84,6 +84,7 @@ const char *stat_status_codes[STAT_STATUS_SIZE] = { [STAT_STATUS_NONE] = "NONE", [STAT_STATUS_PART] = "PART", [STAT_STATUS_UNKN] = "UNKN", + [STAT_STATUS_IVAL] = "IVAL", }; /* This function handles a server error at the stream interface level. The diff --git a/src/stats.c b/src/stats.c index b393541..6f56353 100644 --- a/src/stats.c +++ b/src/stats.c @@ -2572,6 +2572,16 @@ static void stats_dump_html_info(struct stream_interface *si, struct uri_auth *u (appctx->ctx.stats.flags & STAT_NO_REFRESH) ? ";norefresh" : "", scope_txt); break; + case STAT_STATUS_IVAL: + chunk_appendf(&trash, + "

" + "[X] " + "Invalid requests (unsupported method or chunked encoded request)." + "
\n", uri->uri_prefix, + (appctx->ctx.stats.flags & STAT_HIDE_DOWN) ? ";up" : "", + (appctx->ctx.stats.flags & STAT_NO_REFRESH) ? ";norefresh" : "", + scope_txt); + break; default: chunk_appendf(&trash, "

" -- 1.7.10.4