Mercurial > hg > nginx-tests
annotate proxy_protocol_server.t @ 1619:436d0ffc2ea3
Tests: correctly shutdown ssl for reproducible session reuse tests.
Previously, session reuse tests in stream_ssl_certificate.t were prone
to testing errors, since the client doesn't write any application data
before closing a connection, which is done so to pass tests on win32.
In this case, the server may happened to get an unexpected eof meaning
that it will abandon that session. This is specific to stream testing
pattern, changes to ssl_certificate.t are applied too for consistency.
This is also specific to SSL_R_UNEXPECTED_EOF_WHILE_READING, which is
implemented in OpenSSL 3.0.0.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Mon, 23 Nov 2020 22:46:06 +0000 |
parents | 7676944968c1 |
children | 5ac6efbe5552 |
rev | line source |
---|---|
1527
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
1 #!/usr/bin/perl |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
2 |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
3 # (C) Sergey Kandaurov |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
4 # (C) Nginx, Inc. |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
5 |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
6 # Tests for haproxy protocol. |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
7 |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
8 ############################################################################### |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
9 |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
10 use warnings; |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
11 use strict; |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
12 |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
13 use Test::More; |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
14 |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
15 use Socket qw/ CRLF /; |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
16 |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
17 BEGIN { use FindBin; chdir($FindBin::Bin); } |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
18 |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
19 use lib 'lib'; |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
20 use Test::Nginx; |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
21 |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
22 ############################################################################### |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
23 |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
24 select STDERR; $| = 1; |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
25 select STDOUT; $| = 1; |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
26 |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
27 my $t = Test::Nginx->new()->has(qw/http access realip/); |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
28 |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
29 $t->write_file_expand('nginx.conf', <<'EOF'); |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
30 |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
31 %%TEST_GLOBALS%% |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
32 |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
33 daemon off; |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
34 |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
35 events { |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
36 } |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
37 |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
38 http { |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
39 %%TEST_GLOBALS_HTTP%% |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
40 |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
41 log_format pp $remote_addr:$remote_port; |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
42 |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
43 add_header X-IP $remote_addr!$remote_port; |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
44 add_header X-PP $proxy_protocol_addr!$proxy_protocol_port; |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
45 add_header X-PPS $proxy_protocol_server_addr!$proxy_protocol_server_port; |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
46 |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
47 server { |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
48 listen 127.0.0.1:8080 proxy_protocol; |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
49 server_name localhost; |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
50 |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
51 set_real_ip_from 127.0.0.1/32; |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
52 |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
53 location /pp { |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
54 real_ip_header proxy_protocol; |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
55 error_page 404 =200 /t1; |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
56 |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
57 location /pp_4 { |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
58 deny 192.0.2.1/32; |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
59 access_log %%TESTDIR%%/pp4.log pp; |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
60 } |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
61 |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
62 location /pp_6 { |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
63 deny 2001:DB8::1/128; |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
64 access_log %%TESTDIR%%/pp6.log pp; |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
65 } |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
66 } |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
67 |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
68 location / { } |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
69 } |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
70 } |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
71 |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
72 EOF |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
73 |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
74 $t->write_file('t1', 'SEE-THIS'); |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
75 $t->try_run('no proxy_protocol_server_addr')->plan(24); |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
76 |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
77 ############################################################################### |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
78 |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
79 my $tcp4 = 'PROXY TCP4 192.0.2.1 192.0.2.2 123 567' . CRLF; |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
80 my $tcp6 = 'PROXY TCP6 2001:Db8::1 2001:Db8::2 123 567' . CRLF; |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
81 my $unk1 = 'PROXY UNKNOWN' . CRLF; |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
82 my $unk2 = 'PROXY UNKNOWN 1 2 3 4 5 6' . CRLF; |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
83 my $r; |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
84 |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
85 # no realip, just PROXY header parsing |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
86 |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
87 $r = pp_get('/t1', $tcp4); |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
88 like($r, qr/SEE-THIS/, 'tcp4 request'); |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
89 like($r, qr/X-PP: 192.0.2.1!123\x0d/, 'tcp4 proxy'); |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
90 like($r, qr/X-PPS: 192.0.2.2!567\x0d/, 'tcp4 proxy server'); |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
91 unlike($r, qr/X-IP: (192.0.2.1|[^!]+!123\x0d)/, 'tcp4 client'); |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
92 |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
93 $r = pp_get('/t1', $tcp6); |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
94 like($r, qr/SEE-THIS/, 'tcp6 request'); |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
95 like($r, qr/X-PP: 2001:DB8::1!123\x0d/i, 'tcp6 proxy'); |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
96 like($r, qr/X-PPS: 2001:DB8::2!567\x0d/i, 'tcp6 proxy server'); |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
97 unlike($r, qr/X-IP: (2001:DB8::1|[^!]+!123\x0d)/i, 'tcp6 client'); |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
98 |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
99 $r = pp_get('/t1', $unk1); |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
100 like($r, qr/SEE-THIS/, 'unknown request 1'); |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
101 like($r, qr/X-PP: !\x0d/, 'unknown proxy 1'); |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
102 like($r, qr/X-PPS: !\x0d/, 'unknown proxy server 1'); |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
103 |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
104 $r = pp_get('/t1', $unk2); |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
105 like($r, qr/SEE-THIS/, 'unknown request 2'); |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
106 like($r, qr/X-PP: !\x0d/, 'unknown proxy 2'); |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
107 like($r, qr/X-PPS: !\x0d/, 'unknown proxy server 2'); |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
108 |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
109 # realip |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
110 |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
111 $r = pp_get('/pp', $tcp4); |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
112 like($r, qr/SEE-THIS/, 'tcp4 request realip'); |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
113 like($r, qr/X-PP: 192.0.2.1!123\x0d/, 'tcp4 proxy realip'); |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
114 like($r, qr/X-IP: 192.0.2.1!123\x0d/, 'tcp4 client realip'); |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
115 |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
116 $r = pp_get('/pp', $tcp6); |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
117 like($r, qr/SEE-THIS/, 'tcp6 request realip'); |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
118 like($r, qr/X-PP: 2001:DB8::1!123\x0d/i, 'tcp6 proxy realip'); |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
119 like($r, qr/X-IP: 2001:DB8::1!123\x0d/i, 'tcp6 client realip'); |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
120 |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
121 # access |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
122 |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
123 $r = pp_get('/pp_4', $tcp4); |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
124 like($r, qr/403 Forbidden/, 'tcp4 access'); |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
125 |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
126 $r = pp_get('/pp_6', $tcp6); |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
127 like($r, qr/403 Forbidden/, 'tcp6 access'); |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
128 |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
129 # client address in access.log |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
130 |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
131 $t->stop(); |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
132 |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
133 is($t->read_file('pp4.log'), "192.0.2.1:123\n", 'tcp4 log'); |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
134 is($t->read_file('pp6.log'), "2001:db8::1:123\n", 'tcp6 log'); |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
135 |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
136 ############################################################################### |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
137 |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
138 sub pp_get { |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
139 my ($url, $proxy) = @_; |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
140 return http($proxy . <<EOF); |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
141 GET $url HTTP/1.0 |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
142 Host: localhost |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
143 |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
144 EOF |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
145 } |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
146 |
7676944968c1
Tests: proxy protocol server variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
147 ############################################################################### |