[BUG] Fix empty X-Forwarded-For header name when set in defaults section
The following patch introduced a minor bug :
[MINOR] permit renaming of x-forwarded-for header
If "option forwardfor" is declared in a defaults section, the header name
is never set and we see an empty header name before the value. Also, the
header name was not reset between two defaults sections.
diff --git a/src/cfgparse.c b/src/cfgparse.c
index 78783c0..5f4e123 100644
--- a/src/cfgparse.c
+++ b/src/cfgparse.c
@@ -637,6 +637,11 @@
curproxy->except_net = defproxy.except_net;
curproxy->except_mask = defproxy.except_mask;
+ if (defproxy.fwdfor_hdr_len) {
+ curproxy->fwdfor_hdr_len = defproxy.fwdfor_hdr_len;
+ curproxy->fwdfor_hdr_name = strdup(defproxy.fwdfor_hdr_name);
+ }
+
if (curproxy->cap & PR_CAP_FE) {
curproxy->maxconn = defproxy.maxconn;
curproxy->backlog = defproxy.backlog;
@@ -721,6 +726,8 @@
free(defproxy.capture_name);
free(defproxy.monitor_uri);
free(defproxy.defbe.name);
+ free(defproxy.fwdfor_hdr_name);
+ defproxy.fwdfor_hdr_len = 0;
for (rc = 0; rc < HTTP_ERR_SIZE; rc++)
free(defproxy.errmsg[rc].str);