MINOR: proxy: add a new option "http-use-htx"
This option makes a proxy use only HTX-compatible muxes instead of the
HTTP-compatible ones for HTTP modes. It must be set on both ends, this
is checked at parsing time.
diff --git a/include/proto/connection.h b/include/proto/connection.h
index 47825a0..1aa0ed9 100644
--- a/include/proto/connection.h
+++ b/include/proto/connection.h
@@ -971,7 +971,14 @@
struct ist mux_proto;
const char *alpn_str = NULL;
int alpn_len = 0;
- int mode = (1 << (bind_conf->frontend->mode == PR_MODE_HTTP));
+ int mode;
+
+ if (bind_conf->frontend->mode == PR_MODE_TCP)
+ mode = PROTO_MODE_TCP;
+ else if (bind_conf->frontend->options2 & PR_O2_USE_HTX)
+ mode = PROTO_MODE_HTX;
+ else
+ mode = PROTO_MODE_HTTP;
conn_get_alpn(conn, &alpn_str, &alpn_len);
mux_proto = ist2(alpn_str, alpn_len);
@@ -1003,7 +1010,13 @@
else {
int mode;
- mode = (1 << (prx->mode == PR_MODE_HTTP));
+ if (prx->mode == PR_MODE_TCP)
+ mode = PROTO_MODE_TCP;
+ else if (prx->options2 & PR_O2_USE_HTX)
+ mode = PROTO_MODE_HTX;
+ else
+ mode = PROTO_MODE_HTTP;
+
mux_ops = conn_get_best_mux(conn, ist(NULL), PROTO_SIDE_BE, mode);
if (!mux_ops)
return -1;
diff --git a/include/types/connection.h b/include/types/connection.h
index 827df36..889decb 100644
--- a/include/types/connection.h
+++ b/include/types/connection.h
@@ -425,7 +425,8 @@
PROTO_MODE_NONE = 0,
PROTO_MODE_TCP = 1 << 0, // must not be changed!
PROTO_MODE_HTTP = 1 << 1, // must not be changed!
- PROTO_MODE_ANY = PROTO_MODE_TCP | PROTO_MODE_HTTP,
+ PROTO_MODE_HTX = 1 << 2, // must not be changed!
+ PROTO_MODE_ANY = PROTO_MODE_TCP | PROTO_MODE_HTTP, // note: HTX is experimental and must not appear here
};
enum proto_proxy_side {
diff --git a/include/types/proxy.h b/include/types/proxy.h
index b5f5b9b..da09848 100644
--- a/include/types/proxy.h
+++ b/include/types/proxy.h
@@ -151,7 +151,7 @@
#define PR_O2_SRC_ADDR 0x00100000 /* get the source ip and port for logs */
#define PR_O2_FAKE_KA 0x00200000 /* pretend we do keep-alive with server eventhough we close */
-/* unused: 0x00400000 */
+#define PR_O2_USE_HTX 0x00400000 /* use the HTX representation for the HTTP protocol */
#define PR_O2_EXP_NONE 0x00000000 /* http-check : no expect rule */
#define PR_O2_EXP_STS 0x00800000 /* http-check expect status */
#define PR_O2_EXP_RSTS 0x01000000 /* http-check expect rstatus */