Update to RedBrick 2.6.0

This commit is contained in:
Dorian Niemiec 2024-02-16 02:30:11 +01:00
parent 85e40c9396
commit ebd67f5382
2 changed files with 14 additions and 3 deletions

View file

@ -224,7 +224,7 @@ Mod.prototype.callback = function (req, res, serverconsole, responseEnd, href, e
} }
}); });
var dataHandler = function (data) { var dataHandler = function (data) {
buffer += data.toString("latin1"); if (!cned) buffer += data.toString("latin1");
var m = null; var m = null;
if (!cned) m = buffer.match(/(?:\r\n\r\n|\n\r\n\r|\n\n|\r\r)/); if (!cned) m = buffer.match(/(?:\r\n\r\n|\n\r\n\r|\n\n|\r\r)/);
if (!cned && m) { if (!cned && m) {
@ -282,6 +282,8 @@ Mod.prototype.callback = function (req, res, serverconsole, responseEnd, href, e
res.writeHead(code, msg, bheaderso); res.writeHead(code, msg, bheaderso);
res.write(buffer.substr(headerendline + eol.length), "latin1"); res.write(buffer.substr(headerendline + eol.length), "latin1");
} catch (ex) { } catch (ex) {
interpreter.removeAllListeners("exit");
interpreter.stdout.removeAllListeners("data");
if (!callServerError) { if (!callServerError) {
res.writeHead(500); res.writeHead(500);
res.end(ex.stack); res.end(ex.stack);
@ -291,7 +293,11 @@ Mod.prototype.callback = function (req, res, serverconsole, responseEnd, href, e
return; return;
} }
} else { } else {
if (cned && !res.finished) res.write(data); if (cned && !res.finished) {
res.write(data);
interpreter.stdout.removeListener("data", dataHandler);
interpreter.stdout.pipe(res, {end: false});
}
} }
}; };
if (interpreter.stdout) { if (interpreter.stdout) {
@ -310,6 +316,11 @@ Mod.prototype.callback = function (req, res, serverconsole, responseEnd, href, e
callServerError(500, "RedBrick/" + version, ex); callServerError(500, "RedBrick/" + version, ex);
} }
} else { } else {
var preparedStderr = stderr.trim()
if(preparedStderr) {
serverconsole.errmessage("There were CGI application errors:");
serverconsole.errmessage(preparedStderr);
}
res.end(); res.end();
} }
}); });

View file

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