Mercurial > hg > nginx-tests
annotate proxy_protocol.t @ 1526:b3bbb59dc324
Tests: merged $proxy_protocol_port tests with the rest for brevity.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Thu, 24 Oct 2019 15:00:27 +0300 |
parents | cf14cfe9ec8c |
children | 64f19063adfe |
rev | line source |
---|---|
381
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
1 #!/usr/bin/perl |
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
2 |
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
3 # (C) Sergey Kandaurov |
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
4 # (C) Nginx, Inc. |
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
5 |
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
6 # Tests for haproxy protocol. |
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
7 |
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
8 ############################################################################### |
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
9 |
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
10 use warnings; |
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
11 use strict; |
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
12 |
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
13 use Test::More; |
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
14 |
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
15 use Socket qw/ CRLF /; |
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
16 |
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
17 BEGIN { use FindBin; chdir($FindBin::Bin); } |
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
18 |
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
19 use lib 'lib'; |
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
20 use Test::Nginx; |
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
21 |
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
22 ############################################################################### |
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
23 |
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
24 select STDERR; $| = 1; |
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
25 select STDOUT; $| = 1; |
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
26 |
1170
cf14cfe9ec8c
Tests: dropped obsolete ipv6 prerequisite.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
27 my $t = Test::Nginx->new()->has(qw/http access realip/); |
381
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
28 |
1526
b3bbb59dc324
Tests: merged $proxy_protocol_port tests with the rest for brevity.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1170
diff
changeset
|
29 $t->write_file_expand('nginx.conf', <<'EOF')->plan(20); |
381
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
30 |
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
31 %%TEST_GLOBALS%% |
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
32 |
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
33 daemon off; |
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
34 |
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
35 events { |
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
36 } |
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
37 |
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
38 http { |
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
39 %%TEST_GLOBALS_HTTP%% |
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
40 |
1526
b3bbb59dc324
Tests: merged $proxy_protocol_port tests with the rest for brevity.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1170
diff
changeset
|
41 log_format pp $remote_addr:$remote_port; |
381
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
42 |
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
43 server { |
974
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
952
diff
changeset
|
44 listen 127.0.0.1:8080 proxy_protocol; |
381
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
45 server_name localhost; |
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
46 |
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
47 set_real_ip_from 127.0.0.1/32; |
1526
b3bbb59dc324
Tests: merged $proxy_protocol_port tests with the rest for brevity.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1170
diff
changeset
|
48 add_header X-IP $remote_addr!$remote_port; |
b3bbb59dc324
Tests: merged $proxy_protocol_port tests with the rest for brevity.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1170
diff
changeset
|
49 add_header X-PP $proxy_protocol_addr!$proxy_protocol_port; |
381
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
50 |
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
51 location /pp { |
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
52 real_ip_header proxy_protocol; |
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
53 error_page 404 =200 /t1; |
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
54 |
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
55 location /pp_4 { |
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
56 deny 192.0.2.1/32; |
1526
b3bbb59dc324
Tests: merged $proxy_protocol_port tests with the rest for brevity.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1170
diff
changeset
|
57 access_log %%TESTDIR%%/pp4.log pp; |
381
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
58 } |
1526
b3bbb59dc324
Tests: merged $proxy_protocol_port tests with the rest for brevity.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1170
diff
changeset
|
59 |
381
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
60 location /pp_6 { |
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
61 deny 2001:DB8::1/128; |
1526
b3bbb59dc324
Tests: merged $proxy_protocol_port tests with the rest for brevity.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1170
diff
changeset
|
62 access_log %%TESTDIR%%/pp6.log pp; |
381
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
63 } |
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
64 } |
1526
b3bbb59dc324
Tests: merged $proxy_protocol_port tests with the rest for brevity.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1170
diff
changeset
|
65 |
b3bbb59dc324
Tests: merged $proxy_protocol_port tests with the rest for brevity.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1170
diff
changeset
|
66 location / { } |
381
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
67 } |
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
68 } |
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
69 |
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
70 EOF |
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
71 |
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
72 $t->write_file('t1', 'SEE-THIS'); |
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
73 $t->run(); |
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
74 |
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
75 ############################################################################### |
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
76 |
1526
b3bbb59dc324
Tests: merged $proxy_protocol_port tests with the rest for brevity.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1170
diff
changeset
|
77 my $tcp4 = 'PROXY TCP4 192.0.2.1 192.0.2.2 123 5678' . CRLF; |
b3bbb59dc324
Tests: merged $proxy_protocol_port tests with the rest for brevity.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1170
diff
changeset
|
78 my $tcp6 = 'PROXY TCP6 2001:Db8::1 2001:Db8::2 123 5678' . CRLF; |
381
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
79 my $unk1 = 'PROXY UNKNOWN' . CRLF; |
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
80 my $unk2 = 'PROXY UNKNOWN 1 2 3 4 5 6' . CRLF; |
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
81 my $r; |
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
82 |
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
83 # no realip, just PROXY header parsing |
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
84 |
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
85 $r = pp_get('/t1', $tcp4); |
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
86 like($r, qr/SEE-THIS/, 'tcp4 request'); |
1526
b3bbb59dc324
Tests: merged $proxy_protocol_port tests with the rest for brevity.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1170
diff
changeset
|
87 like($r, qr/X-PP: 192.0.2.1!123\x0d/, 'tcp4 proxy'); |
b3bbb59dc324
Tests: merged $proxy_protocol_port tests with the rest for brevity.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1170
diff
changeset
|
88 unlike($r, qr/X-IP: (192.0.2.1|[^!]+!123\x0d)/, 'tcp4 client'); |
381
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
89 |
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
90 $r = pp_get('/t1', $tcp6); |
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
91 like($r, qr/SEE-THIS/, 'tcp6 request'); |
1526
b3bbb59dc324
Tests: merged $proxy_protocol_port tests with the rest for brevity.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1170
diff
changeset
|
92 like($r, qr/X-PP: 2001:DB8::1!123\x0d/i, 'tcp6 proxy'); |
b3bbb59dc324
Tests: merged $proxy_protocol_port tests with the rest for brevity.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1170
diff
changeset
|
93 unlike($r, qr/X-IP: (2001:DB8::1|[^!]+!123\x0d)/i, 'tcp6 client'); |
381
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
94 |
1526
b3bbb59dc324
Tests: merged $proxy_protocol_port tests with the rest for brevity.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1170
diff
changeset
|
95 $r = pp_get('/t1', $unk1); |
b3bbb59dc324
Tests: merged $proxy_protocol_port tests with the rest for brevity.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1170
diff
changeset
|
96 like($r, qr/SEE-THIS/, 'unknown request 1'); |
b3bbb59dc324
Tests: merged $proxy_protocol_port tests with the rest for brevity.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1170
diff
changeset
|
97 like($r, qr/X-PP: !\x0d/, 'unknown proxy 1'); |
b3bbb59dc324
Tests: merged $proxy_protocol_port tests with the rest for brevity.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1170
diff
changeset
|
98 |
b3bbb59dc324
Tests: merged $proxy_protocol_port tests with the rest for brevity.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1170
diff
changeset
|
99 $r = pp_get('/t1', $unk2); |
b3bbb59dc324
Tests: merged $proxy_protocol_port tests with the rest for brevity.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1170
diff
changeset
|
100 like($r, qr/SEE-THIS/, 'unknown request 2'); |
b3bbb59dc324
Tests: merged $proxy_protocol_port tests with the rest for brevity.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1170
diff
changeset
|
101 like($r, qr/X-PP: !\x0d/, 'unknown proxy 2'); |
381
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
102 |
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
103 # realip |
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
104 |
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
105 $r = pp_get('/pp', $tcp4); |
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
106 like($r, qr/SEE-THIS/, 'tcp4 request realip'); |
1526
b3bbb59dc324
Tests: merged $proxy_protocol_port tests with the rest for brevity.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1170
diff
changeset
|
107 like($r, qr/X-PP: 192.0.2.1!123\x0d/, 'tcp4 proxy realip'); |
b3bbb59dc324
Tests: merged $proxy_protocol_port tests with the rest for brevity.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1170
diff
changeset
|
108 like($r, qr/X-IP: 192.0.2.1!123\x0d/, 'tcp4 client realip'); |
381
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
109 |
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
110 $r = pp_get('/pp', $tcp6); |
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
111 like($r, qr/SEE-THIS/, 'tcp6 request realip'); |
1526
b3bbb59dc324
Tests: merged $proxy_protocol_port tests with the rest for brevity.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1170
diff
changeset
|
112 like($r, qr/X-PP: 2001:DB8::1!123\x0d/i, 'tcp6 proxy realip'); |
b3bbb59dc324
Tests: merged $proxy_protocol_port tests with the rest for brevity.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1170
diff
changeset
|
113 like($r, qr/X-IP: 2001:DB8::1!123\x0d/i, 'tcp6 client realip'); |
381
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
114 |
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
115 # access |
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
116 |
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
117 $r = pp_get('/pp_4', $tcp4); |
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
118 like($r, qr/403 Forbidden/, 'tcp4 access'); |
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
119 |
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
120 $r = pp_get('/pp_6', $tcp6); |
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
121 like($r, qr/403 Forbidden/, 'tcp6 access'); |
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
122 |
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
123 # client address in access.log |
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
124 |
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
125 $t->stop(); |
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
126 |
1526
b3bbb59dc324
Tests: merged $proxy_protocol_port tests with the rest for brevity.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1170
diff
changeset
|
127 is($t->read_file('pp4.log'), "192.0.2.1:123\n", 'tcp4 log'); |
b3bbb59dc324
Tests: merged $proxy_protocol_port tests with the rest for brevity.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1170
diff
changeset
|
128 is($t->read_file('pp6.log'), "2001:db8::1:123\n", 'tcp6 log'); |
381
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
129 |
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
130 ############################################################################### |
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
131 |
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
132 sub pp_get { |
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
133 my ($url, $proxy) = @_; |
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
134 return http($proxy . <<EOF); |
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
135 GET $url HTTP/1.0 |
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
136 Host: localhost |
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
137 |
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
138 EOF |
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
139 } |
527
a36290485719
Tests: whitespace fix.
Sergey Kandaurov <pluknet@nginx.com>
parents:
397
diff
changeset
|
140 |
381
056d0ad0ef03
Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
141 ############################################################################### |