commit "BUG/MINOR: http-htx: Just warn if payload of an errorfile
doesn't match the C-L" (which is only present in 2.2, 2.1 and 2.0 trees,
i.e see commit 7bf3d81d3cf4b9f4587 in 2.2 tree), is changing the
behavior of `http_str_to_htx` function as the error path is filling
up errmsg without returning an error.

- when called in `http_htx_init`, it is ok as we test `errmsg` and print
  a warning.
- but it is not the case in `http_load_errorfile` and `http_load_errormsg`.

End result is no warning is printed when there is a content-length
mismatch. This patch tries to address that.

This patch is probably only valid for 2.2, 2.1 and 2.0 trees as it fixes
an issue present in those trees. However it might be worth considering
for the dev tree to avoid future regressions and be more consistent.

Signed-off-by: William Dauchy <wdau...@gmail.com>
---
 src/http_htx.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/http_htx.c b/src/http_htx.c
index 51dbf44a6..27c409e4a 100644
--- a/src/http_htx.c
+++ b/src/http_htx.c
@@ -1197,6 +1197,9 @@ struct buffer *http_load_errorfile(const char *file, char 
**errmsg)
                free(http_errmsg);
                goto out;
        }
+       else if (*errmsg) {
+               ha_warning("invalid custom message %s: %s\n", file, *errmsg);
+       }
 
        /* Insert the node in the tree and return the HTX message */
        http_errmsg->msg = chk;
@@ -1248,6 +1251,9 @@ struct buffer *http_load_errormsg(const char *key, const 
struct ist msg, char **
                free(http_errmsg);
                goto out;
        }
+       else if (*errmsg) {
+               ha_warning("invalid custom message: %s\n", *errmsg);
+       }
 
        /* Insert the node in the tree and return the HTX message */
        http_errmsg->msg = chk;
-- 
2.28.0


Reply via email to