MEDIUM: h2: send connect protocol h2 settings
In order to announce support for the Extended CONNECT h2 method by
haproxy, always send the ENABLE_CONNECT_PROTOCOL h2 settings. This new
setting has been described in the rfc 8441.
After receiving ENABLE_CONNECT_PROTOCOL, the client is free to use the
Extended CONNECT h2 method. This can notably be useful for the support
of websocket handshake on http/2.
diff --git a/include/haproxy/h2.h b/include/haproxy/h2.h
index 34ad4de..1b49b85 100644
--- a/include/haproxy/h2.h
+++ b/include/haproxy/h2.h
@@ -157,12 +157,13 @@
} __attribute__((packed));
// RFC7540 #11.3 : Settings Registry
-#define H2_SETTINGS_HEADER_TABLE_SIZE 0x0001
-#define H2_SETTINGS_ENABLE_PUSH 0x0002
-#define H2_SETTINGS_MAX_CONCURRENT_STREAMS 0x0003
-#define H2_SETTINGS_INITIAL_WINDOW_SIZE 0x0004
-#define H2_SETTINGS_MAX_FRAME_SIZE 0x0005
-#define H2_SETTINGS_MAX_HEADER_LIST_SIZE 0x0006
+#define H2_SETTINGS_HEADER_TABLE_SIZE 0x0001
+#define H2_SETTINGS_ENABLE_PUSH 0x0002
+#define H2_SETTINGS_MAX_CONCURRENT_STREAMS 0x0003
+#define H2_SETTINGS_INITIAL_WINDOW_SIZE 0x0004
+#define H2_SETTINGS_MAX_FRAME_SIZE 0x0005
+#define H2_SETTINGS_MAX_HEADER_LIST_SIZE 0x0006
+#define H2_SETTINGS_ENABLE_CONNECT_PROTOCOL 0x0008
/* some protocol constants */
diff --git a/src/mux_h2.c b/src/mux_h2.c
index 1fc6ca0..b067f29 100644
--- a/src/mux_h2.c
+++ b/src/mux_h2.c
@@ -1593,6 +1593,10 @@
chunk_memcat(&buf, "\x00\x02\x00\x00\x00\x00", 6);
}
+ /* rfc 8441 #3 SETTINGS_ENABLE_CONNECT_PROTOCOL=1
+ * sent automatically */
+ chunk_memcat(&buf, "\x00\x08\x00\x00\x00\x01", 6);
+
if (h2_settings_header_table_size != 4096) {
char str[6] = "\x00\x01"; /* header_table_size */
@@ -2197,6 +2201,10 @@
h2c->streams_limit = arg;
}
break;
+ case H2_SETTINGS_ENABLE_CONNECT_PROTOCOL:
+ /* nothing to do here as this settings is automatically
+ * transmits to the client */
+ break;
}
}