Tim Duesterhus | d1b15b6 | 2020-03-13 12:34:23 +0100 | [diff] [blame] | 1 | varnishtest "Check that we are able to read a unique-id from PROXYv2" |
| 2 | |
| 3 | #REQUIRE_VERSION=2.2 |
| 4 | |
| 5 | feature ignore_unknown_macro |
| 6 | |
| 7 | haproxy h1 -conf { |
| 8 | defaults |
| 9 | mode http |
Willy Tarreau | f673923 | 2021-11-18 17:46:22 +0100 | [diff] [blame] | 10 | timeout connect "${HAPROXY_TEST_TIMEOUT-5s}" |
| 11 | timeout client "${HAPROXY_TEST_TIMEOUT-5s}" |
| 12 | timeout server "${HAPROXY_TEST_TIMEOUT-5s}" |
Tim Duesterhus | d1b15b6 | 2020-03-13 12:34:23 +0100 | [diff] [blame] | 13 | |
| 14 | frontend echo |
| 15 | bind "fd@${fe1}" accept-proxy |
| 16 | http-after-response set-header echo %[fc_pp_unique_id,hex] |
| 17 | http-request return status 200 |
| 18 | } -start |
| 19 | |
| 20 | client c1 -connect ${h1_fe1_sock} { |
| 21 | # PROXY v2 signature |
| 22 | sendhex "0d 0a 0d 0a 00 0d 0a 51 55 49 54 0a" |
| 23 | # version + PROXY |
| 24 | sendhex "21" |
| 25 | # TCP4 |
| 26 | sendhex "11" |
| 27 | # length of the address (12) + length of the TLV (8) |
| 28 | sendhex "00 14" |
| 29 | # 127.0.0.1 42 127.0.0.1 1337 |
| 30 | sendhex "7F 00 00 01 7F 00 00 01 00 2A 05 39" |
| 31 | # PP2_TYPE_UNIQUE_ID + length of the value + "12345" |
| 32 | sendhex "05 00 05 31 32 33 34 35" |
| 33 | |
| 34 | txreq -url "/" |
| 35 | rxresp |
| 36 | expect resp.status == 200 |
| 37 | expect resp.http.echo == "3132333435" |
| 38 | } -run |