]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: http-htx: Store default error messages in a global http reply array
authorChristopher Faulet <cfaulet@haproxy.com>
Thu, 14 May 2020 07:54:26 +0000 (09:54 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 20 May 2020 16:27:13 +0000 (18:27 +0200)
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
src/http_htx.c

index 4e9c7c861e2b3a1eb4e7c7830543c402936d412e..557d34f457cf29cdbc1aea6ea2da3da2d0d834e6 100644 (file)
@@ -30,6 +30,7 @@
 #include <types/http_htx.h>
 
 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);
index d98b2b9945e715d2c1d80eaa09b66cedf9cc3c2e..4414ab378141346a30eb0f7be6513486096c6437 100644 (file)
@@ -29,6 +29,8 @@
 #include <proto/sample.h>
 
 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;