Mercurial > hg > nginx-tests
annotate stream_access.t @ 1990:85d88cd5091c
Tests: SSI include stub tests.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Thu, 04 Jul 2024 17:42:55 +0300 |
parents | f3ba4c74de31 |
children |
rev | line source |
---|---|
631
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
1 #!/usr/bin/perl |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
2 |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
3 # (C) Andrey Zelenkov |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
4 # (C) Nginx, Inc. |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
5 |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
6 # Tests for stream access module. |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
7 |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
8 ############################################################################### |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
9 |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
10 use warnings; |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
11 use strict; |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
12 |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
13 use Test::More; |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
14 |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
15 BEGIN { use FindBin; chdir($FindBin::Bin); } |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
16 |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
17 use lib 'lib'; |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
18 use Test::Nginx; |
816
77359b849cd5
Tests: stream package.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
726
diff
changeset
|
19 use Test::Nginx::Stream qw/ stream /; |
631
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
20 |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
21 ############################################################################### |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
22 |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
23 select STDERR; $| = 1; |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
24 select STDOUT; $| = 1; |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
25 |
1170
cf14cfe9ec8c
Tests: dropped obsolete ipv6 prerequisite.
Sergey Kandaurov <pluknet@nginx.com>
parents:
974
diff
changeset
|
26 my $t = Test::Nginx->new()->has(qw/stream stream_access unix/); |
631
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
27 |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
28 $t->write_file_expand('nginx.conf', <<'EOF'); |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
29 |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
30 %%TEST_GLOBALS%% |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
31 |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
32 daemon off; |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
33 |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
34 events { |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
35 } |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
36 |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
37 stream { |
1609
f3ba4c74de31
Tests: added TEST_GLOBALS_STREAM variable support.
Andrei Belov <defan@nginx.com>
parents:
1190
diff
changeset
|
38 %%TEST_GLOBALS_STREAM%% |
f3ba4c74de31
Tests: added TEST_GLOBALS_STREAM variable support.
Andrei Belov <defan@nginx.com>
parents:
1190
diff
changeset
|
39 |
631
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
40 server { |
974
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
952
diff
changeset
|
41 listen 127.0.0.1:8082; |
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
952
diff
changeset
|
42 proxy_pass [::1]:%%PORT_8080%%; |
631
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
43 } |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
44 |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
45 server { |
974
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
952
diff
changeset
|
46 listen 127.0.0.1:8083; |
631
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
47 proxy_pass unix:%%TESTDIR%%/unix.sock.0; |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
48 } |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
49 |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
50 server { |
974
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
952
diff
changeset
|
51 listen 127.0.0.1:8085; |
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
952
diff
changeset
|
52 proxy_pass [::1]:%%PORT_8081%%; |
631
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
53 } |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
54 |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
55 server { |
974
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
952
diff
changeset
|
56 listen 127.0.0.1:8086; |
631
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
57 proxy_pass unix:%%TESTDIR%%/unix.sock.1; |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
58 } |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
59 |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
60 server { |
974
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
952
diff
changeset
|
61 listen 127.0.0.1:8088; |
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
952
diff
changeset
|
62 proxy_pass [::1]:%%PORT_8082%%; |
631
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
63 } |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
64 |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
65 server { |
974
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
952
diff
changeset
|
66 listen 127.0.0.1:8089; |
631
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
67 proxy_pass unix:%%TESTDIR%%/unix.sock.2; |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
68 } |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
69 |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
70 server { |
974
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
952
diff
changeset
|
71 listen 127.0.0.1:8091; |
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
952
diff
changeset
|
72 proxy_pass [::1]:%%PORT_8083%%; |
631
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
73 } |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
74 |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
75 server { |
974
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
952
diff
changeset
|
76 listen 127.0.0.1:8092; |
631
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
77 proxy_pass unix:%%TESTDIR%%/unix.sock.3; |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
78 } |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
79 |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
80 server { |
974
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
952
diff
changeset
|
81 listen 127.0.0.1:8094; |
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
952
diff
changeset
|
82 proxy_pass [::1]:%%PORT_8084%%; |
631
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
83 } |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
84 |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
85 server { |
974
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
952
diff
changeset
|
86 listen 127.0.0.1:8095; |
631
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
87 proxy_pass unix:%%TESTDIR%%/unix.sock.4; |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
88 } |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
89 |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
90 server { |
974
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
952
diff
changeset
|
91 listen 127.0.0.1:8097; |
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
952
diff
changeset
|
92 proxy_pass [::1]:%%PORT_8085%%; |
631
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
93 } |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
94 |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
95 server { |
974
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
952
diff
changeset
|
96 listen 127.0.0.1:8098; |
631
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
97 proxy_pass unix:%%TESTDIR%%/unix.sock.5; |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
98 } |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
99 |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
100 server { |
974
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
952
diff
changeset
|
101 listen 127.0.0.1:8081; |
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
952
diff
changeset
|
102 listen [::1]:%%PORT_8080%%; |
631
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
103 listen unix:%%TESTDIR%%/unix.sock.0; |
974
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
952
diff
changeset
|
104 proxy_pass 127.0.0.1:8080; |
631
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
105 allow all; |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
106 } |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
107 |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
108 server { |
974
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
952
diff
changeset
|
109 listen 127.0.0.1:8084; |
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
952
diff
changeset
|
110 listen [::1]:%%PORT_8081%%; |
631
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
111 listen unix:%%TESTDIR%%/unix.sock.1; |
974
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
952
diff
changeset
|
112 proxy_pass 127.0.0.1:8080; |
631
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
113 deny all; |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
114 } |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
115 |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
116 server { |
974
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
952
diff
changeset
|
117 listen 127.0.0.1:8087; |
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
952
diff
changeset
|
118 listen [::1]:%%PORT_8082%%; |
631
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
119 listen unix:%%TESTDIR%%/unix.sock.2; |
974
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
952
diff
changeset
|
120 proxy_pass 127.0.0.1:8080; |
631
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
121 allow unix:; |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
122 } |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
123 |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
124 server { |
974
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
952
diff
changeset
|
125 listen 127.0.0.1:8090; |
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
952
diff
changeset
|
126 listen [::1]:%%PORT_8083%%; |
631
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
127 listen unix:%%TESTDIR%%/unix.sock.3; |
974
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
952
diff
changeset
|
128 proxy_pass 127.0.0.1:8080; |
631
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
129 deny 127.0.0.1; |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
130 } |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
131 |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
132 server { |
974
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
952
diff
changeset
|
133 listen 127.0.0.1:8093; |
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
952
diff
changeset
|
134 listen [::1]:%%PORT_8084%%; |
631
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
135 listen unix:%%TESTDIR%%/unix.sock.4; |
974
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
952
diff
changeset
|
136 proxy_pass 127.0.0.1:8080; |
631
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
137 deny ::1; |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
138 } |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
139 |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
140 server { |
974
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
952
diff
changeset
|
141 listen 127.0.0.1:8096; |
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
952
diff
changeset
|
142 listen [::1]:%%PORT_8085%%; |
631
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
143 listen unix:%%TESTDIR%%/unix.sock.5; |
974
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
952
diff
changeset
|
144 proxy_pass 127.0.0.1:8080; |
631
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
145 deny unix:; |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
146 } |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
147 } |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
148 |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
149 EOF |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
150 |
1190
fcd65708672d
Tests: let tests pass on travis-ci VMs with disabled IPv6 loopback.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1171
diff
changeset
|
151 $t->try_run('no inet6 support')->plan(18); |
631
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
152 $t->run_daemon(\&stream_daemon); |
974
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
952
diff
changeset
|
153 $t->waitforsocket('127.0.0.1:' . port(8080)); |
631
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
154 |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
155 ############################################################################### |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
156 |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
157 my $str = 'SEE-THIS'; |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
158 |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
159 # allow all |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
160 |
974
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
952
diff
changeset
|
161 is(stream('127.0.0.1:' . port(8081))->io($str), $str, 'inet allow all'); |
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
952
diff
changeset
|
162 is(stream('127.0.0.1:' . port(8082))->io($str), $str, 'inet6 allow all'); |
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
952
diff
changeset
|
163 is(stream('127.0.0.1:' . port(8083))->io($str), $str, 'unix allow all'); |
631
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
164 |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
165 # deny all |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
166 |
974
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
952
diff
changeset
|
167 is(stream('127.0.0.1:' . port(8084))->io($str), '', 'inet deny all'); |
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
952
diff
changeset
|
168 is(stream('127.0.0.1:' . port(8085))->io($str), '', 'inet6 deny all'); |
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
952
diff
changeset
|
169 is(stream('127.0.0.1:' . port(8086))->io($str), '', 'unix deny all'); |
631
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
170 |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
171 # allow unix |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
172 |
974
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
952
diff
changeset
|
173 is(stream('127.0.0.1:' . port(8087))->io($str), $str, 'inet allow unix'); |
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
952
diff
changeset
|
174 is(stream('127.0.0.1:' . port(8088))->io($str), $str, 'inet6 allow unix'); |
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
952
diff
changeset
|
175 is(stream('127.0.0.1:' . port(8089))->io($str), $str, 'unix allow unix'); |
631
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
176 |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
177 # deny inet |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
178 |
974
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
952
diff
changeset
|
179 is(stream('127.0.0.1:' . port(8090))->io($str), '', 'inet deny inet'); |
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
952
diff
changeset
|
180 is(stream('127.0.0.1:' . port(8091))->io($str), $str, 'inet6 deny inet'); |
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
952
diff
changeset
|
181 is(stream('127.0.0.1:' . port(8092))->io($str), $str, 'unix deny inet'); |
631
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
182 |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
183 # deny inet6 |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
184 |
974
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
952
diff
changeset
|
185 is(stream('127.0.0.1:' . port(8093))->io($str), $str, 'inet deny inet6'); |
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
952
diff
changeset
|
186 is(stream('127.0.0.1:' . port(8094))->io($str), '', 'inet6 deny inet6'); |
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
952
diff
changeset
|
187 is(stream('127.0.0.1:' . port(8095))->io($str), $str, 'unix deny inet6'); |
631
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
188 |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
189 # deny unix |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
190 |
974
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
952
diff
changeset
|
191 is(stream('127.0.0.1:' . port(8096))->io($str), $str, 'inet deny unix'); |
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
952
diff
changeset
|
192 is(stream('127.0.0.1:' . port(8097))->io($str), $str, 'inet6 deny unix'); |
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
952
diff
changeset
|
193 is(stream('127.0.0.1:' . port(8098))->io($str), '', 'unix deny unix'); |
631
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
194 |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
195 ############################################################################### |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
196 |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
197 sub stream_daemon { |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
198 my $server = IO::Socket::INET->new( |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
199 Proto => 'tcp', |
974
882267679006
Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
952
diff
changeset
|
200 LocalAddr => '127.0.0.1:' . port(8080), |
631
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
201 Listen => 5, |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
202 Reuse => 1 |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
203 ) |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
204 or die "Can't create listening socket: $!\n"; |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
205 |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
206 local $SIG{PIPE} = 'IGNORE'; |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
207 |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
208 while (my $client = $server->accept()) { |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
209 $client->autoflush(1); |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
210 |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
211 log2c("(new connection $client)"); |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
212 |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
213 $client->sysread(my $buffer, 65536) or next; |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
214 |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
215 log2i("$client $buffer"); |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
216 |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
217 log2o("$client $buffer"); |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
218 |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
219 $client->syswrite($buffer); |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
220 |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
221 close $client; |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
222 } |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
223 } |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
224 |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
225 sub log2i { Test::Nginx::log_core('|| <<', @_); } |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
226 sub log2o { Test::Nginx::log_core('|| >>', @_); } |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
227 sub log2c { Test::Nginx::log_core('||', @_); } |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
228 |
fca0079e0aab
Tests: stream access tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
diff
changeset
|
229 ############################################################################### |