[BUG] x-original-to: name was not set in default instance
This resulted in an empty header name when option originalto
was declared in a default sections.
diff --git a/src/cfgparse.c b/src/cfgparse.c
index 3df0a21..eb7db0f 100644
--- a/src/cfgparse.c
+++ b/src/cfgparse.c
@@ -930,6 +930,11 @@
curproxy->fwdfor_hdr_name = strdup(defproxy.fwdfor_hdr_name);
}
+ if (defproxy.orgto_hdr_len) {
+ curproxy->orgto_hdr_len = defproxy.orgto_hdr_len;
+ curproxy->orgto_hdr_name = strdup(defproxy.orgto_hdr_name);
+ }
+
if (curproxy->cap & PR_CAP_FE) {
curproxy->maxconn = defproxy.maxconn;
curproxy->backlog = defproxy.backlog;
@@ -1034,6 +1039,8 @@
free(defproxy.iface_name);
free(defproxy.fwdfor_hdr_name);
defproxy.fwdfor_hdr_len = 0;
+ free(defproxy.orgto_hdr_name);
+ defproxy.orgto_hdr_len = 0;
for (rc = 0; rc < HTTP_ERR_SIZE; rc++)
chunk_destroy(&defproxy.errmsg[rc]);
diff --git a/src/proto_http.c b/src/proto_http.c
index cbaae5b..10874c5 100644
--- a/src/proto_http.c
+++ b/src/proto_http.c
@@ -2528,7 +2528,7 @@
} else {
len = s->fe->fwdfor_hdr_len;
memcpy(trash, s->fe->fwdfor_hdr_name, len);
- }
+ }
len += sprintf(trash + len, ": %d.%d.%d.%d", pn[0], pn[1], pn[2], pn[3]);
if (unlikely(http_header_add_tail2(req, &txn->req,
@@ -2601,7 +2601,7 @@
} else {
len = s->fe->orgto_hdr_len;
memcpy(trash, s->fe->orgto_hdr_name, len);
- }
+ }
len += sprintf(trash + len, ": %d.%d.%d.%d", pn[0], pn[1], pn[2], pn[3]);
if (unlikely(http_header_add_tail2(req, &txn->req,