From 1d2b586cdd3010898d31426ea0cbadec948eb6b7 Mon Sep 17 00:00:00 2001 From: Christopher Faulet Date: Fri, 12 Apr 2019 16:10:51 +0200 Subject: [PATCH] MAJOR: htx: Enable the HTX mode by default for all proxies The legacy HTTP mode is no more the default one. So now, by default, without any option in your configuration, all proxies will use the HTX mode. The line "option http-use-htx" in proxy sections are now useless, except to cancel the legacy HTTP mode. To fallback on legacy HTTP mode, you should use the line "no option http-use-htx" explicitly. Note that the reg-tests still work by default on legacy HTTP mode. The HTX will be enabled by default in a futur commit. --- doc/configuration.txt | 30 +++++++++++++++--------------- scripts/run-regtests.sh | 2 +- src/proxy.c | 3 +++ 3 files changed, 19 insertions(+), 16 deletions(-) diff --git a/doc/configuration.txt b/doc/configuration.txt index 2f1e57e449..7a5903ce74 100644 --- a/doc/configuration.txt +++ b/doc/configuration.txt @@ -6224,28 +6224,28 @@ no option http-use-htx yes | yes | yes | yes Arguments : none - By default, the HTTP protocol is processed as-is. Inserting, deleting, or + Historically, the HTTP protocol is processed as-is. Inserting, deleting, or modifying a header field requires to rewrite the affected part in the buffer - and to move the buffer's tail accordingly. Since this principle has deep - roots in haproxy, the HTTP/2 protocol is converted to HTTP/1.1 before being - processed this way. It also results in the inability to establish HTTP/2 - connections to servers because of the loss of HTTP/2 semantics in the HTTP/1 - representation. + and to move the buffer's tail accordingly. This mode is known as the legacy + HTTP mode. Since this principle has deep roots in haproxy, the HTTP/2 + protocol is converted to HTTP/1.1 before being processed this way. It also + results in the inability to establish HTTP/2 connections to servers because + of the loss of HTTP/2 semantics in the HTTP/1 representation. HTX is the name of a totally new native internal representation for the HTTP protocol, that is agnostic to the version and aims at preserving semantics all along the chain. It relies on a fast parsing, tokenizing and indexing of the protocol elements so that no more memory moves are necessary and that - most elements are directly accessed. This mechanism is still limited to the - most basic operations (no compression, filters, Lua, applets, cache, etc). - But it supports using either HTTP/1 or HTTP/2 on any side regardless of the - other side's version. + most elements are directly accessed. It supports using either HTTP/1 or + HTTP/2 on any side regardless of the other side's version. It also supports + upgrades from TCP to HTTP and implicit ones from HTTP/1 to HTTP/2 (matching + the HTTP/2 preface). - This option indicates that HTX needs to be used. It will cause errors to be - emitted if incompatible features are used, but will allow H2 to be selected - as a server protocol. It is recommended to use this option on new reasonably - simple configurations, but since the feature still has incomplete functional - coverage, it is not enabled by default. + This option indicates that HTX needs to be used. Since the version 2.0-dev3, + the HTX is the default mode. To switch back on the legacy HTTP mode, the + option must be explicitly disabled using the "no" prefix. For prior versions, + the feature has incomplete functional coverage, so it is not enabled by + default. See also : "mode http" diff --git a/scripts/run-regtests.sh b/scripts/run-regtests.sh index 5eaaf0f6c1..c6477cb8d7 100755 --- a/scripts/run-regtests.sh +++ b/scripts/run-regtests.sh @@ -302,7 +302,7 @@ jobcount="" verbose="-q" debug="" keep_logs="-l" -no_htx="#" +no_htx="no " testlist="" _process "$@"; diff --git a/src/proxy.c b/src/proxy.c index 276fc425b1..a3f355f643 100644 --- a/src/proxy.c +++ b/src/proxy.c @@ -820,6 +820,9 @@ void init_new_proxy(struct proxy *p) /* initial uuid is unassigned (-1) */ p->uuid = -1; + /* HTX is the default mode, for HTTP and TCP */ + p->options2 |= PR_O2_USE_HTX; + HA_SPIN_INIT(&p->lock); }