annotate proxy_next_upstream_tries.t @ 1961:fe6f22da53ec default tip

Tests: tests for usage of discarded body. The client_max_body_size limit should be ignored when the request body is already discarded. In HTTP/1.x, this is done by checking the r->discard_body flag when the body is being discarded, and because r->headers_in.content_length_n is 0 when it's already discarded. This, however, does not happen with HTTP/2 and HTTP/3, and therefore "error_page 413" does not work without relaxing the limit. Further, with proxy_pass, r->headers_in.content_length_n is used to determine length of the request body, and therefore is not correct if discarding of the request body isn't yet complete. While discarding the request body, r->headers_in.content_length_n contains the rest of the body to discard (or, in case of chunked request body, the rest of the current chunk to discard). Similarly, the $content_length variable uses r->headers_in.content_length if available, and also incorrect. The $content_length variable is used when proxying with fastcgi_pass, grpc_pass, and uwsgi_pass (scgi_pass uses the value calculated based on the actual request body buffers, and therefore works correctly).
author Maxim Dounin <mdounin@mdounin.ru>
date Sat, 27 Apr 2024 18:55:50 +0300
parents e4974af3fb12
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
462
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1 #!/usr/bin/perl
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3 # (C) Sergey Kandaurov
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4 # (C) Nginx, Inc.
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
5
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
6 # Tests for http proxy module, proxy_next_upstream_tries
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
7 # and proxy_next_upstream_timeout directives.
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
8
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
9 ###############################################################################
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
10
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
11 use warnings;
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
12 use strict;
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
13
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
14 use Test::More;
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
15
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
16 BEGIN { use FindBin; chdir($FindBin::Bin); }
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
17
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
18 use lib 'lib';
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
19 use Test::Nginx;
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
20
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
21 ###############################################################################
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
22
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
23 select STDERR; $| = 1;
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
24 select STDOUT; $| = 1;
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
25
568
907e89fba9c3 Tests: removed TODO and try_run() checks for legacy versions.
Sergey Kandaurov <pluknet@nginx.com>
parents: 494
diff changeset
26 my $t = Test::Nginx->new()->has(qw/http proxy rewrite/)->plan(8);
462
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
27
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
28 $t->write_file_expand('nginx.conf', <<'EOF');
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
29
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
30 %%TEST_GLOBALS%%
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
31
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
32 daemon off;
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
33
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
34 events {
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
35 }
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
36
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
37 http {
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
38 %%TEST_GLOBALS_HTTP%%
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
39
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
40 upstream u {
974
882267679006 Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents: 952
diff changeset
41 server 127.0.0.1:8081;
882267679006 Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents: 952
diff changeset
42 server 127.0.0.1:8081;
882267679006 Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents: 952
diff changeset
43 server 127.0.0.1:8081;
462
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
44 }
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
45
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
46 upstream u2 {
974
882267679006 Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents: 952
diff changeset
47 server 127.0.0.1:8081;
882267679006 Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents: 952
diff changeset
48 server 127.0.0.1:8081 backup;
882267679006 Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents: 952
diff changeset
49 server 127.0.0.1:8081 backup;
462
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
50 }
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
51
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
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;
462
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
54 server_name localhost;
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
55
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
56 proxy_next_upstream http_404;
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
57 proxy_intercept_errors on;
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
58 error_page 404 /404;
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
59
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
60 location /tries {
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
61 proxy_pass http://u;
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
62 proxy_next_upstream_tries 2;
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
63 }
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
64
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
65 location /tries/backup {
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
66 proxy_pass http://u2;
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
67 proxy_next_upstream_tries 2;
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
68 }
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
69
479
b8f10ffa02cd Tests: proxy_next_upstream_tries tests with resolved upstream.
Sergey Kandaurov <pluknet@nginx.com>
parents: 462
diff changeset
70 location /tries/resolver {
1237
e4974af3fb12 Tests: adjusted udp ports to match allocated ports range.
Andrey Zelenkov <zelenkov@nginx.com>
parents: 974
diff changeset
71 resolver 127.0.0.1:%%PORT_8982_UDP%%;
479
b8f10ffa02cd Tests: proxy_next_upstream_tries tests with resolved upstream.
Sergey Kandaurov <pluknet@nginx.com>
parents: 462
diff changeset
72
974
882267679006 Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents: 952
diff changeset
73 proxy_pass http://$host:%%PORT_8081%%;
479
b8f10ffa02cd Tests: proxy_next_upstream_tries tests with resolved upstream.
Sergey Kandaurov <pluknet@nginx.com>
parents: 462
diff changeset
74 proxy_next_upstream_tries 2;
b8f10ffa02cd Tests: proxy_next_upstream_tries tests with resolved upstream.
Sergey Kandaurov <pluknet@nginx.com>
parents: 462
diff changeset
75 }
b8f10ffa02cd Tests: proxy_next_upstream_tries tests with resolved upstream.
Sergey Kandaurov <pluknet@nginx.com>
parents: 462
diff changeset
76
493
d456ed8a18de Tests: added proxy_next_upstream_tries.t tests with zero value.
Sergey Kandaurov <pluknet@nginx.com>
parents: 492
diff changeset
77 location /tries/zero {
d456ed8a18de Tests: added proxy_next_upstream_tries.t tests with zero value.
Sergey Kandaurov <pluknet@nginx.com>
parents: 492
diff changeset
78 proxy_pass http://u;
d456ed8a18de Tests: added proxy_next_upstream_tries.t tests with zero value.
Sergey Kandaurov <pluknet@nginx.com>
parents: 492
diff changeset
79 proxy_next_upstream_tries 0;
d456ed8a18de Tests: added proxy_next_upstream_tries.t tests with zero value.
Sergey Kandaurov <pluknet@nginx.com>
parents: 492
diff changeset
80 }
d456ed8a18de Tests: added proxy_next_upstream_tries.t tests with zero value.
Sergey Kandaurov <pluknet@nginx.com>
parents: 492
diff changeset
81
462
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
82 location /timeout {
608
ef1c363dd648 Tests: adjusted proxy_next_upstream_tries.t test timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 568
diff changeset
83 proxy_pass http://u/w2;
ef1c363dd648 Tests: adjusted proxy_next_upstream_tries.t test timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 568
diff changeset
84 proxy_next_upstream_timeout 3800ms;
462
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
85 }
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
86
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
87 location /timeout/backup {
608
ef1c363dd648 Tests: adjusted proxy_next_upstream_tries.t test timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 568
diff changeset
88 proxy_pass http://u2/w2;
ef1c363dd648 Tests: adjusted proxy_next_upstream_tries.t test timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 568
diff changeset
89 proxy_next_upstream_timeout 3800ms;
462
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
90 }
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
91
479
b8f10ffa02cd Tests: proxy_next_upstream_tries tests with resolved upstream.
Sergey Kandaurov <pluknet@nginx.com>
parents: 462
diff changeset
92 location /timeout/resolver {
1237
e4974af3fb12 Tests: adjusted udp ports to match allocated ports range.
Andrey Zelenkov <zelenkov@nginx.com>
parents: 974
diff changeset
93 resolver 127.0.0.1:%%PORT_8982_UDP%%;
479
b8f10ffa02cd Tests: proxy_next_upstream_tries tests with resolved upstream.
Sergey Kandaurov <pluknet@nginx.com>
parents: 462
diff changeset
94
974
882267679006 Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents: 952
diff changeset
95 proxy_pass http://$host:%%PORT_8081%%/w2;
608
ef1c363dd648 Tests: adjusted proxy_next_upstream_tries.t test timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 568
diff changeset
96 proxy_next_upstream_timeout 3800ms;
479
b8f10ffa02cd Tests: proxy_next_upstream_tries tests with resolved upstream.
Sergey Kandaurov <pluknet@nginx.com>
parents: 462
diff changeset
97 }
b8f10ffa02cd Tests: proxy_next_upstream_tries tests with resolved upstream.
Sergey Kandaurov <pluknet@nginx.com>
parents: 462
diff changeset
98
493
d456ed8a18de Tests: added proxy_next_upstream_tries.t tests with zero value.
Sergey Kandaurov <pluknet@nginx.com>
parents: 492
diff changeset
99 location /timeout/zero {
494
623863fcb1d1 Tests: simplified proxy_next_upstream_tries.t tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 493
diff changeset
100 proxy_pass http://u/w;
493
d456ed8a18de Tests: added proxy_next_upstream_tries.t tests with zero value.
Sergey Kandaurov <pluknet@nginx.com>
parents: 492
diff changeset
101 proxy_next_upstream_timeout 0;
d456ed8a18de Tests: added proxy_next_upstream_tries.t tests with zero value.
Sergey Kandaurov <pluknet@nginx.com>
parents: 492
diff changeset
102 }
d456ed8a18de Tests: added proxy_next_upstream_tries.t tests with zero value.
Sergey Kandaurov <pluknet@nginx.com>
parents: 492
diff changeset
103
462
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
104 location /404 {
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
105 return 200 x${upstream_status}x;
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
106 }
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
107 }
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
108 }
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
109
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
110 EOF
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
111
974
882267679006 Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents: 952
diff changeset
112 $t->run_daemon(\&http_daemon, port(8081));
1237
e4974af3fb12 Tests: adjusted udp ports to match allocated ports range.
Andrey Zelenkov <zelenkov@nginx.com>
parents: 974
diff changeset
113 $t->run_daemon(\&dns_daemon, port(8982), $t);
568
907e89fba9c3 Tests: removed TODO and try_run() checks for legacy versions.
Sergey Kandaurov <pluknet@nginx.com>
parents: 494
diff changeset
114 $t->run();
462
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
115
974
882267679006 Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents: 952
diff changeset
116 $t->waitforsocket('127.0.0.1:' . port(8081));
1237
e4974af3fb12 Tests: adjusted udp ports to match allocated ports range.
Andrey Zelenkov <zelenkov@nginx.com>
parents: 974
diff changeset
117 $t->waitforfile($t->testdir . '/' . port(8982));
462
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
118
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
119 ###############################################################################
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
120
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
121 like(http_get('/tries'), qr/x404, 404x/, 'tries');
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
122 like(http_get('/tries/backup'), qr/x404, 404x/, 'tries backup');
479
b8f10ffa02cd Tests: proxy_next_upstream_tries tests with resolved upstream.
Sergey Kandaurov <pluknet@nginx.com>
parents: 462
diff changeset
123 like(http_get('/tries/resolver'), qr/x404, 404x/, 'tries resolved');
493
d456ed8a18de Tests: added proxy_next_upstream_tries.t tests with zero value.
Sergey Kandaurov <pluknet@nginx.com>
parents: 492
diff changeset
124 like(http_get('/tries/zero'), qr/x404, 404, 404x/, 'tries zero');
d456ed8a18de Tests: added proxy_next_upstream_tries.t tests with zero value.
Sergey Kandaurov <pluknet@nginx.com>
parents: 492
diff changeset
125
492
799487ee9aee Tests: adjusted proxy_next_upstream_timeout values.
Sergey Kandaurov <pluknet@nginx.com>
parents: 485
diff changeset
126 # two tries fit into 1.9s
462
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
127
608
ef1c363dd648 Tests: adjusted proxy_next_upstream_tries.t test timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 568
diff changeset
128 SKIP: {
ef1c363dd648 Tests: adjusted proxy_next_upstream_tries.t test timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 568
diff changeset
129 skip 'long tests', 4 unless $ENV{TEST_NGINX_UNSAFE};
ef1c363dd648 Tests: adjusted proxy_next_upstream_tries.t test timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 568
diff changeset
130
462
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
131 like(http_get('/timeout'), qr/x404, 404x/, 'timeout');
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
132 like(http_get('/timeout/backup'), qr/x404, 404x/, 'timeout backup');
479
b8f10ffa02cd Tests: proxy_next_upstream_tries tests with resolved upstream.
Sergey Kandaurov <pluknet@nginx.com>
parents: 462
diff changeset
133 like(http_get('/timeout/resolver'), qr/x404, 404x/, 'timeout resolved');
493
d456ed8a18de Tests: added proxy_next_upstream_tries.t tests with zero value.
Sergey Kandaurov <pluknet@nginx.com>
parents: 492
diff changeset
134 like(http_get('/timeout/zero'), qr/x404, 404, 404x/, 'timeout zero');
d456ed8a18de Tests: added proxy_next_upstream_tries.t tests with zero value.
Sergey Kandaurov <pluknet@nginx.com>
parents: 492
diff changeset
135
608
ef1c363dd648 Tests: adjusted proxy_next_upstream_tries.t test timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 568
diff changeset
136 }
ef1c363dd648 Tests: adjusted proxy_next_upstream_tries.t test timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 568
diff changeset
137
462
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
138 ###############################################################################
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
139
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
140 sub http_daemon {
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
141 my ($port) = @_;
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
142
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
143 my $server = IO::Socket::INET->new(
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
144 Proto => 'tcp',
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
145 LocalHost => '127.0.0.1',
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
146 LocalPort => $port,
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
147 Listen => 5,
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
148 Reuse => 1
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
149 )
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
150 or die "Can't create listening socket: $!\n";
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
151
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
152 local $SIG{PIPE} = 'IGNORE';
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
153
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
154 while (my $client = $server->accept()) {
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
155 $client->autoflush(1);
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
156
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
157 my $headers = '';
494
623863fcb1d1 Tests: simplified proxy_next_upstream_tries.t tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 493
diff changeset
158 my $uri = '';
462
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
159
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
160 while (<$client>) {
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
161 $headers .= $_;
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
162 last if (/^\x0d?\x0a?$/);
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
163 }
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
164
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
165 next if $headers eq '';
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
166
494
623863fcb1d1 Tests: simplified proxy_next_upstream_tries.t tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 493
diff changeset
167 $uri = $1 if $headers =~ /^\S+\s+([^ ]+)\s+HTTP/i;
623863fcb1d1 Tests: simplified proxy_next_upstream_tries.t tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 493
diff changeset
168
623863fcb1d1 Tests: simplified proxy_next_upstream_tries.t tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 493
diff changeset
169 if ($uri eq '/w') {
462
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
170 Test::Nginx::log_core('||', "$port: sleep(1)");
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
171 select undef, undef, undef, 1;
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
172 }
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
173
608
ef1c363dd648 Tests: adjusted proxy_next_upstream_tries.t test timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 568
diff changeset
174 if ($uri eq '/w2') {
ef1c363dd648 Tests: adjusted proxy_next_upstream_tries.t test timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 568
diff changeset
175 Test::Nginx::log_core('||', "$port: sleep(2)");
ef1c363dd648 Tests: adjusted proxy_next_upstream_tries.t test timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 568
diff changeset
176 select undef, undef, undef, 2;
ef1c363dd648 Tests: adjusted proxy_next_upstream_tries.t test timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 568
diff changeset
177 }
ef1c363dd648 Tests: adjusted proxy_next_upstream_tries.t test timeouts.
Sergey Kandaurov <pluknet@nginx.com>
parents: 568
diff changeset
178
462
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
179 Test::Nginx::log_core('||', "$port: response, 404");
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
180 print $client <<EOF;
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
181 HTTP/1.1 404 Not Found
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
182 Connection: close
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
183
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
184 EOF
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
185
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
186 } continue {
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
187 close $client;
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
188 }
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
189 }
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
190
479
b8f10ffa02cd Tests: proxy_next_upstream_tries tests with resolved upstream.
Sergey Kandaurov <pluknet@nginx.com>
parents: 462
diff changeset
191 sub reply_handler {
b8f10ffa02cd Tests: proxy_next_upstream_tries tests with resolved upstream.
Sergey Kandaurov <pluknet@nginx.com>
parents: 462
diff changeset
192 my ($recv_data) = @_;
b8f10ffa02cd Tests: proxy_next_upstream_tries tests with resolved upstream.
Sergey Kandaurov <pluknet@nginx.com>
parents: 462
diff changeset
193
b8f10ffa02cd Tests: proxy_next_upstream_tries tests with resolved upstream.
Sergey Kandaurov <pluknet@nginx.com>
parents: 462
diff changeset
194 my (@name, @rdata);
b8f10ffa02cd Tests: proxy_next_upstream_tries tests with resolved upstream.
Sergey Kandaurov <pluknet@nginx.com>
parents: 462
diff changeset
195
b8f10ffa02cd Tests: proxy_next_upstream_tries tests with resolved upstream.
Sergey Kandaurov <pluknet@nginx.com>
parents: 462
diff changeset
196 use constant NOERROR => 0;
b8f10ffa02cd Tests: proxy_next_upstream_tries tests with resolved upstream.
Sergey Kandaurov <pluknet@nginx.com>
parents: 462
diff changeset
197 use constant A => 1;
937
b1fa8e0cc27b Tests: whitespaces fix.
Andrey Zelenkov <zelenkov@nginx.com>
parents: 814
diff changeset
198 use constant IN => 1;
479
b8f10ffa02cd Tests: proxy_next_upstream_tries tests with resolved upstream.
Sergey Kandaurov <pluknet@nginx.com>
parents: 462
diff changeset
199
b8f10ffa02cd Tests: proxy_next_upstream_tries tests with resolved upstream.
Sergey Kandaurov <pluknet@nginx.com>
parents: 462
diff changeset
200 # default values
b8f10ffa02cd Tests: proxy_next_upstream_tries tests with resolved upstream.
Sergey Kandaurov <pluknet@nginx.com>
parents: 462
diff changeset
201
b8f10ffa02cd Tests: proxy_next_upstream_tries tests with resolved upstream.
Sergey Kandaurov <pluknet@nginx.com>
parents: 462
diff changeset
202 my ($hdr, $rcode, $ttl) = (0x8180, NOERROR, 3600);
b8f10ffa02cd Tests: proxy_next_upstream_tries tests with resolved upstream.
Sergey Kandaurov <pluknet@nginx.com>
parents: 462
diff changeset
203
b8f10ffa02cd Tests: proxy_next_upstream_tries tests with resolved upstream.
Sergey Kandaurov <pluknet@nginx.com>
parents: 462
diff changeset
204 # decode name
b8f10ffa02cd Tests: proxy_next_upstream_tries tests with resolved upstream.
Sergey Kandaurov <pluknet@nginx.com>
parents: 462
diff changeset
205
b8f10ffa02cd Tests: proxy_next_upstream_tries tests with resolved upstream.
Sergey Kandaurov <pluknet@nginx.com>
parents: 462
diff changeset
206 my ($len, $offset) = (undef, 12);
b8f10ffa02cd Tests: proxy_next_upstream_tries tests with resolved upstream.
Sergey Kandaurov <pluknet@nginx.com>
parents: 462
diff changeset
207 while (1) {
b8f10ffa02cd Tests: proxy_next_upstream_tries tests with resolved upstream.
Sergey Kandaurov <pluknet@nginx.com>
parents: 462
diff changeset
208 $len = unpack("\@$offset C", $recv_data);
b8f10ffa02cd Tests: proxy_next_upstream_tries tests with resolved upstream.
Sergey Kandaurov <pluknet@nginx.com>
parents: 462
diff changeset
209 last if $len == 0;
b8f10ffa02cd Tests: proxy_next_upstream_tries tests with resolved upstream.
Sergey Kandaurov <pluknet@nginx.com>
parents: 462
diff changeset
210 $offset++;
b8f10ffa02cd Tests: proxy_next_upstream_tries tests with resolved upstream.
Sergey Kandaurov <pluknet@nginx.com>
parents: 462
diff changeset
211 push @name, unpack("\@$offset A$len", $recv_data);
b8f10ffa02cd Tests: proxy_next_upstream_tries tests with resolved upstream.
Sergey Kandaurov <pluknet@nginx.com>
parents: 462
diff changeset
212 $offset += $len;
b8f10ffa02cd Tests: proxy_next_upstream_tries tests with resolved upstream.
Sergey Kandaurov <pluknet@nginx.com>
parents: 462
diff changeset
213 }
b8f10ffa02cd Tests: proxy_next_upstream_tries tests with resolved upstream.
Sergey Kandaurov <pluknet@nginx.com>
parents: 462
diff changeset
214
b8f10ffa02cd Tests: proxy_next_upstream_tries tests with resolved upstream.
Sergey Kandaurov <pluknet@nginx.com>
parents: 462
diff changeset
215 $offset -= 1;
b8f10ffa02cd Tests: proxy_next_upstream_tries tests with resolved upstream.
Sergey Kandaurov <pluknet@nginx.com>
parents: 462
diff changeset
216 my ($id, $type, $class) = unpack("n x$offset n2", $recv_data);
b8f10ffa02cd Tests: proxy_next_upstream_tries tests with resolved upstream.
Sergey Kandaurov <pluknet@nginx.com>
parents: 462
diff changeset
217
485
cbfe90b632e8 Tests: removed stray semicolon, no functional changes.
Sergey Kandaurov <pluknet@nginx.com>
parents: 484
diff changeset
218 @rdata = map { rd_addr($ttl, '127.0.0.1') } (1 .. 3) if $type == A;
479
b8f10ffa02cd Tests: proxy_next_upstream_tries tests with resolved upstream.
Sergey Kandaurov <pluknet@nginx.com>
parents: 462
diff changeset
219
b8f10ffa02cd Tests: proxy_next_upstream_tries tests with resolved upstream.
Sergey Kandaurov <pluknet@nginx.com>
parents: 462
diff changeset
220 $len = @name;
775
a6764c2a9f12 Tests: fixed DNS label coding in resolver tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 608
diff changeset
221 pack("n6 (C/a*)$len x n2", $id, $hdr | $rcode, 1, scalar @rdata,
479
b8f10ffa02cd Tests: proxy_next_upstream_tries tests with resolved upstream.
Sergey Kandaurov <pluknet@nginx.com>
parents: 462
diff changeset
222 0, 0, @name, $type, $class) . join('', @rdata);
b8f10ffa02cd Tests: proxy_next_upstream_tries tests with resolved upstream.
Sergey Kandaurov <pluknet@nginx.com>
parents: 462
diff changeset
223 }
b8f10ffa02cd Tests: proxy_next_upstream_tries tests with resolved upstream.
Sergey Kandaurov <pluknet@nginx.com>
parents: 462
diff changeset
224
b8f10ffa02cd Tests: proxy_next_upstream_tries tests with resolved upstream.
Sergey Kandaurov <pluknet@nginx.com>
parents: 462
diff changeset
225 sub rd_addr {
b8f10ffa02cd Tests: proxy_next_upstream_tries tests with resolved upstream.
Sergey Kandaurov <pluknet@nginx.com>
parents: 462
diff changeset
226 my ($ttl, $addr) = @_;
b8f10ffa02cd Tests: proxy_next_upstream_tries tests with resolved upstream.
Sergey Kandaurov <pluknet@nginx.com>
parents: 462
diff changeset
227
b8f10ffa02cd Tests: proxy_next_upstream_tries tests with resolved upstream.
Sergey Kandaurov <pluknet@nginx.com>
parents: 462
diff changeset
228 my $code = 'split(/\./, $addr)';
b8f10ffa02cd Tests: proxy_next_upstream_tries tests with resolved upstream.
Sergey Kandaurov <pluknet@nginx.com>
parents: 462
diff changeset
229
b8f10ffa02cd Tests: proxy_next_upstream_tries tests with resolved upstream.
Sergey Kandaurov <pluknet@nginx.com>
parents: 462
diff changeset
230 return pack 'n3N', 0xc00c, A, IN, $ttl if $addr eq '';
b8f10ffa02cd Tests: proxy_next_upstream_tries tests with resolved upstream.
Sergey Kandaurov <pluknet@nginx.com>
parents: 462
diff changeset
231
b8f10ffa02cd Tests: proxy_next_upstream_tries tests with resolved upstream.
Sergey Kandaurov <pluknet@nginx.com>
parents: 462
diff changeset
232 pack 'n3N nC4', 0xc00c, A, IN, $ttl, eval "scalar $code", eval($code);
b8f10ffa02cd Tests: proxy_next_upstream_tries tests with resolved upstream.
Sergey Kandaurov <pluknet@nginx.com>
parents: 462
diff changeset
233 }
b8f10ffa02cd Tests: proxy_next_upstream_tries tests with resolved upstream.
Sergey Kandaurov <pluknet@nginx.com>
parents: 462
diff changeset
234
b8f10ffa02cd Tests: proxy_next_upstream_tries tests with resolved upstream.
Sergey Kandaurov <pluknet@nginx.com>
parents: 462
diff changeset
235 sub dns_daemon {
b8f10ffa02cd Tests: proxy_next_upstream_tries tests with resolved upstream.
Sergey Kandaurov <pluknet@nginx.com>
parents: 462
diff changeset
236 my ($port, $t) = @_;
b8f10ffa02cd Tests: proxy_next_upstream_tries tests with resolved upstream.
Sergey Kandaurov <pluknet@nginx.com>
parents: 462
diff changeset
237
b8f10ffa02cd Tests: proxy_next_upstream_tries tests with resolved upstream.
Sergey Kandaurov <pluknet@nginx.com>
parents: 462
diff changeset
238 my ($data, $recv_data);
b8f10ffa02cd Tests: proxy_next_upstream_tries tests with resolved upstream.
Sergey Kandaurov <pluknet@nginx.com>
parents: 462
diff changeset
239 my $socket = IO::Socket::INET->new(
937
b1fa8e0cc27b Tests: whitespaces fix.
Andrey Zelenkov <zelenkov@nginx.com>
parents: 814
diff changeset
240 LocalAddr => '127.0.0.1',
b1fa8e0cc27b Tests: whitespaces fix.
Andrey Zelenkov <zelenkov@nginx.com>
parents: 814
diff changeset
241 LocalPort => $port,
b1fa8e0cc27b Tests: whitespaces fix.
Andrey Zelenkov <zelenkov@nginx.com>
parents: 814
diff changeset
242 Proto => 'udp',
479
b8f10ffa02cd Tests: proxy_next_upstream_tries tests with resolved upstream.
Sergey Kandaurov <pluknet@nginx.com>
parents: 462
diff changeset
243 )
b8f10ffa02cd Tests: proxy_next_upstream_tries tests with resolved upstream.
Sergey Kandaurov <pluknet@nginx.com>
parents: 462
diff changeset
244 or die "Can't create listening socket: $!\n";
b8f10ffa02cd Tests: proxy_next_upstream_tries tests with resolved upstream.
Sergey Kandaurov <pluknet@nginx.com>
parents: 462
diff changeset
245
b8f10ffa02cd Tests: proxy_next_upstream_tries tests with resolved upstream.
Sergey Kandaurov <pluknet@nginx.com>
parents: 462
diff changeset
246 # signal we are ready
b8f10ffa02cd Tests: proxy_next_upstream_tries tests with resolved upstream.
Sergey Kandaurov <pluknet@nginx.com>
parents: 462
diff changeset
247
b8f10ffa02cd Tests: proxy_next_upstream_tries tests with resolved upstream.
Sergey Kandaurov <pluknet@nginx.com>
parents: 462
diff changeset
248 open my $fh, '>', $t->testdir() . '/' . $port;
b8f10ffa02cd Tests: proxy_next_upstream_tries tests with resolved upstream.
Sergey Kandaurov <pluknet@nginx.com>
parents: 462
diff changeset
249 close $fh;
b8f10ffa02cd Tests: proxy_next_upstream_tries tests with resolved upstream.
Sergey Kandaurov <pluknet@nginx.com>
parents: 462
diff changeset
250
b8f10ffa02cd Tests: proxy_next_upstream_tries tests with resolved upstream.
Sergey Kandaurov <pluknet@nginx.com>
parents: 462
diff changeset
251 while (1) {
b8f10ffa02cd Tests: proxy_next_upstream_tries tests with resolved upstream.
Sergey Kandaurov <pluknet@nginx.com>
parents: 462
diff changeset
252 $socket->recv($recv_data, 65536);
b8f10ffa02cd Tests: proxy_next_upstream_tries tests with resolved upstream.
Sergey Kandaurov <pluknet@nginx.com>
parents: 462
diff changeset
253 $data = reply_handler($recv_data);
b8f10ffa02cd Tests: proxy_next_upstream_tries tests with resolved upstream.
Sergey Kandaurov <pluknet@nginx.com>
parents: 462
diff changeset
254 $socket->send($data);
b8f10ffa02cd Tests: proxy_next_upstream_tries tests with resolved upstream.
Sergey Kandaurov <pluknet@nginx.com>
parents: 462
diff changeset
255 }
b8f10ffa02cd Tests: proxy_next_upstream_tries tests with resolved upstream.
Sergey Kandaurov <pluknet@nginx.com>
parents: 462
diff changeset
256 }
b8f10ffa02cd Tests: proxy_next_upstream_tries tests with resolved upstream.
Sergey Kandaurov <pluknet@nginx.com>
parents: 462
diff changeset
257
462
cb0662e12d6e Tests: proxy_next_upstream_{tries,timeout} tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
258 ###############################################################################