Prevented "write after end" SVR.JS crashes (even more)
This commit is contained in:
parent
f0977c9319
commit
6e882fdbc8
1 changed files with 10 additions and 3 deletions
13
index.js
13
index.js
|
@ -178,7 +178,10 @@ function createFastCGIHandler(options) {
|
||||||
//STDERR will be lost anyway...
|
//STDERR will be lost anyway...
|
||||||
}
|
}
|
||||||
} else if (processedPacket.type == END_REQUEST && processedPacket.content.length > 5) {
|
} else if (processedPacket.type == END_REQUEST && processedPacket.content.length > 5) {
|
||||||
if (typeof socket !== "undefined") socket.removeListener("data", fastCGISocketHandler);
|
if (typeof socket !== "undefined") {
|
||||||
|
socket.removeListener("data", fastCGISocketHandler);
|
||||||
|
processFastCGIPacket = function() {};
|
||||||
|
}
|
||||||
var appStatus = processedPacket.content.readUInt32BE(0);
|
var appStatus = processedPacket.content.readUInt32BE(0);
|
||||||
var protocolStatus = processedPacket.content.readUInt8(4);
|
var protocolStatus = processedPacket.content.readUInt8(4);
|
||||||
if (protocolStatus != REQUEST_COMPLETE) {
|
if (protocolStatus != REQUEST_COMPLETE) {
|
||||||
|
@ -283,6 +286,8 @@ function createFastCGIHandler(options) {
|
||||||
eventEmitter.emit("error", err);
|
eventEmitter.emit("error", err);
|
||||||
}).on("data", fastCGISocketHandler);
|
}).on("data", fastCGISocketHandler);
|
||||||
|
|
||||||
|
eventEmitter.socket = socket;
|
||||||
|
|
||||||
return eventEmitter;
|
return eventEmitter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -465,7 +470,7 @@ Mod.prototype.callback = function (req, res, serverconsole, responseEnd, href, e
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
handler.on("connect", function () {
|
function handlerConnection() {
|
||||||
handler.init();
|
handler.init();
|
||||||
handler.stdout.on("data", dataHandler);
|
handler.stdout.on("data", dataHandler);
|
||||||
handler.stderr.on("data", function (data) {
|
handler.stderr.on("data", function (data) {
|
||||||
|
@ -491,7 +496,9 @@ Mod.prototype.callback = function (req, res, serverconsole, responseEnd, href, e
|
||||||
res.end();
|
res.end();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
}
|
||||||
|
if(typeof handler.socket.connecting == "undefined" || handler.socket.connecting) handler.on("connect", handlerConnection);
|
||||||
|
else if(!handler.socket.destroyed) handlerConnection();
|
||||||
}
|
}
|
||||||
|
|
||||||
function executeFastCGIWithEnv(a, b, req, res, pubip, port, software, dh, user, cPath) {
|
function executeFastCGIWithEnv(a, b, req, res, pubip, port, software, dh, user, cPath) {
|
||||||
|
|
Loading…
Reference in a new issue