annotate stream_js_fetch.t @ 1806:564f74bf6e4d

Tests: added stream fetch tests for js_access directive.
author Dmitry Volyntsev <xeioex@nginx.com>
date Mon, 14 Nov 2022 17:52:23 -0800
parents cadf15e2e2b3
children 7cf848422b28
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1640
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
1 #!/usr/bin/perl
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
2
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
3 # (C) Dmitry Volyntsev
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
4 # (C) Nginx, Inc.
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
5
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
6 # Tests for stream njs module, fetch method.
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
7
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
8 ###############################################################################
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
9
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
10 use warnings;
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
11 use strict;
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
12
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
13 use Test::More;
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
14
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
15 BEGIN { use FindBin; chdir($FindBin::Bin); }
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
16
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
17 use lib 'lib';
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
18 use Test::Nginx;
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
19 use Test::Nginx::Stream qw/ stream /;
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
20
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
21 ###############################################################################
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
22
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
23 select STDERR; $| = 1;
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
24 select STDOUT; $| = 1;
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
25
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
26 my $t = Test::Nginx->new()->has(qw/http stream/)
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
27 ->write_file_expand('nginx.conf', <<'EOF');
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
28
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
29 %%TEST_GLOBALS%%
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
30
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
31 daemon off;
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
32
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
33 events {
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
34 }
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
35
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
36 http {
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
37 %%TEST_GLOBALS_HTTP%%
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
38
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
39 js_import test.js;
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
40
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
41 server {
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
42 listen 127.0.0.1:8080;
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
43 server_name localhost;
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
44
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
45 location /njs {
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
46 js_content test.njs;
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
47 }
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
48 }
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
49
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
50 server {
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
51 listen 127.0.0.1:8080;
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
52 server_name aaa;
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
53
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
54 location /validate {
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
55 js_content test.validate;
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
56 }
1806
564f74bf6e4d Tests: added stream fetch tests for js_access directive.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1786
diff changeset
57
564f74bf6e4d Tests: added stream fetch tests for js_access directive.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1786
diff changeset
58 location /success {
564f74bf6e4d Tests: added stream fetch tests for js_access directive.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1786
diff changeset
59 return 200;
564f74bf6e4d Tests: added stream fetch tests for js_access directive.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1786
diff changeset
60 }
564f74bf6e4d Tests: added stream fetch tests for js_access directive.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1786
diff changeset
61
564f74bf6e4d Tests: added stream fetch tests for js_access directive.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1786
diff changeset
62 location /fail {
564f74bf6e4d Tests: added stream fetch tests for js_access directive.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1786
diff changeset
63 return 403;
564f74bf6e4d Tests: added stream fetch tests for js_access directive.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1786
diff changeset
64 }
1640
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
65 }
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
66 }
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
67
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
68 stream {
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
69 %%TEST_GLOBALS_STREAM%%
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
70
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
71 js_import test.js;
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
72
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
73 server {
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
74 listen 127.0.0.1:8081;
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
75 js_preread test.preread_verify;
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
76 proxy_pass 127.0.0.1:8090;
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
77 }
1785
2c08bfffe112 Tests: added stream js test for s.send() in async context.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1784
diff changeset
78
2c08bfffe112 Tests: added stream js test for s.send() in async context.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1784
diff changeset
79 server {
2c08bfffe112 Tests: added stream js test for s.send() in async context.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1784
diff changeset
80 listen 127.0.0.1:8082;
2c08bfffe112 Tests: added stream js test for s.send() in async context.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1784
diff changeset
81 js_filter test.filter_verify;
2c08bfffe112 Tests: added stream js test for s.send() in async context.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1784
diff changeset
82 proxy_pass 127.0.0.1:8091;
2c08bfffe112 Tests: added stream js test for s.send() in async context.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1784
diff changeset
83 }
1806
564f74bf6e4d Tests: added stream fetch tests for js_access directive.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1786
diff changeset
84
564f74bf6e4d Tests: added stream fetch tests for js_access directive.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1786
diff changeset
85 server {
564f74bf6e4d Tests: added stream fetch tests for js_access directive.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1786
diff changeset
86 listen 127.0.0.1:8083;
564f74bf6e4d Tests: added stream fetch tests for js_access directive.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1786
diff changeset
87 js_access test.access_ok;
564f74bf6e4d Tests: added stream fetch tests for js_access directive.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1786
diff changeset
88 proxy_pass 127.0.0.1:8090;
564f74bf6e4d Tests: added stream fetch tests for js_access directive.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1786
diff changeset
89 }
564f74bf6e4d Tests: added stream fetch tests for js_access directive.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1786
diff changeset
90
564f74bf6e4d Tests: added stream fetch tests for js_access directive.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1786
diff changeset
91 server {
564f74bf6e4d Tests: added stream fetch tests for js_access directive.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1786
diff changeset
92 listen 127.0.0.1:8084;
564f74bf6e4d Tests: added stream fetch tests for js_access directive.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1786
diff changeset
93 js_access test.access_nok;
564f74bf6e4d Tests: added stream fetch tests for js_access directive.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1786
diff changeset
94 proxy_pass 127.0.0.1:8090;
564f74bf6e4d Tests: added stream fetch tests for js_access directive.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1786
diff changeset
95 }
1640
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
96 }
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
97
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
98 EOF
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
99
1641
6b6a496ac984 Tests: fixed stream_js_fetch.t with parallel tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1640
diff changeset
100 my $p = port(8080);
6b6a496ac984 Tests: fixed stream_js_fetch.t with parallel tests.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1640
diff changeset
101
1640
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
102 $t->write_file('test.js', <<EOF);
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
103 function test_njs(r) {
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
104 r.return(200, njs.version);
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
105 }
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
106
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
107 function validate(r) {
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
108 r.return((r.requestText == 'QZ') ? 200 : 403);
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
109 }
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
110
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
111 function preread_verify(s) {
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
112 var collect = Buffer.from([]);
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
113
1784
898598722ad4 Tests: improved stream fetch test with async callbacks.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1641
diff changeset
114 s.on('upstream', async function (data, flags) {
1640
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
115 collect = Buffer.concat([collect, data]);
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
116
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
117 if (collect.length >= 4 && collect.readUInt16BE(0) == 0xabcd) {
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
118 s.off('upstream');
1784
898598722ad4 Tests: improved stream fetch test with async callbacks.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1641
diff changeset
119
898598722ad4 Tests: improved stream fetch test with async callbacks.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1641
diff changeset
120 let reply = await ngx.fetch('http://127.0.0.1:$p/validate',
898598722ad4 Tests: improved stream fetch test with async callbacks.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1641
diff changeset
121 {body: collect.slice(2,4),
898598722ad4 Tests: improved stream fetch test with async callbacks.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1641
diff changeset
122 headers: {Host:'aaa'}});
898598722ad4 Tests: improved stream fetch test with async callbacks.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1641
diff changeset
123
898598722ad4 Tests: improved stream fetch test with async callbacks.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1641
diff changeset
124 (reply.status == 200) ? s.done(): s.deny();
1640
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
125
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
126 } else if (collect.length) {
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
127 s.deny();
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
128 }
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
129 });
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
130 }
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
131
1785
2c08bfffe112 Tests: added stream js test for s.send() in async context.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1784
diff changeset
132 function filter_verify(s) {
2c08bfffe112 Tests: added stream js test for s.send() in async context.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1784
diff changeset
133 var collect = Buffer.from([]);
2c08bfffe112 Tests: added stream js test for s.send() in async context.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1784
diff changeset
134
2c08bfffe112 Tests: added stream js test for s.send() in async context.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1784
diff changeset
135 s.on('upstream', async function (data, flags) {
2c08bfffe112 Tests: added stream js test for s.send() in async context.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1784
diff changeset
136 collect = Buffer.concat([collect, data]);
2c08bfffe112 Tests: added stream js test for s.send() in async context.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1784
diff changeset
137
2c08bfffe112 Tests: added stream js test for s.send() in async context.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1784
diff changeset
138 if (collect.length >= 4 && collect.readUInt16BE(0) == 0xabcd) {
2c08bfffe112 Tests: added stream js test for s.send() in async context.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1784
diff changeset
139 s.off('upstream');
2c08bfffe112 Tests: added stream js test for s.send() in async context.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1784
diff changeset
140
2c08bfffe112 Tests: added stream js test for s.send() in async context.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1784
diff changeset
141 let reply = await ngx.fetch('http://127.0.0.1:$p/validate',
2c08bfffe112 Tests: added stream js test for s.send() in async context.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1784
diff changeset
142 {body: collect.slice(2,4),
2c08bfffe112 Tests: added stream js test for s.send() in async context.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1784
diff changeset
143 headers: {Host:'aaa'}});
2c08bfffe112 Tests: added stream js test for s.send() in async context.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1784
diff changeset
144
2c08bfffe112 Tests: added stream js test for s.send() in async context.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1784
diff changeset
145 if (reply.status == 200) {
2c08bfffe112 Tests: added stream js test for s.send() in async context.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1784
diff changeset
146 s.send(collect.slice(4), flags);
2c08bfffe112 Tests: added stream js test for s.send() in async context.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1784
diff changeset
147
2c08bfffe112 Tests: added stream js test for s.send() in async context.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1784
diff changeset
148 } else {
2c08bfffe112 Tests: added stream js test for s.send() in async context.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1784
diff changeset
149 s.send("__CLOSE__", flags);
2c08bfffe112 Tests: added stream js test for s.send() in async context.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1784
diff changeset
150 }
2c08bfffe112 Tests: added stream js test for s.send() in async context.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1784
diff changeset
151 }
2c08bfffe112 Tests: added stream js test for s.send() in async context.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1784
diff changeset
152 });
2c08bfffe112 Tests: added stream js test for s.send() in async context.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1784
diff changeset
153 }
2c08bfffe112 Tests: added stream js test for s.send() in async context.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1784
diff changeset
154
1806
564f74bf6e4d Tests: added stream fetch tests for js_access directive.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1786
diff changeset
155 async function access_ok(s) {
564f74bf6e4d Tests: added stream fetch tests for js_access directive.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1786
diff changeset
156 let reply = await ngx.fetch('http://127.0.0.1:$p/success',
564f74bf6e4d Tests: added stream fetch tests for js_access directive.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1786
diff changeset
157 {headers: {Host:'aaa'}});
564f74bf6e4d Tests: added stream fetch tests for js_access directive.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1786
diff changeset
158
564f74bf6e4d Tests: added stream fetch tests for js_access directive.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1786
diff changeset
159 (reply.status == 200) ? s.allow(): s.deny();
564f74bf6e4d Tests: added stream fetch tests for js_access directive.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1786
diff changeset
160 }
564f74bf6e4d Tests: added stream fetch tests for js_access directive.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1786
diff changeset
161
564f74bf6e4d Tests: added stream fetch tests for js_access directive.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1786
diff changeset
162 async function access_nok(s) {
564f74bf6e4d Tests: added stream fetch tests for js_access directive.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1786
diff changeset
163 let reply = await ngx.fetch('http://127.0.0.1:$p/fail',
564f74bf6e4d Tests: added stream fetch tests for js_access directive.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1786
diff changeset
164 {headers: {Host:'aaa'}});
564f74bf6e4d Tests: added stream fetch tests for js_access directive.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1786
diff changeset
165
564f74bf6e4d Tests: added stream fetch tests for js_access directive.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1786
diff changeset
166 (reply.status == 200) ? s.allow(): s.deny();
564f74bf6e4d Tests: added stream fetch tests for js_access directive.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1786
diff changeset
167 }
564f74bf6e4d Tests: added stream fetch tests for js_access directive.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1786
diff changeset
168
564f74bf6e4d Tests: added stream fetch tests for js_access directive.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1786
diff changeset
169 export default {njs: test_njs, validate, preread_verify, filter_verify,
564f74bf6e4d Tests: added stream fetch tests for js_access directive.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1786
diff changeset
170 access_ok, access_nok};
1640
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
171 EOF
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
172
1806
564f74bf6e4d Tests: added stream fetch tests for js_access directive.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1786
diff changeset
173 $t->try_run('no stream njs available')->plan(9);
1640
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
174
1785
2c08bfffe112 Tests: added stream js test for s.send() in async context.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1784
diff changeset
175 $t->run_daemon(\&stream_daemon, port(8090), port(8091));
1640
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
176 $t->waitforsocket('127.0.0.1:' . port(8090));
1785
2c08bfffe112 Tests: added stream js test for s.send() in async context.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1784
diff changeset
177 $t->waitforsocket('127.0.0.1:' . port(8091));
1640
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
178
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
179 ###############################################################################
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
180
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
181 local $TODO = 'not yet'
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
182 unless http_get('/njs') =~ /^([.0-9]+)$/m && $1 ge '0.5.1';
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
183
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
184 is(stream('127.0.0.1:' . port(8081))->io('###'), '', 'preread not enough');
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
185 is(stream('127.0.0.1:' . port(8081))->io("\xAB\xCDQZ##"), "\xAB\xCDQZ##",
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
186 'preread validated');
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
187 is(stream('127.0.0.1:' . port(8081))->io("\xAC\xCDQZ##"), '',
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
188 'preread invalid magic');
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
189 is(stream('127.0.0.1:' . port(8081))->io("\xAB\xCDQQ##"), '',
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
190 'preread validation failed');
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
191
1786
cadf15e2e2b3 Tests: adjusted stream_js_fetch.t TODO for njs 0.7.6 and older.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1785
diff changeset
192 TODO: {
cadf15e2e2b3 Tests: adjusted stream_js_fetch.t TODO for njs 0.7.6 and older.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1785
diff changeset
193 todo_skip 'leaves coredump', 3 unless $ENV{TEST_NGINX_UNSAFE}
cadf15e2e2b3 Tests: adjusted stream_js_fetch.t TODO for njs 0.7.6 and older.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1785
diff changeset
194 or http_get('/njs') =~ /^([.0-9]+)$/m && $1 ge '0.7.7';
cadf15e2e2b3 Tests: adjusted stream_js_fetch.t TODO for njs 0.7.6 and older.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1785
diff changeset
195
cadf15e2e2b3 Tests: adjusted stream_js_fetch.t TODO for njs 0.7.6 and older.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1785
diff changeset
196 my $s = stream('127.0.0.1:' . port(8082));
cadf15e2e2b3 Tests: adjusted stream_js_fetch.t TODO for njs 0.7.6 and older.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1785
diff changeset
197 is($s->io("\xAB\xCDQZ##", read => 1), '##', 'filter validated');
cadf15e2e2b3 Tests: adjusted stream_js_fetch.t TODO for njs 0.7.6 and older.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1785
diff changeset
198 is($s->io("@@", read => 1), '@@', 'filter off');
cadf15e2e2b3 Tests: adjusted stream_js_fetch.t TODO for njs 0.7.6 and older.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1785
diff changeset
199
1785
2c08bfffe112 Tests: added stream js test for s.send() in async context.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1784
diff changeset
200 is(stream('127.0.0.1:' . port(8082))->io("\xAB\xCDQQ##"), '',
2c08bfffe112 Tests: added stream js test for s.send() in async context.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1784
diff changeset
201 'filter validation failed');
2c08bfffe112 Tests: added stream js test for s.send() in async context.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1784
diff changeset
202
2c08bfffe112 Tests: added stream js test for s.send() in async context.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1784
diff changeset
203 }
2c08bfffe112 Tests: added stream js test for s.send() in async context.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1784
diff changeset
204
1806
564f74bf6e4d Tests: added stream fetch tests for js_access directive.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1786
diff changeset
205 is(stream('127.0.0.1:' . port(8083))->io('ABC'), 'ABC', 'access fetch ok');
564f74bf6e4d Tests: added stream fetch tests for js_access directive.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1786
diff changeset
206 is(stream('127.0.0.1:' . port(8084))->io('ABC'), '', 'access fetch nok');
564f74bf6e4d Tests: added stream fetch tests for js_access directive.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1786
diff changeset
207
1640
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
208 ###############################################################################
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
209
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
210 sub stream_daemon {
1785
2c08bfffe112 Tests: added stream js test for s.send() in async context.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1784
diff changeset
211 my (@ports) = @_;
2c08bfffe112 Tests: added stream js test for s.send() in async context.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1784
diff changeset
212 my (@socks, @clients);
2c08bfffe112 Tests: added stream js test for s.send() in async context.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1784
diff changeset
213
2c08bfffe112 Tests: added stream js test for s.send() in async context.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1784
diff changeset
214 for my $port (@ports) {
2c08bfffe112 Tests: added stream js test for s.send() in async context.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1784
diff changeset
215 my $server = IO::Socket::INET->new(
2c08bfffe112 Tests: added stream js test for s.send() in async context.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1784
diff changeset
216 Proto => 'tcp',
2c08bfffe112 Tests: added stream js test for s.send() in async context.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1784
diff changeset
217 LocalAddr => "127.0.0.1:$port",
2c08bfffe112 Tests: added stream js test for s.send() in async context.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1784
diff changeset
218 Listen => 5,
2c08bfffe112 Tests: added stream js test for s.send() in async context.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1784
diff changeset
219 Reuse => 1
2c08bfffe112 Tests: added stream js test for s.send() in async context.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1784
diff changeset
220 )
2c08bfffe112 Tests: added stream js test for s.send() in async context.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1784
diff changeset
221 or die "Can't create listening socket: $!\n";
2c08bfffe112 Tests: added stream js test for s.send() in async context.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1784
diff changeset
222 push @socks, $server;
2c08bfffe112 Tests: added stream js test for s.send() in async context.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1784
diff changeset
223 }
2c08bfffe112 Tests: added stream js test for s.send() in async context.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1784
diff changeset
224
2c08bfffe112 Tests: added stream js test for s.send() in async context.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1784
diff changeset
225 my $sel = IO::Select->new(@socks);
1640
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
226
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
227 local $SIG{PIPE} = 'IGNORE';
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
228
1785
2c08bfffe112 Tests: added stream js test for s.send() in async context.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1784
diff changeset
229 while (my @ready = $sel->can_read) {
2c08bfffe112 Tests: added stream js test for s.send() in async context.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1784
diff changeset
230 foreach my $fh (@ready) {
2c08bfffe112 Tests: added stream js test for s.send() in async context.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1784
diff changeset
231 if (grep $_ == $fh, @socks) {
2c08bfffe112 Tests: added stream js test for s.send() in async context.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1784
diff changeset
232 my $new = $fh->accept;
2c08bfffe112 Tests: added stream js test for s.send() in async context.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1784
diff changeset
233 $new->autoflush(1);
2c08bfffe112 Tests: added stream js test for s.send() in async context.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1784
diff changeset
234 $sel->add($new);
1640
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
235
1785
2c08bfffe112 Tests: added stream js test for s.send() in async context.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1784
diff changeset
236 } elsif (stream_handle_client($fh)
2c08bfffe112 Tests: added stream js test for s.send() in async context.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1784
diff changeset
237 || $fh->sockport() == port(8090))
2c08bfffe112 Tests: added stream js test for s.send() in async context.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1784
diff changeset
238 {
2c08bfffe112 Tests: added stream js test for s.send() in async context.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1784
diff changeset
239 $sel->remove($fh);
2c08bfffe112 Tests: added stream js test for s.send() in async context.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1784
diff changeset
240 $fh->close;
2c08bfffe112 Tests: added stream js test for s.send() in async context.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1784
diff changeset
241 }
2c08bfffe112 Tests: added stream js test for s.send() in async context.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1784
diff changeset
242 }
2c08bfffe112 Tests: added stream js test for s.send() in async context.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1784
diff changeset
243 }
2c08bfffe112 Tests: added stream js test for s.send() in async context.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1784
diff changeset
244 }
1640
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
245
1785
2c08bfffe112 Tests: added stream js test for s.send() in async context.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1784
diff changeset
246 sub stream_handle_client {
2c08bfffe112 Tests: added stream js test for s.send() in async context.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1784
diff changeset
247 my ($client) = @_;
1640
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
248
1785
2c08bfffe112 Tests: added stream js test for s.send() in async context.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1784
diff changeset
249 log2c("(new connection $client)");
2c08bfffe112 Tests: added stream js test for s.send() in async context.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1784
diff changeset
250
2c08bfffe112 Tests: added stream js test for s.send() in async context.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1784
diff changeset
251 $client->sysread(my $buffer, 65536) or return 1;
2c08bfffe112 Tests: added stream js test for s.send() in async context.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1784
diff changeset
252
2c08bfffe112 Tests: added stream js test for s.send() in async context.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1784
diff changeset
253 log2i("$client $buffer");
1640
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
254
1785
2c08bfffe112 Tests: added stream js test for s.send() in async context.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1784
diff changeset
255 if ($buffer eq "__CLOSE__") {
2c08bfffe112 Tests: added stream js test for s.send() in async context.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1784
diff changeset
256 return 1;
2c08bfffe112 Tests: added stream js test for s.send() in async context.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1784
diff changeset
257 }
1640
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
258
1785
2c08bfffe112 Tests: added stream js test for s.send() in async context.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1784
diff changeset
259 log2o("$client $buffer");
2c08bfffe112 Tests: added stream js test for s.send() in async context.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1784
diff changeset
260
2c08bfffe112 Tests: added stream js test for s.send() in async context.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1784
diff changeset
261 $client->syswrite($buffer);
2c08bfffe112 Tests: added stream js test for s.send() in async context.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1784
diff changeset
262
2c08bfffe112 Tests: added stream js test for s.send() in async context.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1784
diff changeset
263 return 0;
1640
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
264 }
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
265
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
266 sub log2i { Test::Nginx::log_core('|| <<', @_); }
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
267 sub log2o { Test::Nginx::log_core('|| >>', @_); }
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
268 sub log2c { Test::Nginx::log_core('||', @_); }
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
269
67adc5fd0548 Tests: added js tests for ngx.fetch() method.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
diff changeset
270 ###############################################################################