From 0cec331a0e08a875171c235cb02a202fee190a4e Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Mon, 31 Oct 2011 13:49:26 +0100 Subject: 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. --- src/cfgparse.c | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-) 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 @@ out_uri_auth_compat: */ 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; -- 1.7.2.3