]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
REGTEST: http-rules: test spaces in ACLs with master CLI
authorWilliam Lallemand <wlallemand@haproxy.com>
Thu, 18 Jun 2020 16:56:44 +0000 (18:56 +0200)
committerWilliam Lallemand <wlallemand@haproxy.org>
Fri, 19 Jun 2020 12:32:55 +0000 (14:32 +0200)
Do the tests for spaces on the CLI with the master CLI.

Could be backported as far as 2.0 once the required patches are applied.

reg-tests/http-rules/acl_cli_spaces.vtc

index fcae0c47223865af1831444a4539f40c6f5f5091..e67f7ce5a5b087e16707db69557e0644d166eff6 100644 (file)
@@ -1,7 +1,7 @@
-varnishtest "haproxy ACL, CLI and spaces"
+varnishtest "haproxy ACL, CLI and mCLI spaces"
 feature ignore_unknown_macro
 
-#REQUIRE_VERSION=1.6
+#REQUIRE_VERSION=2.0
 
 server s1 {
    rxreq
@@ -9,7 +9,7 @@ server s1 {
    txresp
 } -repeat 2 -start
 
-haproxy h1 -conf {
+haproxy h1 -W -S -conf {
   defaults
     mode http
     ${no-htx} option http-use-htx
@@ -50,3 +50,31 @@ client c1 -connect ${h1_fe1_sock} {
     rxresp
     expect resp.status == 403
 } -run
+
+
+haproxy h1 -cli {
+  send "del acl ${testdir}/agents.acl Mon\\ User\\ Agent\\;"
+  expect ~ .*
+
+  send "show acl ${testdir}/agents.acl"
+  expect ~ .*
+}
+
+client c1 -connect ${h1_fe1_sock} {
+    txreq -hdr "User-Agent: Mon User Agent;"
+    rxresp
+    expect resp.status == 200
+} -run
+
+
+# Try it with the master CLI
+haproxy h1 -mcli {
+  send "@1 add acl ${testdir}/agents.acl Mon\\ User\\ Agent\\;;@1 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