}
var res = '';
+ var step = (v) => { if (!res || res[res.length - 1] != v) res += v };
function access_step(s) {
- res += '1';
+ step(1);
setTimeout(function() {
if (s.remoteAddress.match('127.0.0.1')) {
function preread_step(s) {
s.on('upload', function (data) {
- res += '2';
- if (res.length >= 3) {
+ step(2);
+ if (data.length > 0) {
s.done();
}
});
function filter_step(s) {
s.on('upload', function(data, flags) {
+ step(3);
s.send(data);
- res += '3';
});
s.on('download', function(data, flags) {
if (!flags.last) {
- res += '4';
+ step(4);
s.send(data);
} else {
- res += '5';
+ step(5);
s.send(res, {last:1});
s.off('download');
}
is(stream('127.0.0.1:' . port(8083))->read(), '', 'stream js unknown function');
is(stream('127.0.0.1:' . port(8084))->read(), 'sess_unk=undefined', 's.unk');
-is(stream('127.0.0.1:' . port(8086))->io('0'), '0122345',
+is(stream('127.0.0.1:' . port(8086))->io('0'), '012345',
'async handlers order');
is(stream('127.0.0.1:' . port(8087))->io('#'), 'OK', 'access_undecided');
is(stream('127.0.0.1:' . port(8088))->io('#'), 'OK', 'access_allow');