fix: treat non-positive connection limits as unlimited
Signed-off-by: hgshreyas <hgshreyas.cs24@bmsce.ac.in>
This commit is contained in:
1 parent
9e5e5cffe9
commit
8c781c1258
7 files changed
+24
-13
No files matched your search
+2
-1
@@ -59,7 +59,8 @@ export function createHttpServer(
|
||||
const server: http.Server = (opts?.tls
|
||||
? nodeHttps.createServer(opts.tls as https.ServerOptions, handler)
|
||||
: nodeHttp.createServer(handler)) as unknown as http.Server;
|
||||
server.maxConnections = opts?.limits?.maxConnections ?? 1000;
|
||||
const maxConnections = opts?.limits?.maxConnections ?? 1000;
|
||||
if (maxConnections > 0) server.maxConnections = maxConnections;
|
||||
server.requestTimeout = opts?.limits?.requestTimeoutMs ?? 30_000;
|
||||
server.headersTimeout = opts?.limits?.headersTimeoutMs ?? 10_000;
|
||||
server.keepAliveTimeout = opts?.limits?.keepAliveTimeoutMs ?? 5_000;
|
||||
|
||||
+2
-2
@@ -5,10 +5,10 @@ import type { TlsOptions, SecurityOptions, CorsOptions } from '../security';
|
||||
import type { WsRequest, WsSocket } from './ws-core';
|
||||
import type { StaticResolver } from '../views';
|
||||
|
||||
/** Per-request size and timeout ceilings applied by the server. */
|
||||
/** Per-request and per-server resource ceilings applied by the server. */
|
||||
export interface RequestLimits {
|
||||
maxBodyBytes?: number; // default 1_000_000
|
||||
maxConnections?: number;
|
||||
maxConnections?: number; // default 1000; <= 0 means unlimited (Node only)
|
||||
requestTimeoutMs?: number; // default 30_000
|
||||
headersTimeoutMs?: number; // default 10_000
|
||||
keepAliveTimeoutMs?: number; // default 5_000
|
||||
|
||||
Reference in new issue
Block a user