From 398c5f39ee768e1b0a97b13e1a6c31ce19a6e80c Mon Sep 17 00:00:00 2001 From: William Lallemand Date: Thu, 18 Jun 2020 18:52:18 +0200 Subject: [PATCH] REGTEST: http-rules: test spaces in ACLs This reg-test tests the spaces in an ACL file, it tries to add new entries with spaces from the CLI This reg-test could backported in all stable branches if the fix for spaces on the CLI was backported. --- reg-tests/http-rules/acl_cli_spaces.vtc | 52 +++++++++++++++++++++++++ reg-tests/http-rules/agents.acl | 1 + 2 files changed, 53 insertions(+) create mode 100644 reg-tests/http-rules/acl_cli_spaces.vtc create mode 100644 reg-tests/http-rules/agents.acl diff --git a/reg-tests/http-rules/acl_cli_spaces.vtc b/reg-tests/http-rules/acl_cli_spaces.vtc new file mode 100644 index 000000000..fcae0c472 --- /dev/null +++ b/reg-tests/http-rules/acl_cli_spaces.vtc @@ -0,0 +1,52 @@ +varnishtest "haproxy ACL, CLI and spaces" +feature ignore_unknown_macro + +#REQUIRE_VERSION=1.6 + +server s1 { + rxreq + expect req.method == "GET" + txresp +} -repeat 2 -start + +haproxy h1 -conf { + defaults + mode http + ${no-htx} option http-use-htx + log global + option httplog + timeout connect 15ms + timeout client 20ms + timeout server 20ms + + frontend fe1 + bind "fd@${fe1}" + + http-request deny if { req.hdr(user-agent) -i -m str -f ${testdir}/agents.acl } + + default_backend be1 + + backend be1 + server s1 ${s1_addr}:${s1_port} + +} -start + +client c1 -connect ${h1_fe1_sock} { + txreq -hdr "User-Agent: Mon User Agent" + rxresp + expect resp.status == 200 +} -run + +haproxy h1 -cli { + send "add acl ${testdir}/agents.acl Mon\\ User\\ Agent\\;" + expect ~ .* + + send "show acl ${testdir}/agents.acl" + expect ~ ".*Mon User Agent.*" +} + +client c1 -connect ${h1_fe1_sock} { + txreq -hdr "User-Agent: Mon User Agent;" + rxresp + expect resp.status == 403 +} -run diff --git a/reg-tests/http-rules/agents.acl b/reg-tests/http-rules/agents.acl new file mode 100644 index 000000000..345e6aef7 --- /dev/null +++ b/reg-tests/http-rules/agents.acl @@ -0,0 +1 @@ +Test