forked from svrjs/svrjs
Update to SVR.JS 3.14.14
This commit is contained in:
parent
1c6e707f58
commit
5e031fe997
4 changed files with 50 additions and 23 deletions
|
@ -1,7 +1,7 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>SVR.JS 3.14.13</title>
|
<title>SVR.JS 3.14.14</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.14.13</h1>
|
<h1>Welcome to SVR.JS 3.14.14</h1>
|
||||||
<br/>
|
<br/>
|
||||||
<img src="/logo.png" style="width: 256px; max-width: 100%;" />
|
<img src="/logo.png" style="width: 256px; max-width: 100%;" />
|
||||||
<br/>
|
<br/>
|
||||||
|
@ -84,8 +84,8 @@
|
||||||
</code>
|
</code>
|
||||||
<p>Changes:</p>
|
<p>Changes:</p>
|
||||||
<ul style="display: inline-block; margin: 0;">
|
<ul style="display: inline-block; margin: 0;">
|
||||||
<li>Optimized code.</li>
|
<li><i>console.log</i> and <i>stdout</i> are now disabled, when <i>stdout</i> is not a TTY (for example in situation when SVR.JS is running as a daemon), in order to improve performance.</li>
|
||||||
<li>SVR.JS now uses <i>os.availableParallelism()</i> function for determining amount of processes to fork, when it is available.</li>
|
<li>Errors that occurred, while adding SNI context to a server are now ignored.</li>
|
||||||
</ul>
|
</ul>
|
||||||
<p>
|
<p>
|
||||||
<a href="/tests.html">Tests</a><br/>
|
<a href="/tests.html">Tests</a><br/>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>SVR.JS 3.14.13 Licenses</title>
|
<title>SVR.JS 3.14.14 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.14.13 Licenses</h1>
|
<h1>SVR.JS 3.14.14 Licenses</h1>
|
||||||
<h2>SVR.JS 3.14.13</h2>
|
<h2>SVR.JS 3.14.14</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.14.13</h2>
|
<h2>Packages used by SVR.JS 3.14.14</h2>
|
||||||
<div style="width: 100%; max-width: 1280px; margin: auto">
|
<div style="width: 100%; max-width: 1280px; margin: auto">
|
||||||
<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>
|
||||||
|
|
53
svr.js
53
svr.js
|
@ -69,7 +69,7 @@ function deleteFolderRecursive(path) {
|
||||||
}
|
}
|
||||||
|
|
||||||
var os = require("os");
|
var os = require("os");
|
||||||
var version = "3.14.13";
|
var version = "3.14.14";
|
||||||
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
|
||||||
|
@ -390,6 +390,12 @@ try {
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
// Don't use hexstrbase64
|
// Don't use hexstrbase64
|
||||||
}
|
}
|
||||||
|
var inspector = undefined;
|
||||||
|
try {
|
||||||
|
inspector = require("inspector");
|
||||||
|
} catch (err) {
|
||||||
|
// Don't use inspector
|
||||||
|
}
|
||||||
var zlib = require("zlib");
|
var zlib = require("zlib");
|
||||||
var tar = undefined;
|
var tar = undefined;
|
||||||
try {
|
try {
|
||||||
|
@ -934,6 +940,23 @@ function calculateNetworkIPv4FromCidr(ipWithCidr) {
|
||||||
}).join(".");
|
}).join(".");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var inspectorURL = undefined;
|
||||||
|
try {
|
||||||
|
if (inspector) {
|
||||||
|
inspectorURL = inspector.url();
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
// Failed to get inspector URL
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!process.stdout.isTTY && !inspectorURL) {
|
||||||
|
// When stdout is not a terminal and not attached to an Node.JS inspector, disable it to improve performance of SVR.JS
|
||||||
|
console.log = function () {};
|
||||||
|
process.stdout.write = function () {};
|
||||||
|
process.stdout._write = function () {};
|
||||||
|
process.stdout._writev = function () {};
|
||||||
|
}
|
||||||
|
|
||||||
// IP and network inteface-related
|
// IP and network inteface-related
|
||||||
var ifaces = {};
|
var ifaces = {};
|
||||||
var ifaceEx = null;
|
var ifaceEx = null;
|
||||||
|
@ -2163,19 +2186,23 @@ if (!cluster.isPrimary) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (secure) {
|
if (secure) {
|
||||||
sniCredentials.forEach(function (sniCredentialsSingle) {
|
try {
|
||||||
server.addContext(sniCredentialsSingle.name, {
|
sniCredentials.forEach(function (sniCredentialsSingle) {
|
||||||
cert: sniCredentialsSingle.cert,
|
server.addContext(sniCredentialsSingle.name, {
|
||||||
key: sniCredentialsSingle.key
|
cert: sniCredentialsSingle.cert,
|
||||||
|
key: sniCredentialsSingle.key
|
||||||
|
});
|
||||||
|
try {
|
||||||
|
var snMatches = sniCredentialsSingle.name.match(/^([^:[]*|\[[^]]*\]?)((?::.*)?)$/);
|
||||||
|
if (!snMatches[1][0].match(/^\.+$/)) snMatches[1][0] = snMatches[1][0].replace(/\.+$/, "");
|
||||||
|
server._contexts[server._contexts.length - 1][0] = new RegExp("^" + snMatches[1].replace(/([.^$+?\-\\[\]{}])/g, "\\$1").replace(/\*/g, "[^.:]*") + ((snMatches[1][0] == "[" || snMatches[1].match(/^(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])\.(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])\.(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])\.(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])$/)) ? "" : "\.?") + snMatches[2].replace(/([.^$+?\-\\[\]{}])/g, "\\$1").replace(/\*/g, "[^.]*") + "$", "i");
|
||||||
|
} catch (ex) {
|
||||||
|
// Can't replace regex, ignoring...
|
||||||
|
}
|
||||||
});
|
});
|
||||||
try {
|
} catch (err) {
|
||||||
var snMatches = sniCredentialsSingle.name.match(/^([^:[]*|\[[^]]*\]?)((?::.*)?)$/);
|
// SNI error
|
||||||
if (!snMatches[1][0].match(/^\.+$/)) snMatches[1][0] = snMatches[1][0].replace(/\.+$/, "");
|
}
|
||||||
server._contexts[server._contexts.length - 1][0] = new RegExp("^" + snMatches[1].replace(/([.^$+?\-\\[\]{}])/g, "\\$1").replace(/\*/g, "[^.:]*") + ((snMatches[1][0] == "[" || snMatches[1].match(/^(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])\.(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])\.(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])\.(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])$/)) ? "" : "\.?") + snMatches[2].replace(/([.^$+?\-\\[\]{}])/g, "\\$1").replace(/\*/g, "[^.]*") + "$", "i");
|
|
||||||
} catch (ex) {
|
|
||||||
// Can't replace regex, ignoring...
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
server.on("request", reqhandler);
|
server.on("request", reqhandler);
|
||||||
server.on("checkExpectation", reqhandler);
|
server.on("checkExpectation", reqhandler);
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>SVR.JS 3.14.13 Tests</title>
|
<title>SVR.JS 3.14.14 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.14.13 Tests</h1>
|
<h1>SVR.JS 3.14.14 Tests</h1>
|
||||||
<h2>Directory (without trailing slash)</h2>
|
<h2>Directory (without trailing slash)</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