From 8043e831d19eeef4f45bc589a5fd000a539b1e26 Mon Sep 17 00:00:00 2001 From: Christopher Faulet Date: Fri, 26 Mar 2021 16:00:54 +0100 Subject: [PATCH] MINOR: acl: Add HTTP_2.0 predefined macro 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 | 1 + src/acl.c | 1 + 2 files changed, 2 insertions(+) diff --git a/doc/configuration.txt b/doc/configuration.txt index c25e2cea2..6b52609d4 100644 --- a/doc/configuration.txt +++ b/doc/configuration.txt @@ -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 "/" diff --git a/src/acl.c b/src/acl.c index 54324c5a8..655f9f40f 100644 --- 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",""}},