create-servers
Advanced tools
Comparing version 3.2.1 to 3.3.0
21
index.js
@@ -119,3 +119,4 @@ 'use strict'; | ||
handler: httpConfig.handler || baseConfig.handler, | ||
timeout: httpConfig.timeout || baseConfig.timeout | ||
timeout: httpConfig.timeout || baseConfig.timeout, | ||
keepAliveTimeout: httpConfig.keepAliveTimeout || baseConfig.keepAliveTimeout | ||
}; | ||
@@ -142,3 +143,4 @@ | ||
handler: httpsConfig.handler || baseConfig.handler, | ||
timeout: httpsConfig.timeout || baseConfig.timeout | ||
timeout: httpsConfig.timeout || baseConfig.timeout, | ||
keepAliveTimeout: httpsConfig.keepAliveTimeout || baseConfig.keepAliveTimeout | ||
}; | ||
@@ -300,6 +302,5 @@ | ||
server = require('http').createServer(httpConfig.handler), | ||
timeout = httpConfig.timeout, | ||
port = httpConfig.port; | ||
if (typeof timeout === 'number') server.setTimeout(timeout); | ||
commonPostCreateSetup(httpConfig, server); | ||
@@ -369,4 +370,3 @@ const args = [server, port]; | ||
const timeout = ssl.timeout; | ||
if (typeof timeout === 'number') server.setTimeout(timeout); | ||
commonPostCreateSetup(ssl, server); | ||
const args = [server, port]; | ||
@@ -402,1 +402,10 @@ if (ssl.host) { | ||
} | ||
function commonPostCreateSetup({ timeout, keepAliveTimeout }, server) { | ||
if (typeof timeout === 'number') { | ||
server.setTimeout(timeout); | ||
} | ||
if (typeof keepAliveTimeout === 'number') { | ||
server.keepAliveTimeout = keepAliveTimeout; | ||
} | ||
} |
{ | ||
"name": "create-servers", | ||
"version": "3.2.1", | ||
"version": "3.3.0", | ||
"description": "Create an http AND/OR an https server and call the same request handler.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -15,2 +15,3 @@ # create-servers | ||
| `timeout` | Socket timeout in milliseconds for any server, unless overridden with `http.timeout` or `https.timeout`. Defaults to the node default of 2 minutes. | | ||
| `keepAliveTimeout` | Milliseconds of activity before sockets are destroyed. Defaults to the node default value (currently 5 seconds). | | ||
| `http` | Optional. If present, an HTTP server is started. This can be an object or a number. If it's a number, it's used as the TCP port for an HTTP server. You may also use an Array to start multiple servers. | | ||
@@ -20,2 +21,3 @@ | `http.port` | TCP port for the HTTP server. Defaults to `80`. | | ||
| `http.timeout` | Socket timeout in milliseconds for the server. If unspecified, the top-level `timeout` configuration is used. | | ||
| `http.keepAliveTimeout` | Overrides the top-level keepAliveTimeout setting if specified. | | ||
| `http.handler` | Handler for HTTP requests. If you want to share a handler with all servers, use a top-level `handler` config property instead. | | ||
@@ -26,2 +28,3 @@ | `https` | Optional object. If present, an HTTPS server is started. You may start multiple HTTPS servers by passing an array of objects | | ||
| `https.timeout` | Socket timeout in milliseconds for the server. If unspecified, the top-level `timeout` configuration is used. | | ||
| `https.keepAliveTimeout` | Overrides the top-level keepAliveTimeout setting if specified. | | ||
| `https.ciphers` | Defaults to a [default cipher suite](#note-on-security). To customize, either supply a colon-separated string or array of strings for the ciphers you want the server to support. | | ||
@@ -28,0 +31,0 @@ | `https.honorCipherOrder` | If true, prefer the server's specified cipher order instead of the client's. Defaults to `false`. | |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
27625
344
296
4