1
0
Fork 0
forked from svrjs/svrjs

Fixed SVR.JS crashes with X-SVR-JS-From-Main-Thread header and unspecified client request IPs

This commit is contained in:
Dorian Niemiec 2024-02-02 19:23:45 +01:00
parent 4d69f6f1a7
commit 88e923ffbc

2
svr.js
View file

@ -2953,7 +2953,7 @@ if (!cluster.isPrimary) {
} }
} }
if (req.headers["x-svr-js-from-main-thread"] == "true" && (!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)) { 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)) {
var headers = getCustomHeaders(); var headers = getCustomHeaders();
res.writeHead(204, "No Content", headers); res.writeHead(204, "No Content", headers);
res.end(); res.end();