Update to OrangeCircle 1.2.0

This commit is contained in:
Dorian Niemiec 2024-02-16 02:37:49 +01:00
parent c1e3bb9620
commit 1008f65b7d
2 changed files with 11 additions and 4 deletions

View file

@ -89,6 +89,7 @@ Mod.prototype.callback = function (req, res, serverconsole, responseEnd, href, e
}
var abheaders = JSON.parse(JSON.stringify(bheaders));
var socket = {};
function executeSCGI(req, res, dh, nEnv) {
// Function to execute SCGI scripts
@ -101,7 +102,7 @@ Mod.prototype.callback = function (req, res, serverconsole, responseEnd, href, e
var headerendline = -1;
var cned = false;
var dataHandler = function (data) {
buffer += data.toString("latin1");
if (!cned) buffer += data.toString("latin1");
var m = null;
if (!cned) m = buffer.match(/(?:\r\n\r\n|\n\r\n\r|\n\n|\r\r)/);
if (!cned && m) {
@ -152,6 +153,8 @@ Mod.prototype.callback = function (req, res, serverconsole, responseEnd, href, e
res.writeHead(code, msg, bheaderso);
res.write(buffer.substr(headerendline + eol.length), "latin1");
} catch (ex) {
socket.removeAllListeners("data");
socket.removeAllListeners("end");
if (!callServerError) {
res.writeHead(500);
res.end(ex.stack);
@ -161,11 +164,15 @@ Mod.prototype.callback = function (req, res, serverconsole, responseEnd, href, e
return;
}
} else {
if (cned && !res.finished) res.write(data);
if (cned && !res.finished) {
res.write(data);
socket.removeListener("data", dataHandler);
socket.pipe(res, {end: false});
}
}
};
var socket = net.createConnection({
socket = net.createConnection({
host: scgiConf.host,
port: scgiConf.port,
}, function () {

View file

@ -1,4 +1,4 @@
{
"name": "OrangeCircle SCGI client for SVR.JS",
"version": "1.1.3"
"version": "1.2.0"
}