]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: stats: Add the status code STAT_STATUS_IVAL to handle invalid requests
authorChristopher Faulet <cfaulet@haproxy.com>
Wed, 27 Feb 2019 15:41:27 +0000 (16:41 +0100)
committerWilly Tarreau <w@1wt.eu>
Fri, 15 Mar 2019 13:34:52 +0000 (14:34 +0100)
This patch must be backported to 1.9 because a bug fix depends on it.

include/types/proto_http.h
src/proto_http.c
src/stats.c

index 21910a91e990f062701b8006580504263447540b..4af1361450b0969dabe68ca9cbba562ce92311d1 100644 (file)
@@ -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
 };
 
index 4361d6db564a8cc324d630576ed0c99c33eccd4e..0127e23b59b8c763e91a785046fe074dc650abdb 100644 (file)
@@ -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
index b3935410f7f3b8cae0eb61cefb47a051b9788716..6f563533018b501459d72eaf3bef71dbf34ef42a 100644 (file)
@@ -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,
+                                     "<p><div class=active_down>"
+                                     "<a class=lfsb href=\"%s%s%s%s\" title=\"Remove this message\">[X]</a> "
+                                     "<b>Invalid requests (unsupported method or chunked encoded request).</b>"
+                                     "</div>\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,
                                      "<p><div class=active_no_check>"