Update to RedBrick 2.6.1

This commit is contained in:
Dorian Niemiec 2024-03-29 04:09:44 +01:00
parent ebd67f5382
commit c45349c677
2 changed files with 12 additions and 2 deletions

View file

@ -297,9 +297,17 @@ Mod.prototype.callback = function (req, res, serverconsole, responseEnd, href, e
res.write(data); res.write(data);
interpreter.stdout.removeListener("data", dataHandler); interpreter.stdout.removeListener("data", dataHandler);
interpreter.stdout.pipe(res, {end: false}); interpreter.stdout.pipe(res, {end: false});
dataHandler = function () {}; //Prevent event listener memory leaks
} }
} }
}; };
res.prependListener("close", function() {
if(interpreter.stdout) interpreter.stdout.unpipe(res); //Prevent server crashes with write after the end
});
res.on("error", function() {}); //Suppress response stream errors
if (interpreter.stdout) { if (interpreter.stdout) {
interpreter.stdout.on("data", dataHandler); interpreter.stdout.on("data", dataHandler);
interpreter.stderr.on("data", function (data) { interpreter.stderr.on("data", function (data) {
@ -321,7 +329,9 @@ Mod.prototype.callback = function (req, res, serverconsole, responseEnd, href, e
serverconsole.errmessage("There were CGI application errors:"); serverconsole.errmessage("There were CGI application errors:");
serverconsole.errmessage(preparedStderr); serverconsole.errmessage(preparedStderr);
} }
res.end(); interpreter.stdout.removeListener("data", dataHandler);
interpreter.stdout.unpipe(res); //Prevent server crashes with write after the end
if(!res.finished) res.end();
} }
}); });
} }

View file

@ -1,4 +1,4 @@
{ {
"name": "RedBrick CGI engine for SVR.JS", "name": "RedBrick CGI engine for SVR.JS",
"version": "2.6.0" "version": "2.6.1"
} }