File: acl.vtc

package info (click to toggle)
haproxy 3.3.0-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 24,584 kB
  • sloc: ansic: 275,085; sh: 3,607; xml: 1,756; python: 1,345; makefile: 1,162; perl: 168; cpp: 21
file content (38 lines) | stat: -rw-r--r-- 1,025 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
varnishtest "Test acl() sample fetch"
feature cmd "$HAPROXY_PROGRAM -cc 'version_atleast(2.9-dev2)'"

feature ignore_unknown_macro

haproxy h1 -conf {
    global
    .if feature(THREAD)
        thread-groups 1
    .endif

    defaults
        mode http
        timeout connect "${HAPROXY_TEST_TIMEOUT-5s}"
        timeout client  "${HAPROXY_TEST_TIMEOUT-5s}"
        timeout server  "${HAPROXY_TEST_TIMEOUT-5s}"

    frontend fe1
        bind "fd@${fe1}"

        acl ACL1 always_true
        acl ACL2 acl(ACL1)
        acl ACL3 acl(!ACL2)
        acl ACL4 acl(ACL2,!ACL3)

        http-request return status 200 hdr x-acl "ACL1=%[acl(ACL1)] ACL2=%[acl(ACL2)] ACL3=%[acl(ACL3)] ACL4=%[acl(ACL4)] TRUE=%[acl(TRUE)]"
} -start

client c1 -connect ${h1_fe1_sock} {
    txreq -req GET -url /
    rxresp
    expect resp.status == 200
    expect resp.http.x-acl ~ "ACL1=1"
    expect resp.http.x-acl ~ "ACL2=1"
    expect resp.http.x-acl ~ "ACL3=0"
    expect resp.http.x-acl ~ "ACL4=1"
    expect resp.http.x-acl ~ "TRUE=1"
} -run