annotate proxy_protocol.t @ 1982:fb25cbe9d4ec default tip

Tests: explicit Valgrind support. Valgrind logging is done to a separate file, as it is not able to follow stderr redirection within nginx or append to a file without corrupting it. Further, Valgrind logging seems to interfere with error suppression in tests, and catches various startup errors and warnings, so the log is additionally filtered. Since startup under Valgrind can be really slow, timeout in waitforfile() was changed to 10 seconds. Prodded by Robert Mueller.
author Maxim Dounin <mdounin@mdounin.ru>
date Fri, 31 May 2024 06:23:00 +0300
parents 88a098b00534
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
1794
64f19063adfe Tests: merged tests for proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1526
diff changeset
29 $t->write_file_expand('nginx.conf', <<'EOF')->plan(24);
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
1794
64f19063adfe Tests: merged tests for proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1526
diff changeset
43 add_header X-IP $remote_addr!$remote_port;
64f19063adfe Tests: merged tests for proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1526
diff changeset
44 add_header X-PP $proxy_protocol_addr!$proxy_protocol_port;
64f19063adfe Tests: merged tests for proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1526
diff changeset
45 add_header X-PPS $proxy_protocol_server_addr!$proxy_protocol_server_port;
64f19063adfe Tests: merged tests for proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1526
diff changeset
46
381
056d0ad0ef03 Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
47 server {
974
882267679006 Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents: 952
diff changeset
48 listen 127.0.0.1:8080 proxy_protocol;
381
056d0ad0ef03 Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
49 server_name localhost;
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 set_real_ip_from 127.0.0.1/32;
056d0ad0ef03 Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
52
056d0ad0ef03 Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
53 location /pp {
056d0ad0ef03 Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
54 real_ip_header proxy_protocol;
056d0ad0ef03 Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
55 error_page 404 =200 /t1;
056d0ad0ef03 Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
56
056d0ad0ef03 Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
57 location /pp_4 {
056d0ad0ef03 Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
58 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
59 access_log %%TESTDIR%%/pp4.log pp;
381
056d0ad0ef03 Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
60 }
1526
b3bbb59dc324 Tests: merged $proxy_protocol_port tests with the rest for brevity.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1170
diff changeset
61
381
056d0ad0ef03 Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
62 location /pp_6 {
056d0ad0ef03 Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
63 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
64 access_log %%TESTDIR%%/pp6.log pp;
381
056d0ad0ef03 Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
65 }
056d0ad0ef03 Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
66 }
1526
b3bbb59dc324 Tests: merged $proxy_protocol_port tests with the rest for brevity.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1170
diff changeset
67
b3bbb59dc324 Tests: merged $proxy_protocol_port tests with the rest for brevity.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1170
diff changeset
68 location / { }
381
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 }
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 EOF
056d0ad0ef03 Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
73
056d0ad0ef03 Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
74 $t->write_file('t1', 'SEE-THIS');
056d0ad0ef03 Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
75 $t->run();
056d0ad0ef03 Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
76
056d0ad0ef03 Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
77 ###############################################################################
056d0ad0ef03 Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
78
1526
b3bbb59dc324 Tests: merged $proxy_protocol_port tests with the rest for brevity.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1170
diff changeset
79 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
80 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
81 my $unk1 = 'PROXY UNKNOWN' . CRLF;
056d0ad0ef03 Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
82 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
83 my $r;
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 # no realip, just PROXY header parsing
056d0ad0ef03 Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
86
056d0ad0ef03 Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
87 $r = pp_get('/t1', $tcp4);
056d0ad0ef03 Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
88 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
89 like($r, qr/X-PP: 192.0.2.1!123\x0d/, 'tcp4 proxy');
1795
88a098b00534 Tests: fixed previous commit mismerge.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1794
diff changeset
90 like($r, qr/X-PPS: 192.0.2.2!5678\x0d/, 'tcp4 proxy server');
1526
b3bbb59dc324 Tests: merged $proxy_protocol_port tests with the rest for brevity.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1170
diff changeset
91 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
92
056d0ad0ef03 Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
93 $r = pp_get('/t1', $tcp6);
056d0ad0ef03 Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
94 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
95 like($r, qr/X-PP: 2001:DB8::1!123\x0d/i, 'tcp6 proxy');
1795
88a098b00534 Tests: fixed previous commit mismerge.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1794
diff changeset
96 like($r, qr/X-PPS: 2001:DB8::2!5678\x0d/i, 'tcp6 proxy server');
1526
b3bbb59dc324 Tests: merged $proxy_protocol_port tests with the rest for brevity.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1170
diff changeset
97 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
98
1526
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', $unk1);
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 1');
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 1');
1794
64f19063adfe Tests: merged tests for proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1526
diff changeset
102 like($r, qr/X-PPS: !\x0d/, 'unknown proxy server 1');
1526
b3bbb59dc324 Tests: merged $proxy_protocol_port tests with the rest for brevity.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1170
diff changeset
103
b3bbb59dc324 Tests: merged $proxy_protocol_port tests with the rest for brevity.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1170
diff changeset
104 $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
105 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
106 like($r, qr/X-PP: !\x0d/, 'unknown proxy 2');
1794
64f19063adfe Tests: merged tests for proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1526
diff changeset
107 like($r, qr/X-PPS: !\x0d/, 'unknown proxy server 2');
381
056d0ad0ef03 Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
108
056d0ad0ef03 Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
109 # realip
056d0ad0ef03 Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
110
056d0ad0ef03 Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
111 $r = pp_get('/pp', $tcp4);
056d0ad0ef03 Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
112 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
113 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
114 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
115
056d0ad0ef03 Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
116 $r = pp_get('/pp', $tcp6);
056d0ad0ef03 Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
117 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
118 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
119 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
120
056d0ad0ef03 Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
121 # 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 $r = pp_get('/pp_4', $tcp4);
056d0ad0ef03 Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
124 like($r, qr/403 Forbidden/, 'tcp4 access');
056d0ad0ef03 Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
125
056d0ad0ef03 Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
126 $r = pp_get('/pp_6', $tcp6);
056d0ad0ef03 Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
127 like($r, qr/403 Forbidden/, 'tcp6 access');
056d0ad0ef03 Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
128
056d0ad0ef03 Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
129 # client address in access.log
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 $t->stop();
056d0ad0ef03 Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
132
1526
b3bbb59dc324 Tests: merged $proxy_protocol_port tests with the rest for brevity.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1170
diff changeset
133 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
134 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
135
056d0ad0ef03 Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
136 ###############################################################################
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 sub pp_get {
056d0ad0ef03 Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
139 my ($url, $proxy) = @_;
056d0ad0ef03 Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
140 return http($proxy . <<EOF);
056d0ad0ef03 Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
141 GET $url HTTP/1.0
056d0ad0ef03 Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
142 Host: localhost
056d0ad0ef03 Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
143
056d0ad0ef03 Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
144 EOF
056d0ad0ef03 Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
145 }
527
a36290485719 Tests: whitespace fix.
Sergey Kandaurov <pluknet@nginx.com>
parents: 397
diff changeset
146
381
056d0ad0ef03 Tests: proxy protocol tests added.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
147 ###############################################################################