From 8050fc766e226f04df061b61c9f869ad5e1f3e86 Mon Sep 17 00:00:00 2001 From: Dorian Niemiec Date: Mon, 11 Sep 2023 23:21:14 +0200 Subject: [PATCH] Partially revert commit 193cede707efff6106405052c622b56cf515db0c --- svr.js | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/svr.js b/svr.js index fb7c0d2..fb9beeb 100644 --- a/svr.js +++ b/svr.js @@ -2329,10 +2329,9 @@ if (!cluster.isPrimary) { var head = fs.existsSync("./.head") ? fs.readFileSync("./.head").toString() : (fs.existsSync("./head.html") ? fs.readFileSync("./head.html").toString() : ""); // header var foot = fs.existsSync("./.foot") ? fs.readFileSync("./.foot").toString() : (fs.existsSync("./foot.html") ? fs.readFileSync("./foot.html").toString() : ""); // footer - function responseEnd(d) { - res.write(head); - res.write(d); - res.write(foot); + function responseEnd(body) { + //If body is Buffer, then it is converted to String anyway. + res.write(head + body + foot); res.end(); } @@ -2961,10 +2960,9 @@ if (!cluster.isPrimary) { var head = fs.existsSync("./.head") ? fs.readFileSync("./.head").toString() : (fs.existsSync("./head.html") ? fs.readFileSync("./head.html").toString() : ""); // header var foot = fs.existsSync("./.foot") ? fs.readFileSync("./.foot").toString() : (fs.existsSync("./foot.html") ? fs.readFileSync("./foot.html").toString() : ""); // footer - function responseEnd(d) { - res.write(head); - res.write(d); - res.write(foot); + function responseEnd(body) { + //If body is Buffer, then it is converted to String anyway. + res.write(head + body + foot); res.end(); }