MINOR: config: tolerate server "cookie" setting in non-HTTP mode
Up to now, if a cookie value was specified on a server when the proxy was
in TCP mode, it would cause a fatal error. Now we only report a warning,
since the cookie will be ignored. This makes it easier to generate configs
from scripts.
diff --git a/src/cfgparse.c b/src/cfgparse.c
index a320bfb..b6650cd 100644
--- a/src/cfgparse.c
+++ b/src/cfgparse.c
@@ -6145,12 +6145,18 @@
*/
newsrv = curproxy->srv;
while (newsrv != NULL) {
- if ((curproxy->mode != PR_MODE_HTTP) && (newsrv->rdr_len || newsrv->cklen)) {
+ if ((curproxy->mode != PR_MODE_HTTP) && newsrv->rdr_len) {
Alert("config : %s '%s' : server cannot have cookie or redirect prefix in non-HTTP mode.\n",
proxy_type_str(curproxy), curproxy->id);
cfgerr++;
}
+ if ((curproxy->mode != PR_MODE_HTTP) && newsrv->cklen) {
+ Warning("config : %s '%s' : ignoring cookie for server '%s' as HTTP mode is disabled.\n",
+ proxy_type_str(curproxy), curproxy->id, newsrv->id);
+ err_code |= ERR_WARN;
+ }
+
#if defined(CONFIG_HAP_CTTPROXY) || defined(CONFIG_HAP_LINUX_TPROXY)
if (curproxy->mode != PR_MODE_HTTP && newsrv->bind_hdr_occ) {
newsrv->bind_hdr_occ = 0;