]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
[MINOR] cfgparse: only keep one of dispatch, transparent, http_proxy
authorWilly Tarreau <w@1wt.eu>
Fri, 4 Mar 2011 16:30:54 +0000 (17:30 +0100)
committerWilly Tarreau <w@1wt.eu>
Thu, 10 Mar 2011 22:32:16 +0000 (23:32 +0100)
Since all of them are defined as proxy options, it's better to ensure
that at most one of them is enabled at once. The priority has been set
according to what is already performed in the backend :

   1) dispatch
   2) http_proxy
   3) transparent

src/cfgparse.c

index 8c23f9460948bef04e580443c6f19dd82b23ee81..18cfda39dbb72db5bbe7b0d3279b71accfd55149 100644 (file)
@@ -5636,6 +5636,19 @@ int check_config_validity()
                        }
                }
 
+               if (curproxy->options2 & PR_O2_DISPATCH) {
+                       curproxy->options  &= ~PR_O_TRANSP;
+                       curproxy->options  &= ~PR_O_HTTP_PROXY;
+               }
+               else if (curproxy->options & PR_O_HTTP_PROXY) {
+                       curproxy->options2 &= ~PR_O2_DISPATCH;
+                       curproxy->options  &= ~PR_O_TRANSP;
+               }
+               else if (curproxy->options & PR_O_TRANSP) {
+                       curproxy->options2 &= ~PR_O2_DISPATCH;
+                       curproxy->options  &= ~PR_O_HTTP_PROXY;
+               }
+
                if ((curproxy->options & PR_O_DISABLE404) && !(curproxy->options & PR_O_HTTP_CHK)) {
                        curproxy->options &= ~PR_O_DISABLE404;
                        Warning("config : '%s' will be ignored for %s '%s' (requires 'option httpchk').\n",