diff --git a/src/handlers/requestHandler.js b/src/handlers/requestHandler.js index 5550dde..0283f2f 100644 --- a/src/handlers/requestHandler.js +++ b/src/handlers/requestHandler.js @@ -126,12 +126,12 @@ function requestHandler(req, res) { } } - /*if (req.headers["x-svr-js-from-main-thread"] == "true" && req.socket && (!req.socket.remoteAddress || req.socket.remoteAddress == "::1" || req.socket.remoteAddress == "::ffff:127.0.0.1" || req.socket.remoteAddress == "127.0.0.1" || req.socket.remoteAddress == "localhost" || req.socket.remoteAddress == host || req.socket.remoteAddress == "::ffff:" + host)) { - let headers = config.getCustomHeaders(); - res.writeHead(204, http.STATUS_CODES[204], headers); - res.end(); - return; - }*/ + if (req.headers["x-svr-js-from-main-thread"] == "true" && req.socket && (!req.socket.remoteAddress || req.socket.remoteAddress == "::1" || req.socket.remoteAddress == "::ffff:127.0.0.1" || req.socket.remoteAddress == "127.0.0.1" || req.socket.remoteAddress == "localhost" || req.socket.remoteAddress == host || req.socket.remoteAddress == "::ffff:" + host)) { + let headers = config.getCustomHeaders(); + res.writeHead(204, http.STATUS_CODES[204], headers); + res.end(); + return; + } req.url = fixNodeMojibakeURL(req.url); diff --git a/src/index.js b/src/index.js index 45ca7be..918b9eb 100644 --- a/src/index.js +++ b/src/index.js @@ -746,6 +746,7 @@ const serverErrorHandler = require("./handlers/serverErrorHandler.js")( ); let reqcounterKillReq = 0; +let closedMaster = false; // TODO: closedMaster let server = {}; let server2 = {}; @@ -1769,11 +1770,11 @@ function start(init) { } });*/ - /* + // Hangup check and restart setInterval(function () { if (!closedMaster && !exiting) { - var chksocket = {}; + let chksocket = {}; if (process.serverConfig.secure && process.serverConfig.disableNonEncryptedServer) { chksocket = https.get({ hostname: (typeof process.serverConfig.sport == "number" && sListenAddress) ? sListenAddress : "localhost", @@ -1839,7 +1840,7 @@ function start(init) { socketPath: (typeof process.serverConfig.port == "number") ? undefined : process.serverConfig.port, headers: { "X-SVR-JS-From-Main-Thread": "true", - "User-Agent": (exposeServerVersion ? "SVR.JS/" + version + " (" + getOS() + "; " + (process.isBun ? ("Bun/v" + process.versions.bun + "; like Node.JS/" + process.version) : ("Node.JS/" + process.version)) + ")" : "SVR.JS") + "User-Agent": generateServerString(true) }, timeout: 1620 }, function (res) { @@ -1859,7 +1860,7 @@ function start(init) { }); } } - }, 4550);*/ + }, 4550); /* // Termination of unused good workers