@@ -70,6 +70,8 @@ stream {
70
70
71
71
js_include test.js;
72
72
73
+ log_format status $server_port:$status;
74
+
73
75
server {
74
76
listen 127.0.0.1:8080;
75
77
return $js_addr;
@@ -112,18 +114,21 @@ stream {
112
114
listen 127.0.0.1:8087;
113
115
js_access js_access_undecided;
114
116
return OK;
117
+ access_log %%TESTDIR%%/status.log status;
115
118
}
116
119
117
120
server {
118
121
listen 127.0.0.1:8088;
119
122
js_access js_access_allow;
120
123
return OK;
124
+ access_log %%TESTDIR%%/status.log status;
121
125
}
122
126
123
127
server {
124
128
listen 127.0.0.1:8089;
125
129
js_access js_access_deny;
126
130
return OK;
131
+ access_log %%TESTDIR%%/status.log status;
127
132
}
128
133
129
134
server {
@@ -255,12 +260,12 @@ $t->write_file('test.js', <<EOF);
255
260
return;
256
261
}
257
262
258
- s.abort ();
263
+ s.deny ();
259
264
}
260
265
261
266
function js_access_deny(s) {
262
267
if (s.remoteAddress.match('127.0.0.1')) {
263
- s.abort ();
268
+ s.deny ();
264
269
return;
265
270
}
266
271
@@ -354,7 +359,7 @@ $t->write_file('test.js', <<EOF);
354
359
EOF
355
360
356
361
$t -> run_daemon(\&stream_daemon, port(8090));
357
- $t -> try_run(' no stream njs available' )-> plan(19 );
362
+ $t -> try_run(' no stream njs available' )-> plan(22 );
358
363
$t -> waitforsocket(' 127.0.0.1:' . port(8090));
359
364
360
365
# ##############################################################################
@@ -395,6 +400,11 @@ ok(index($t->read_file('error.log'), 'at fs.readFileSync') > 0,
395
400
ok(index ($t -> read_file(' error.log' ), ' at js_filter_except' ) > 0,
396
401
' stream js_filter backtrace' );
397
402
403
+ my @p = (port(8087), port(8088), port(8089));
404
+ like($t -> read_file(' status.log' ), qr /$p [0]:200/ , ' status undecided' );
405
+ like($t -> read_file(' status.log' ), qr /$p [1]:200/ , ' status allow' );
406
+ like($t -> read_file(' status.log' ), qr /$p [2]:403/ , ' status deny' );
407
+
398
408
# ##############################################################################
399
409
400
410
sub stream_daemon {
0 commit comments