Update to GreenRhombus 1.0.2

This commit is contained in:
Dorian Niemiec 2024-02-20 00:10:19 +01:00
parent da71e8d868
commit 6b2e88c6ab
2 changed files with 10 additions and 4 deletions

View file

@ -168,7 +168,11 @@ function createFastCGIHandler(options) {
if (processedPacket.type == STDOUT) { if (processedPacket.type == STDOUT) {
if(processedPacket.content.length > 0) emulatedStdout.push(processedPacket.content); if(processedPacket.content.length > 0) emulatedStdout.push(processedPacket.content);
} else if (processedPacket.type == STDERR) { } else if (processedPacket.type == STDERR) {
try {
if(processedPacket.content.length > 0) emulatedStderr.push(processedPacket.content); if(processedPacket.content.length > 0) emulatedStderr.push(processedPacket.content);
} catch (err) {
//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);
var appStatus = processedPacket.content.readUInt32BE(0); var appStatus = processedPacket.content.readUInt32BE(0);
@ -185,22 +189,24 @@ function createFastCGIHandler(options) {
err = new Error("Multiplexed connections not supported by the FastCGI application"); err = new Error("Multiplexed connections not supported by the FastCGI application");
} }
emulatedStdout.push(null); emulatedStdout.push(null);
emulatedStderr.push(null);
if (emulatedStdout._readableState && emulatedStdout._readableState.length > 0 && emulatedStdout._readableState.flowing !== null) { if (emulatedStdout._readableState && emulatedStdout._readableState.length > 0 && emulatedStdout._readableState.flowing !== null) {
emulatedStdout.on("end", function() { emulatedStdout.on("end", function() {
emulatedStderr.push(null);
eventEmitter.emit("error", err); eventEmitter.emit("error", err);
}); });
} else { } else {
emulatedStderr.push(null);
eventEmitter.emit("error", err); eventEmitter.emit("error", err);
} }
} else { } else {
emulatedStdout.push(null); emulatedStdout.push(null);
emulatedStderr.push(null);
if (emulatedStdout._readableState && emulatedStdout._readableState.length > 0 && emulatedStdout._readableState.flowing !== null) { if (emulatedStdout._readableState && emulatedStdout._readableState.length > 0 && emulatedStdout._readableState.flowing !== null) {
emulatedStdout.on("end", function() { emulatedStdout.on("end", function() {
emulatedStderr.push(null);
eventEmitter.emit("exit", appStatus, null); eventEmitter.emit("exit", appStatus, null);
}); });
} else { } else {
emulatedStderr.push(null);
eventEmitter.emit("exit", appStatus, null); eventEmitter.emit("exit", appStatus, null);
} }
} }

View file

@ -1,4 +1,4 @@
{ {
"name": "GreenRhombus FastCGI client for SVR.JS", "name": "GreenRhombus FastCGI client for SVR.JS",
"version": "1.0.1" "version": "1.0.2"
} }