]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: config: tolerate server "cookie" setting in non-HTTP mode
authorWilly Tarreau <w@1wt.eu>
Mon, 31 Oct 2011 12:49:26 +0000 (13:49 +0100)
committerWilly Tarreau <w@1wt.eu>
Mon, 31 Oct 2011 13:09:13 +0000 (14:09 +0100)
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

index a320bfbf296327d8db3a2ed82c55f6fd4c4c5985..b6650cd81c8d83537466e59aa125f9011ab33fd6 100644 (file)
@@ -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;