From 1b13ecaca2b1ecceda94f1699a44a071d5133000 Mon Sep 17 00:00:00 2001 From: Christopher Faulet Date: Thu, 14 May 2020 09:54:26 +0200 Subject: [PATCH] MINOR: http-htx: Store default error messages in a global http reply array Default error messages are stored as a buffer, in http_err_chunks global array. Now, they are also stored as a http reply, in http_err_replies global array. --- include/proto/http_htx.h | 1 + src/http_htx.c | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/include/proto/http_htx.h b/include/proto/http_htx.h index 4e9c7c861e..557d34f457 100644 --- a/include/proto/http_htx.h +++ b/include/proto/http_htx.h @@ -30,6 +30,7 @@ #include extern struct buffer http_err_chunks[HTTP_ERR_SIZE]; +extern struct http_reply http_err_replies[HTTP_ERR_SIZE]; extern struct list http_errors_list; struct htx_sl *http_get_stline(struct htx *htx); diff --git a/src/http_htx.c b/src/http_htx.c index d98b2b9945..4414ab3781 100644 --- a/src/http_htx.c +++ b/src/http_htx.c @@ -29,6 +29,8 @@ #include struct buffer http_err_chunks[HTTP_ERR_SIZE]; +struct http_reply http_err_replies[HTTP_ERR_SIZE]; + struct eb_root http_error_messages = EB_ROOT; struct list http_errors_list = LIST_HEAD_INIT(http_errors_list); @@ -1013,6 +1015,11 @@ static int http_htx_init(void) err_code |= ERR_ALERT | ERR_FATAL; } http_err_chunks[rc] = chk; + http_err_replies[rc].type = HTTP_REPLY_ERRMSG; + http_err_replies[rc].status = http_err_codes[rc]; + http_err_replies[rc].ctype = NULL; + LIST_INIT(&http_err_replies[rc].hdrs); + http_err_replies[rc].body.errmsg = &http_err_chunks[rc]; } end: return err_code;