File: unique-id-from-proxy.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 (41 lines) | stat: -rw-r--r-- 1,098 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
39
40
41
varnishtest "Check that we are able to read a unique-id from PROXYv2"

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 echo
        bind "fd@${fe1}" accept-proxy
        http-after-response set-header echo %[fc_pp_unique_id,hex]
        http-request return status 200
} -start

client c1 -connect ${h1_fe1_sock} {
    # PROXY v2 signature
    sendhex "0d 0a 0d 0a 00 0d 0a 51 55 49 54 0a"
    # version + PROXY
    sendhex "21"
    # TCP4
    sendhex "11"
    # length of the address (12) + length of the TLV (8)
    sendhex "00 14"
    # 127.0.0.1 42 127.0.0.1 1337
    sendhex "7F 00 00 01 7F 00 00 01 00 2A 05 39"
    # PP2_TYPE_UNIQUE_ID + length of the value + "12345"
    sendhex "05 00 05 31 32 33 34 35"

    txreq -url "/"
    rxresp
    expect resp.status == 200
    expect resp.http.echo == "3132333435"
} -run