Mercurial > hg > nginx-tests
annotate proxy_protocol2_tlv.t @ 1803:4627e750efdd
Tests: removed rewrite dependency in proxy_protocol2_tlv.t.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Thu, 10 Nov 2022 16:40:05 +0400 |
parents | 506e1a716fe8 |
children | 35e88bf538c1 |
rev | line source |
---|---|
1800
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
1 #!/usr/bin/perl |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
2 |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
3 # (C) Roman Arutyunyan |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
4 # (C) Eugene Grebenschikov |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
5 # (C) Nginx, Inc. |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
6 |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
7 # Tests for variables for proxy protocol v2 TLVs. |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
8 |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
9 ############################################################################### |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
10 |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
11 use warnings; |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
12 use strict; |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
13 |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
14 use Test::More; |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
15 |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
16 BEGIN { use FindBin; chdir($FindBin::Bin); } |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
17 |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
18 use lib 'lib'; |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
19 use Test::Nginx; |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
20 |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
21 ############################################################################### |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
22 |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
23 select STDERR; $| = 1; |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
24 select STDOUT; $| = 1; |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
25 |
1803
4627e750efdd
Tests: removed rewrite dependency in proxy_protocol2_tlv.t.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1802
diff
changeset
|
26 my $t = Test::Nginx->new()->has(qw/http map/) |
1800
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
27 ->write_file_expand('nginx.conf', <<'EOF'); |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
28 |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
29 %%TEST_GLOBALS%% |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
30 |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
31 daemon off; |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
32 |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
33 events { |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
34 } |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
35 |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
36 http { |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
37 %%TEST_GLOBALS_HTTP%% |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
38 |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
39 map $proxy_protocol_tlv_ssl $binary_present { |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
40 "~\\x00" "true"; |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
41 } |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
42 |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
43 add_header X-ALPN |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
44 $proxy_protocol_tlv_alpn-$proxy_protocol_tlv_0x01; |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
45 add_header X-AUTHORITY |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
46 $proxy_protocol_tlv_authority-$proxy_protocol_tlv_0x02; |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
47 add_header X-UNIQUE-ID |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
48 $proxy_protocol_tlv_unique_id-$proxy_protocol_tlv_0x05; |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
49 add_header X-NETNS |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
50 $proxy_protocol_tlv_netns-$proxy_protocol_tlv_0x30; |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
51 add_header X-SSL-VERIFY |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
52 $proxy_protocol_tlv_ssl_verify; |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
53 add_header X-SSL-VERSION |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
54 $proxy_protocol_tlv_ssl_version-$proxy_protocol_tlv_ssl_0x21; |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
55 add_header X-SSL-CN |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
56 $proxy_protocol_tlv_ssl_cn-$proxy_protocol_tlv_ssl_0x22; |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
57 add_header X-SSL-CIPHER |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
58 $proxy_protocol_tlv_ssl_cipher-$proxy_protocol_tlv_ssl_0x23; |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
59 add_header X-SSL-SIG-ALG |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
60 $proxy_protocol_tlv_ssl_sig_alg-$proxy_protocol_tlv_ssl_0x24; |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
61 add_header X-SSL-KEY-ALG |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
62 $proxy_protocol_tlv_ssl_key_alg-$proxy_protocol_tlv_ssl_0x25; |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
63 add_header X-TLV-CRC32C |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
64 $proxy_protocol_tlv_0x3; |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
65 add_header X-TLV-CUSTOM |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
66 $proxy_protocol_tlv_0x000ae; |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
67 add_header X-TLV-X |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
68 $proxy_protocol_tlv_0x000e-$proxy_protocol_tlv_0x0f; |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
69 add_header X-SSL-BINARY |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
70 $binary_present; |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
71 |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
72 server { |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
73 listen 127.0.0.1:8080 proxy_protocol; |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
74 server_name localhost; |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
75 |
1803
4627e750efdd
Tests: removed rewrite dependency in proxy_protocol2_tlv.t.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1802
diff
changeset
|
76 location / { } |
1800
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
77 } |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
78 } |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
79 |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
80 EOF |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
81 |
1803
4627e750efdd
Tests: removed rewrite dependency in proxy_protocol2_tlv.t.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1802
diff
changeset
|
82 $t->write_file('t1', 'SEE-THIS'); |
4627e750efdd
Tests: removed rewrite dependency in proxy_protocol2_tlv.t.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1802
diff
changeset
|
83 |
1801
f129b693d83e
Tests: skip proxy_protocol2_tlv.t for nginx stable.
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
1800
diff
changeset
|
84 plan(skip_all => 'not yet') unless $t->has_version('1.23.2'); |
f129b693d83e
Tests: skip proxy_protocol2_tlv.t for nginx stable.
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
1800
diff
changeset
|
85 $t->plan(15); |
f129b693d83e
Tests: skip proxy_protocol2_tlv.t for nginx stable.
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
1800
diff
changeset
|
86 |
1800
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
87 $t->run(); |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
88 |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
89 ############################################################################### |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
90 |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
91 my $p = pack("N3C", 0x0D0A0D0A, 0x000D0A51, 0x5549540A, 0x21); |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
92 my $tlv = $p . pack("CnN2n2N21nN2nN2nN4", 0x11, 134, 0xc0000201, 0xc0000202, |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
93 123, 5678, |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
94 # 0x01 alpn |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
95 0x01000541, 0x4c504e31, |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
96 # 0x02 authority |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
97 0x0200096c, 0x6f63616c, 0x686f7374, |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
98 # 0x03 crc32 |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
99 0x03000534, 0x33323130, |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
100 # 0x05 unique_id |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
101 0x05000555, 0x4e495151, |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
102 # 0x20 ssl |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
103 0x20004301, 0x000000ff, |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
104 # 0x21 ssl_version |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
105 0x21000132, |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
106 # 0x22 ssl_cn |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
107 0x22000541, 0x42433435, |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
108 # 0x23 ssl_cipher |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
109 0x23001b45, 0x43444845, 0x2d525341, 0x2d414553, 0x3132382d, 0x47434d2d, |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
110 0x53484132, 0x3536, |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
111 # 0x24 ssl_sig_alg |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
112 0x24000753, 0x48413130, 0x3234, |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
113 # 0x25 ssl_key_alg |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
114 0x25000752, 0x53413230, 0x3438, |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
115 # 0x30 netns |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
116 0x3000054e, 0x45544e53, |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
117 # 0xae custom |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
118 0xae000531, 0x32333435); |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
119 my $r; |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
120 |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
121 $r = pp_get('/t1', $tlv); |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
122 like($r, qr/X-ALPN: ALPN1-ALPN1\x0d/, 'ALPN - tlv named variable'); |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
123 like($r, qr/X-AUTHORITY: localhost-localhost\x0d/, |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
124 'AUTHORITY - tlv named variable'); |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
125 like($r, qr/X-UNIQUE-ID: UNIQQ-UNIQQ\x0d/, 'UNIQUE_ID - tlv named variable'); |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
126 like($r, qr/X-NETNS: NETNS-NETNS\x0d/, 'NETNS - tlv named variable'); |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
127 like($r, qr/X-SSL-BINARY: true/, 'SSL_BINARY - tlv named variable'); |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
128 like($r, qr/X-SSL-VERIFY: 255\x0d/, 'SSL_VERIFY - tlv named variable'); |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
129 like($r, qr/X-SSL-VERSION: 2-2\x0d/, 'SSL_VERSION - tlv named variable'); |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
130 like($r, qr/X-SSL-CN: ABC45-ABC45\x0d/, 'SSL_CN - tlv named variable'); |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
131 like($r, qr/X-SSL-CIPHER: ECDHE-RSA-AES128-GCM-SHA256/, |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
132 'SSL_CIPHER - tlv named variable (part 1)'); |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
133 like ($r, qr/-ECDHE-RSA-AES128-GCM-SHA256\x0d/, |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
134 'SSL_CIPHER - tlv named variable (part 2)'); |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
135 like($r, qr/X-SSL-SIG-ALG: SHA1024-SHA1024\x0d/, |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
136 'SSL_SIG_ALG - tlv named variable'); |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
137 like($r, qr/X-SSL-KEY-ALG: RSA2048-RSA2048\x0d/, |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
138 'SSL_KEY_ALG - tlv named variable'); |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
139 like($r, qr/X-TLV-CRC32C: 43210\x0d/, 'CRC32C - tlv numeric variable'); |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
140 like($r, qr/X-TLV-CUSTOM: 12345\x0d/, |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
141 'custom - tlv numeric variable'); |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
142 like($r, qr/X-TLV-X: -\x0d/, 'non-existent - tlv numeric variable'); |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
143 |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
144 ############################################################################### |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
145 |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
146 sub pp_get { |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
147 my ($url, $proxy) = @_; |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
148 return http($proxy . <<EOF); |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
149 GET $url HTTP/1.0 |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
150 Host: localhost |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
151 |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
152 EOF |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
153 } |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
154 |
074974eb9182
Tests: variables for proxy protocol v2 TLVs
Eugene Grebenschikov <e.grebenshchikov@f5.com>
parents:
diff
changeset
|
155 ############################################################################### |