Mercurial > hg > nginx-tests
annotate proxy.t @ 1434:fc8341cf92a3
Tests: removed ngx_parse_inet6_url() "::" test from proxy.t.
It results in WSAEADDRNOTAVAIL on win32, be the connection errors detected,
which leads to connect() alert. On other systems, connect() is successful
but it uses the default port (80), which is out of documented ports range.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Thu, 24 Jan 2019 17:05:04 +0300 |
parents | 16a8962ff246 |
children | fbb90184102e |
rev | line source |
---|---|
42 | 1 #!/usr/bin/perl |
2 | |
3 # (C) Maxim Dounin | |
4 | |
5 # Tests for http proxy module. | |
6 | |
7 ############################################################################### | |
8 | |
9 use warnings; | |
10 use strict; | |
11 | |
121
8ac1faaddd2c
Tests: better handle various configure arguments.
Maxim Dounin <mdounin@mdounin.ru>
parents:
107
diff
changeset
|
12 use Test::More; |
42 | 13 |
924
54680c434afa
Tests: fixed proxy.t on platforms without IPv6 support.
Sergey Kandaurov <pluknet@nginx.com>
parents:
922
diff
changeset
|
14 use Socket; |
54680c434afa
Tests: fixed proxy.t on platforms without IPv6 support.
Sergey Kandaurov <pluknet@nginx.com>
parents:
922
diff
changeset
|
15 |
42 | 16 BEGIN { use FindBin; chdir($FindBin::Bin); } |
17 | |
18 use lib 'lib'; | |
19 use Test::Nginx; | |
20 | |
21 ############################################################################### | |
22 | |
23 select STDERR; $| = 1; | |
24 select STDOUT; $| = 1; | |
25 | |
1434
fc8341cf92a3
Tests: removed ngx_parse_inet6_url() "::" test from proxy.t.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1419
diff
changeset
|
26 my $t = Test::Nginx->new()->has(qw/http proxy/)->plan(30); |
42 | 27 |
28 $t->write_file_expand('nginx.conf', <<'EOF'); | |
29 | |
107
1c0ec30614c6
Tests: add TEST_GLOBALS and TEST_GLOBALS_HTTP config chunks.
Maxim Dounin <mdounin@mdounin.ru>
parents:
83
diff
changeset
|
30 %%TEST_GLOBALS%% |
1c0ec30614c6
Tests: add TEST_GLOBALS and TEST_GLOBALS_HTTP config chunks.
Maxim Dounin <mdounin@mdounin.ru>
parents:
83
diff
changeset
|
31 |
249
6a0d934950bc
Tests: remove extra spaces in "daemon off".
Maxim Dounin <mdounin@mdounin.ru>
parents:
166
diff
changeset
|
32 daemon off; |
42 | 33 |
34 events { | |
35 } | |
36 | |
37 http { | |
107
1c0ec30614c6
Tests: add TEST_GLOBALS and TEST_GLOBALS_HTTP config chunks.
Maxim Dounin <mdounin@mdounin.ru>
parents:
83
diff
changeset
|
38 %%TEST_GLOBALS_HTTP%% |
42 | 39 |
1419
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
40 log_format time '$upstream_connect_time:$upstream_header_time:' |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
41 '$upstream_response_time'; |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
42 |
802
eca9b1d19021
Tests: tests for host expansion to an explicit upstream.
Sergey Kandaurov <pluknet@nginx.com>
parents:
795
diff
changeset
|
43 upstream u { |
974
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
952
diff
changeset
|
44 server 127.0.0.1:8081; |
802
eca9b1d19021
Tests: tests for host expansion to an explicit upstream.
Sergey Kandaurov <pluknet@nginx.com>
parents:
795
diff
changeset
|
45 } |
eca9b1d19021
Tests: tests for host expansion to an explicit upstream.
Sergey Kandaurov <pluknet@nginx.com>
parents:
795
diff
changeset
|
46 |
1419
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
47 upstream u2 { |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
48 server 127.0.0.1:8081; |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
49 server 127.0.0.1:8081; |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
50 } |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
51 |
42 | 52 server { |
974
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
952
diff
changeset
|
53 listen 127.0.0.1:8080; |
42 | 54 server_name localhost; |
731
cf9183219c59
Tests: removed debugging leftover.
Sergey Kandaurov <pluknet@nginx.com>
parents:
717
diff
changeset
|
55 |
1419
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
56 add_header X-Connect $upstream_connect_time; |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
57 add_header X-Header $upstream_header_time; |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
58 add_header X-Response $upstream_response_time; |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
59 |
42 | 60 location / { |
974
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
952
diff
changeset
|
61 proxy_pass http://127.0.0.1:8081; |
42 | 62 proxy_read_timeout 1s; |
795
122cd3a82367
Tests: fixed 'proxy connect timeout' test timeouts on slow hosts.
Sergey Kandaurov <pluknet@nginx.com>
parents:
732
diff
changeset
|
63 proxy_connect_timeout 2s; |
42 | 64 } |
434 | 65 |
432
c1269426585d
Tests: test for implicit upstream with IP literal and variable.
Sergey Kandaurov <pluknet@nginx.com>
parents:
295
diff
changeset
|
66 location /var { |
434 | 67 proxy_pass http://$arg_b; |
68 proxy_read_timeout 1s; | |
1006
e4d5e7afb6e0
Tests: speed up proxy.t on win32.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
69 proxy_connect_timeout 2s; |
432
c1269426585d
Tests: test for implicit upstream with IP literal and variable.
Sergey Kandaurov <pluknet@nginx.com>
parents:
295
diff
changeset
|
70 } |
1079
cbc8641a204e
Tests: fixed "proxy connect timeout" http tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
1006
diff
changeset
|
71 |
cbc8641a204e
Tests: fixed "proxy connect timeout" http tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
1006
diff
changeset
|
72 location /timeout { |
cbc8641a204e
Tests: fixed "proxy connect timeout" http tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
1006
diff
changeset
|
73 proxy_pass http://127.0.0.1:8081; |
cbc8641a204e
Tests: fixed "proxy connect timeout" http tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
1006
diff
changeset
|
74 proxy_connect_timeout 2s; |
cbc8641a204e
Tests: fixed "proxy connect timeout" http tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
1006
diff
changeset
|
75 } |
1419
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
76 |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
77 location /time/ { |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
78 proxy_pass http://127.0.0.1:8081/; |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
79 access_log %%TESTDIR%%/time.log time; |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
80 } |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
81 |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
82 location /pnu { |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
83 proxy_pass http://u2/bad; |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
84 } |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
85 |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
86 location /vars { |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
87 proxy_pass http://127.0.0.1:8080/stub; |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
88 |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
89 add_header X-Proxy-Host $proxy_host; |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
90 add_header X-Proxy-Port $proxy_port; |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
91 add_header X-Proxy-Forwarded $proxy_add_x_forwarded_for; |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
92 } |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
93 |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
94 location /stub { } |
42 | 95 } |
96 } | |
97 | |
98 EOF | |
99 | |
1419
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
100 $t->write_file('stub', ''); |
42 | 101 $t->run_daemon(\&http_daemon); |
974
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
952
diff
changeset
|
102 $t->run()->waitforsocket('127.0.0.1:' . port(8081)); |
42 | 103 |
104 ############################################################################### | |
105 | |
106 like(http_get('/'), qr/SEE-THIS/, 'proxy request'); | |
107 like(http_get('/multi'), qr/AND-THIS/, 'proxy request with multiple packets'); | |
108 | |
109 unlike(http_head('/'), qr/SEE-THIS/, 'proxy head request'); | |
110 | |
974
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
952
diff
changeset
|
111 like(http_get('/var?b=127.0.0.1:' . port(8081) . '/'), qr/SEE-THIS/, |
952
e9064d691790
Tests: converted tests to run in parallel.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
924
diff
changeset
|
112 'proxy with variables'); |
802
eca9b1d19021
Tests: tests for host expansion to an explicit upstream.
Sergey Kandaurov <pluknet@nginx.com>
parents:
795
diff
changeset
|
113 like(http_get('/var?b=u/'), qr/SEE-THIS/, 'proxy with variables to upstream'); |
922
93d900bac201
Tests: added regression test for proxy with no IPv6 port specified.
Sergey Kandaurov <pluknet@nginx.com>
parents:
802
diff
changeset
|
114 |
1079
cbc8641a204e
Tests: fixed "proxy connect timeout" http tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
1006
diff
changeset
|
115 like(http_get('/timeout'), qr/200 OK/, 'proxy connect timeout'); |
732
984bfe661cce
Tests: stream and http proxy_connect_timeout tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
731
diff
changeset
|
116 |
1419
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
117 my $re = qr/(\d\.\d{3})/; |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
118 my $p0 = port(8080); |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
119 my ($ct, $ht, $rt, $ct2, $ht2, $rt2, $ct3, $ht3, $rt3); |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
120 |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
121 like(http_get('/vars'), qr/X-Proxy-Host:\s127\.0\.0\.1:$p0/, 'proxy_host'); |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
122 like(http_get('/vars'), qr/X-Proxy-Port:\s$p0/, 'proxy_port'); |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
123 like(http_xff('/vars', '192.0.2.1'), qr/X-Proxy-Forwarded:.*192\.0\.2\.1/, |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
124 'proxy_add_x_forwarded_for'); |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
125 |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
126 ($ct, $ht) = get('/time/header'); |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
127 cmp_ok($ct, '<', 1, 'connect time - slow response header'); |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
128 cmp_ok($ht, '>=', 1, 'header time - slow response header'); |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
129 |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
130 ($ct, $ht) = get('/time/body'); |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
131 cmp_ok($ct, '<', 1, 'connect time - slow response body'); |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
132 cmp_ok($ht, '<', 1, 'header time - slow response body'); |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
133 |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
134 my $s = http_get('/time/header', start => 1); |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
135 select undef, undef, undef, 0.4; |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
136 close ($s); |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
137 |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
138 # expect no header time in 1st (bad) upstream, no (yet) response time in 2nd |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
139 |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
140 $re = qr/(\d\.\d{3}|-)/; |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
141 ($ct, $ct2, $ht, $ht2, $rt, $rt2) = get('/pnu', many => 1); |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
142 cmp_ok($ct, '<', 1, 'connect time - next'); |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
143 cmp_ok($ct2, '<', 1, 'connect time - next 2'); |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
144 |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
145 TODO: { |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
146 local $TODO = 'not yet' unless $t->has_version('1.15.7'); |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
147 |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
148 is($ht, '-', 'header time - next'); |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
149 |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
150 } |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
151 |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
152 cmp_ok($ht2, '<', 1, 'header time - next 2'); |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
153 cmp_ok($rt, '>=', 1, 'response time - next'); |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
154 |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
155 TODO: { |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
156 local $TODO = 'not yet' unless $t->has_version('1.15.7'); |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
157 |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
158 is($rt2, '-', 'response time - next 2'); |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
159 |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
160 } |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
161 |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
162 $t->stop(); |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
163 |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
164 ($ct, $ht, $rt, $ct2, $ht2, $rt2, $ct3, $ht3, $rt3) |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
165 = $t->read_file('time.log') =~ /^$re:$re:$re\n$re:$re:$re\n$re:$re:$re$/; |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
166 |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
167 cmp_ok($ct, '<', 1, 'connect time log - slow response header'); |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
168 cmp_ok($ct2, '<', 1, 'connect time log - slow response body'); |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
169 |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
170 TODO: { |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
171 local $TODO = 'not yet' unless $t->has_version('1.15.7'); |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
172 |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
173 isnt($ct3, '-', 'connect time log - client close set'); |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
174 |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
175 } |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
176 |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
177 $ct3 = 0 if $ct3 eq '-'; |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
178 cmp_ok($ct3, '<', 1, 'connect time log - client close'); |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
179 |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
180 cmp_ok($ht, '>=', 1, 'header time log - slow response header'); |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
181 cmp_ok($ht2, '<', 1, 'header time log - slow response body'); |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
182 is($ht3, '-', 'header time log - client close'); |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
183 |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
184 cmp_ok($rt, '>=', 1, 'response time log - slow response header'); |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
185 cmp_ok($rt2, '>=', 1, 'response time log - slow response body'); |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
186 |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
187 TODO: { |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
188 local $TODO = 'not yet' unless $t->has_version('1.15.7'); |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
189 |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
190 isnt($rt3, '-', 'response time log - client close set'); |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
191 $rt3 = 0 if $rt3 eq '-'; |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
192 cmp_ok($rt3, '>', $ct3, 'response time log - client close'); |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
193 |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
194 } |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
195 |
42 | 196 ############################################################################### |
197 | |
1419
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
198 sub get { |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
199 my ($uri, %extra) = @_; |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
200 my $re = $extra{many} ? qr/$re, $re?/ : $re; |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
201 my $r = http_get($uri); |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
202 $r =~ /X-Connect: $re/, $r =~ /X-Header: $re/, $r =~ /X-Response: $re/; |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
203 } |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
204 |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
205 sub http_xff { |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
206 my ($uri, $xff) = @_; |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
207 return http(<<EOF); |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
208 GET $uri HTTP/1.0 |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
209 Host: localhost |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
210 X-Forwarded-For: $xff |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
211 |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
212 EOF |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
213 } |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
214 |
42 | 215 sub http_daemon { |
1419
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
216 my $once = 1; |
42 | 217 my $server = IO::Socket::INET->new( |
83
6e5884419e4a
Tests: whitespace cleanup.
Maxim Dounin <mdounin@mdounin.ru>
parents:
64
diff
changeset
|
218 Proto => 'tcp', |
974
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
952
diff
changeset
|
219 LocalHost => '127.0.0.1:' . port(8081), |
83
6e5884419e4a
Tests: whitespace cleanup.
Maxim Dounin <mdounin@mdounin.ru>
parents:
64
diff
changeset
|
220 Listen => 5, |
6e5884419e4a
Tests: whitespace cleanup.
Maxim Dounin <mdounin@mdounin.ru>
parents:
64
diff
changeset
|
221 Reuse => 1 |
42 | 222 ) |
83
6e5884419e4a
Tests: whitespace cleanup.
Maxim Dounin <mdounin@mdounin.ru>
parents:
64
diff
changeset
|
223 or die "Can't create listening socket: $!\n"; |
42 | 224 |
295
6fe0459b6668
Tests: eliminate startup races in proxy and fastcgi tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
249
diff
changeset
|
225 local $SIG{PIPE} = 'IGNORE'; |
6fe0459b6668
Tests: eliminate startup races in proxy and fastcgi tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
249
diff
changeset
|
226 |
42 | 227 while (my $client = $server->accept()) { |
83
6e5884419e4a
Tests: whitespace cleanup.
Maxim Dounin <mdounin@mdounin.ru>
parents:
64
diff
changeset
|
228 $client->autoflush(1); |
42 | 229 |
230 my $headers = ''; | |
231 my $uri = ''; | |
232 | |
83
6e5884419e4a
Tests: whitespace cleanup.
Maxim Dounin <mdounin@mdounin.ru>
parents:
64
diff
changeset
|
233 while (<$client>) { |
42 | 234 $headers .= $_; |
83
6e5884419e4a
Tests: whitespace cleanup.
Maxim Dounin <mdounin@mdounin.ru>
parents:
64
diff
changeset
|
235 last if (/^\x0d?\x0a?$/); |
6e5884419e4a
Tests: whitespace cleanup.
Maxim Dounin <mdounin@mdounin.ru>
parents:
64
diff
changeset
|
236 } |
42 | 237 |
238 $uri = $1 if $headers =~ /^\S+\s+([^ ]+)\s+HTTP/i; | |
239 | |
240 if ($uri eq '/') { | |
241 print $client <<'EOF'; | |
242 HTTP/1.1 200 OK | |
243 Connection: close | |
244 | |
245 EOF | |
246 print $client "TEST-OK-IF-YOU-SEE-THIS" | |
247 unless $headers =~ /^HEAD/i; | |
248 | |
249 } elsif ($uri eq '/multi') { | |
250 | |
83
6e5884419e4a
Tests: whitespace cleanup.
Maxim Dounin <mdounin@mdounin.ru>
parents:
64
diff
changeset
|
251 print $client <<"EOF"; |
42 | 252 HTTP/1.1 200 OK |
253 Connection: close | |
254 | |
255 TEST-OK-IF-YOU-SEE-THIS | |
256 EOF | |
257 | |
258 select undef, undef, undef, 0.1; | |
259 print $client 'AND-THIS'; | |
260 | |
1079
cbc8641a204e
Tests: fixed "proxy connect timeout" http tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
1006
diff
changeset
|
261 } elsif ($uri eq '/timeout') { |
cbc8641a204e
Tests: fixed "proxy connect timeout" http tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
1006
diff
changeset
|
262 sleep 3; |
cbc8641a204e
Tests: fixed "proxy connect timeout" http tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
1006
diff
changeset
|
263 |
cbc8641a204e
Tests: fixed "proxy connect timeout" http tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
1006
diff
changeset
|
264 print $client <<"EOF"; |
cbc8641a204e
Tests: fixed "proxy connect timeout" http tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
1006
diff
changeset
|
265 HTTP/1.1 200 OK |
cbc8641a204e
Tests: fixed "proxy connect timeout" http tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
1006
diff
changeset
|
266 Connection: close |
cbc8641a204e
Tests: fixed "proxy connect timeout" http tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
1006
diff
changeset
|
267 |
cbc8641a204e
Tests: fixed "proxy connect timeout" http tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
1006
diff
changeset
|
268 EOF |
cbc8641a204e
Tests: fixed "proxy connect timeout" http tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
1006
diff
changeset
|
269 |
1419
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
270 } elsif ($uri eq '/bad') { |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
271 |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
272 if ($once) { |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
273 $once = 0; |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
274 select undef, undef, undef, 1.1; |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
275 next; |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
276 } |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
277 |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
278 print $client <<EOF; |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
279 HTTP/1.1 200 OK |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
280 Connection: close |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
281 |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
282 SEE-THIS-AND-THIS |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
283 EOF |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
284 |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
285 } elsif ($uri eq '/header') { |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
286 select undef, undef, undef, 1.1; |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
287 |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
288 print $client <<EOF; |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
289 HTTP/1.1 200 OK |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
290 Connection: close |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
291 |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
292 SEE-THIS-AND-THIS; |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
293 EOF |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
294 |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
295 } elsif ($uri eq '/body') { |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
296 |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
297 print $client <<EOF; |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
298 HTTP/1.1 200 OK |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
299 Connection: close |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
300 |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
301 SEE-THIS- |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
302 EOF |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
303 |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
304 select undef, undef, undef, 1.1; |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
305 print $client 'AND-THIS'; |
16a8962ff246
Tests: upstream_response_length_variable tests, proxy.t merged.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1251
diff
changeset
|
306 |
42 | 307 } else { |
308 | |
83
6e5884419e4a
Tests: whitespace cleanup.
Maxim Dounin <mdounin@mdounin.ru>
parents:
64
diff
changeset
|
309 print $client <<"EOF"; |
42 | 310 HTTP/1.1 404 Not Found |
311 Connection: close | |
312 | |
313 Oops, '$uri' not found | |
314 EOF | |
315 } | |
316 | |
83
6e5884419e4a
Tests: whitespace cleanup.
Maxim Dounin <mdounin@mdounin.ru>
parents:
64
diff
changeset
|
317 close $client; |
42 | 318 } |
319 } | |
320 | |
321 ############################################################################### |