forked from svrjs/svrjs
Update to SVR.JS 3.7.4
This commit is contained in:
parent
e0f0cb69d8
commit
750a312b2f
4 changed files with 61 additions and 36 deletions
|
@ -1,7 +1,7 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>SVR.JS 3.7.3</title>
|
<title>SVR.JS 3.7.4</title>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<style>
|
<style>
|
||||||
|
@ -12,7 +12,7 @@
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h1>Welcome to SVR.JS 3.7.3</h1>
|
<h1>Welcome to SVR.JS 3.7.4</h1>
|
||||||
<br/>
|
<br/>
|
||||||
<img src="/logo.png" style="width: 256px;" />
|
<img src="/logo.png" style="width: 256px;" />
|
||||||
<br/>
|
<br/>
|
||||||
|
@ -110,7 +110,7 @@
|
||||||
</div>
|
</div>
|
||||||
<p>Changes:</p>
|
<p>Changes:</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li>Fixed server crashes while one of two ports are in use</li>
|
<li>Added reverse DNS lookup support.</li>
|
||||||
</ul>
|
</ul>
|
||||||
<p>Bugs:</p>
|
<p>Bugs:</p>
|
||||||
<ul>
|
<ul>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>SVR.JS 3.7.3 Licenses</title>
|
<title>SVR.JS 3.7.4 Licenses</title>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<style>
|
<style>
|
||||||
|
@ -12,8 +12,8 @@
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h1>SVR.JS 3.7.3 Licenses</h1>
|
<h1>SVR.JS 3.7.4 Licenses</h1>
|
||||||
<h2>SVR.JS 3.7.3</h2>
|
<h2>SVR.JS 3.7.4</h2>
|
||||||
<div style="display: inline-block; text-align: left; border-width: 2px; border-style: solid; border-color: gray; padding: 8px;">
|
<div style="display: inline-block; text-align: left; border-width: 2px; border-style: solid; border-color: gray; padding: 8px;">
|
||||||
MIT License<br/>
|
MIT License<br/>
|
||||||
<br/>
|
<br/>
|
||||||
|
@ -37,7 +37,7 @@
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE<br/>
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE<br/>
|
||||||
SOFTWARE.<br/>
|
SOFTWARE.<br/>
|
||||||
</div>
|
</div>
|
||||||
<h2>Packages used by SVR.JS 3.7.3 and utilities</h2>
|
<h2>Packages used by SVR.JS 3.7.4 and utilities</h2>
|
||||||
<div style="width: 100%; background-color: #ccc; border: 1px solid green; text-align: left; margin: 10px 0;">
|
<div style="width: 100%; background-color: #ccc; border: 1px solid green; text-align: left; margin: 10px 0;">
|
||||||
<div style="float: right;">License: MIT</div>
|
<div style="float: right;">License: MIT</div>
|
||||||
<div style="font-size: 20px;">
|
<div style="font-size: 20px;">
|
||||||
|
|
79
svr.js
79
svr.js
|
@ -81,7 +81,7 @@ function deleteFolderRecursive(path) {
|
||||||
}
|
}
|
||||||
|
|
||||||
var os = require("os");
|
var os = require("os");
|
||||||
var version = "3.7.3";
|
var version = "3.7.4";
|
||||||
var singlethreaded = false;
|
var singlethreaded = false;
|
||||||
|
|
||||||
if (process.versions) process.versions.svrjs = version; //Inject SVR.JS into process.versions
|
if (process.versions) process.versions.svrjs = version; //Inject SVR.JS into process.versions
|
||||||
|
@ -357,6 +357,7 @@ http.STATUS_CODES[497] = "HTTP Request Sent to HTTPS Port";
|
||||||
http.STATUS_CODES[598] = "Network Read Timeout Error";
|
http.STATUS_CODES[598] = "Network Read Timeout Error";
|
||||||
http.STATUS_CODES[599] = "Network Connect Timeout Error";
|
http.STATUS_CODES[599] = "Network Connect Timeout Error";
|
||||||
var url = require("url");
|
var url = require("url");
|
||||||
|
var dns = require("dns");
|
||||||
try {
|
try {
|
||||||
var gracefulFs = require("graceful-fs");
|
var gracefulFs = require("graceful-fs");
|
||||||
if (!process.isBun) gracefulFs.gracefulify(fs); //Bun + graceful-fs + SVR.JS + requests about static content = 500 Internal Server Error!
|
if (!process.isBun) gracefulFs.gracefulify(fs); //Bun + graceful-fs + SVR.JS + requests about static content = 500 Internal Server Error!
|
||||||
|
@ -865,21 +866,33 @@ if (host != "[offline]" || ifaceEx) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
pubip = d.toString();
|
pubip = d.toString();
|
||||||
if (!domain) {
|
if (domain) {
|
||||||
if (pubip.indexOf(":") == -1) {
|
ipRequestCompleted = true;
|
||||||
var parts = pubip.split(".");
|
process.emit("ipRequestCompleted");
|
||||||
var p1 = parseInt(parts[0]).toString(16);
|
} else {
|
||||||
var p2 = parseInt(parts[1]).toString(16);
|
var callbackDone = false;
|
||||||
var p3 = parseInt(parts[2]).toString(16);
|
|
||||||
var p4 = parseInt(parts[3]).toString(16);
|
var dnsTimeout = setTimeout(function() {
|
||||||
var pp = parseInt(pubport).toString(16);
|
callbackDone = true;
|
||||||
domain = p1 + p2 + p3 + p4 + pp + ".nodesvr.doriantech.com";
|
ipRequestCompleted = true;
|
||||||
} else {
|
process.emit("ipRequestCompleted");
|
||||||
domain = pubip.replace(/[^0-9a-zA-Z]/gi, "").toLowerCase() + ".nodesvrip6.doriantech.com";
|
}, 3000);
|
||||||
|
|
||||||
|
try {
|
||||||
|
dns.reverse(pubip, function(err, hostnames) {
|
||||||
|
if(callbackDone) return;
|
||||||
|
clearTimeout(dnsTimeout);
|
||||||
|
if(!err && hostnames.length > 0) domain = hostnames[0];
|
||||||
|
ipRequestCompleted = true;
|
||||||
|
process.emit("ipRequestCompleted");
|
||||||
|
});
|
||||||
|
} catch(err) {
|
||||||
|
clearTimeout(dnsTimeout);
|
||||||
|
callbackDone = true;
|
||||||
|
ipRequestCompleted = true;
|
||||||
|
process.emit("ipRequestCompleted");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ipRequestCompleted = true;
|
|
||||||
process.emit("ipRequestCompleted");
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
ipRequest.on("error", function () {
|
ipRequest.on("error", function () {
|
||||||
|
@ -917,21 +930,33 @@ if (host != "[offline]" || ifaceEx) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
pubip = d.toString();
|
pubip = d.toString();
|
||||||
if (!domain) {
|
if (domain) {
|
||||||
if (pubip.indexOf(":") == -1) {
|
ipRequestCompleted = true;
|
||||||
var parts = pubip.split(".");
|
process.emit("ipRequestCompleted");
|
||||||
var p1 = parseInt(parts[0]).toString(16);
|
} else {
|
||||||
var p2 = parseInt(parts[1]).toString(16);
|
var callbackDone = false;
|
||||||
var p3 = parseInt(parts[2]).toString(16);
|
|
||||||
var p4 = parseInt(parts[3]).toString(16);
|
var dnsTimeout = setTimeout(function() {
|
||||||
var pp = parseInt(pubport).toString(16);
|
callbackDone = true;
|
||||||
domain = p1 + p2 + p3 + p4 + pp + ".nodesvr.doriantech.com";
|
ipRequestCompleted = true;
|
||||||
} else {
|
process.emit("ipRequestCompleted");
|
||||||
domain = pubip.replace(/[^0-9a-zA-Z]/gi, "").toLowerCase() + ".nodesvrip6.doriantech.com";
|
}, 3000);
|
||||||
|
|
||||||
|
try {
|
||||||
|
dns.reverse(pubip, function(err, hostnames) {
|
||||||
|
if(callbackDone) return;
|
||||||
|
clearTimeout(dnsTimeout);
|
||||||
|
if(!err && hostnames.length > 0) domain = hostnames[0];
|
||||||
|
ipRequestCompleted = true;
|
||||||
|
process.emit("ipRequestCompleted");
|
||||||
|
});
|
||||||
|
} catch(err) {
|
||||||
|
clearTimeout(dnsTimeout);
|
||||||
|
callbackDone = true;
|
||||||
|
ipRequestCompleted = true;
|
||||||
|
process.emit("ipRequestCompleted");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ipRequestCompleted = true;
|
|
||||||
process.emit("ipRequestCompleted");
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
ipRequest2.on("error", function () {
|
ipRequest2.on("error", function () {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>SVR.JS 3.7.3 Tests</title>
|
<title>SVR.JS 3.7.4 Tests</title>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<style>
|
<style>
|
||||||
|
@ -12,7 +12,7 @@
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h1>SVR.JS 3.7.3 Tests</h1>
|
<h1>SVR.JS 3.7.4 Tests</h1>
|
||||||
<h2>Directory</h2>
|
<h2>Directory</h2>
|
||||||
<iframe src="/testdir" width="50%" height="300px"></iframe>
|
<iframe src="/testdir" width="50%" height="300px"></iframe>
|
||||||
<h2>Directory (with query)</h2>
|
<h2>Directory (with query)</h2>
|
||||||
|
|
Reference in a new issue