]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MEDIUM: htx: Allow the option http-use-htx to be used on TCP proxies too
authorChristopher Faulet <cfaulet@haproxy.com>
Thu, 11 Apr 2019 20:04:08 +0000 (22:04 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 12 Apr 2019 20:06:53 +0000 (22:06 +0200)
This will be mandatory to allow upgrades from TCP to HTTP in HTX. Of course, raw
buffers will still be used by default on TCP proxies, this option sets or
not. But if you want to handle mux upgrades from a TCP proxy, you must enable
the HTX on it and on all its backends.

There is only a small change in the lua code. Because TCP proxies can be HTX
aware, to exclude TCP services only for HTTP proxies, we must also check the
mode (TCP/HTTP) now.

src/hlua.c
src/proxy.c

index dd9fc004ddc15c5406fba1bece74e5b3c9cf4a6f..98c434ae2417bb80e8dc0cb44b3f8086d8139b51 100644 (file)
@@ -7714,7 +7714,7 @@ static enum act_parse_ret action_register_service_tcp(const char **args, int *cu
 {
        struct hlua_function *fcn = rule->kw->private;
 
-       if (px->options2 & PR_O2_USE_HTX) {
+       if (px->mode == PR_MODE_HTTP && (px->options2 & PR_O2_USE_HTX)) {
                memprintf(err, "Lua services cannot be used when the HTX internal representation is enabled");
                return ACT_RET_PRS_ERR;
        }
index be810598ab639bc0f3988d74fe0d060503f57792..8c4b2f26f910d12da5ec8ac37b381ce544da911f 100644 (file)
@@ -111,7 +111,7 @@ const struct cfg_opt cfg_opts2[] =
        { "http-use-proxy-header",        PR_O2_USE_PXHDR, PR_CAP_FE, 0, PR_MODE_HTTP },
        { "http-pretend-keepalive",       PR_O2_FAKE_KA,   PR_CAP_BE, 0, PR_MODE_HTTP },
        { "http-no-delay",                PR_O2_NODELAY,   PR_CAP_FE|PR_CAP_BE, 0, PR_MODE_HTTP },
-       { "http-use-htx",                 PR_O2_USE_HTX,   PR_CAP_FE|PR_CAP_BE, 0, PR_MODE_HTTP },
+       { "http-use-htx",                 PR_O2_USE_HTX,   PR_CAP_FE|PR_CAP_BE, 0, 0 },
        { NULL, 0, 0, 0 }
 };