]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: acl: Add HTTP_2.0 predefined macro
authorChristopher Faulet <cfaulet@haproxy.com>
Fri, 26 Mar 2021 15:00:54 +0000 (16:00 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Tue, 6 Apr 2021 05:31:51 +0000 (07:31 +0200)
HTTP_2.0 predefined macro returns true for HTTP/2 requests. HTTP/2 doen't
convey a version information, so this macro may seem a bit strange. But for
compatiblity reasons, internally, the "HTTP/2.0" version is set. Thus, it is
handy to rely on it to differenciate HTTP/1 and HTTP/2 requests.

doc/configuration.txt
src/acl.c

index c25e2cea2c1645dfd1a1207f95160b057d20d8de..6b52609d494e40dd9cdd851b33ea2a94b829a737 100644 (file)
@@ -19503,6 +19503,7 @@ FALSE            always_false                       never match
 HTTP             req.proto_http                     match if request protocol is valid HTTP
 HTTP_1.0         req.ver 1.0                        match if HTTP request version is 1.0
 HTTP_1.1         req.ver 1.1                        match if HTTP request version is 1.1
+HTTP_2.0         req.ver 2.0                        match if HTTP request version is 2.0
 HTTP_CONTENT     req.hdr_val(content-length) gt 0   match an existing content-length in the HTTP request
 HTTP_URL_ABS     url_reg ^[^/:]*://                 match absolute URL with scheme
 HTTP_URL_SLASH   url_beg /                          match URL beginning with "/"
index 54324c5a8a633791b215cdb01aa5baa27989c7aa..655f9f40f1b483a33c62ea3b1dd4bb2bdf63c631 100644 (file)
--- a/src/acl.c
+++ b/src/acl.c
@@ -755,6 +755,7 @@ const struct {
        { .name = "HTTP",           .expr = {"req.proto_http",""}},
        { .name = "HTTP_1.0",       .expr = {"req.ver","1.0",""}},
        { .name = "HTTP_1.1",       .expr = {"req.ver","1.1",""}},
+       { .name = "HTTP_2.0",       .expr = {"req.ver","2.0",""}},
        { .name = "METH_CONNECT",   .expr = {"method","CONNECT",""}},
        { .name = "METH_DELETE",    .expr = {"method","DELETE",""}},
        { .name = "METH_GET",       .expr = {"method","GET","HEAD",""}},