@morojs/moro 1.8.11 → 1.8.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/README.md +4 -2
  2. package/dist/core/cluster/thread-cluster.d.ts +25 -0
  3. package/dist/core/cluster/thread-cluster.js +95 -3
  4. package/dist/core/cluster/thread-cluster.js.map +1 -1
  5. package/dist/core/config/config-validator.js +15 -0
  6. package/dist/core/config/config-validator.js.map +1 -1
  7. package/dist/core/config/index.js +19 -2
  8. package/dist/core/config/index.js.map +1 -1
  9. package/dist/core/framework.d.ts +26 -0
  10. package/dist/core/framework.js +195 -6
  11. package/dist/core/framework.js.map +1 -1
  12. package/dist/core/http/http-server.d.ts +17 -0
  13. package/dist/core/http/http-server.js +21 -1
  14. package/dist/core/http/http-server.js.map +1 -1
  15. package/dist/core/http/http2-server.d.ts +13 -0
  16. package/dist/core/http/http2-server.js +11 -0
  17. package/dist/core/http/http2-server.js.map +1 -1
  18. package/dist/core/http/moro-engine-server.d.ts +28 -0
  19. package/dist/core/http/moro-engine-server.js +118 -12
  20. package/dist/core/http/moro-engine-server.js.map +1 -1
  21. package/dist/core/http/utils/body-type.d.ts +12 -0
  22. package/dist/core/http/utils/body-type.js +70 -0
  23. package/dist/core/http/utils/body-type.js.map +1 -0
  24. package/dist/core/http/utils/ssl-config.d.ts +11 -0
  25. package/dist/core/http/utils/ssl-config.js +3 -0
  26. package/dist/core/http/utils/ssl-config.js.map +1 -1
  27. package/dist/core/http/utils/uws-worker-clustering.js +5 -4
  28. package/dist/core/http/utils/uws-worker-clustering.js.map +1 -1
  29. package/dist/core/http/uws-http-server.d.ts +3 -0
  30. package/dist/core/http/uws-http-server.js +22 -1
  31. package/dist/core/http/uws-http-server.js.map +1 -1
  32. package/dist/core/middleware/built-in/body-parsers/index.d.ts +18 -0
  33. package/dist/core/middleware/built-in/body-parsers/index.js +41 -0
  34. package/dist/core/middleware/built-in/body-parsers/index.js.map +1 -1
  35. package/dist/core/middleware/built-in/cache/adapters/cache/redis.d.ts +32 -8
  36. package/dist/core/middleware/built-in/cache/adapters/cache/redis.js +117 -25
  37. package/dist/core/middleware/built-in/cache/adapters/cache/redis.js.map +1 -1
  38. package/dist/core/middleware/built-in/compression/core.js +5 -0
  39. package/dist/core/middleware/built-in/compression/core.js.map +1 -1
  40. package/dist/core/middleware/built-in/session/core.d.ts +1 -0
  41. package/dist/core/middleware/built-in/session/core.js.map +1 -1
  42. package/dist/core/middleware/built-in/static/core.d.ts +18 -0
  43. package/dist/core/middleware/built-in/static/core.js +128 -7
  44. package/dist/core/middleware/built-in/static/core.js.map +1 -1
  45. package/dist/core/networking/adapters/engine-adapter.d.ts +2 -2
  46. package/dist/core/networking/adapters/engine-adapter.js +40 -1
  47. package/dist/core/networking/adapters/engine-adapter.js.map +1 -1
  48. package/dist/core/networking/adapters/socketio-adapter.d.ts +2 -2
  49. package/dist/core/networking/adapters/socketio-adapter.js +10 -1
  50. package/dist/core/networking/adapters/socketio-adapter.js.map +1 -1
  51. package/dist/core/networking/adapters/uws-adapter.d.ts +2 -2
  52. package/dist/core/networking/adapters/uws-adapter.js +54 -3
  53. package/dist/core/networking/adapters/uws-adapter.js.map +1 -1
  54. package/dist/core/networking/adapters/ws-adapter.d.ts +9 -2
  55. package/dist/core/networking/adapters/ws-adapter.js +97 -12
  56. package/dist/core/networking/adapters/ws-adapter.js.map +1 -1
  57. package/dist/core/networking/websocket-adapter.d.ts +19 -1
  58. package/dist/core/networking/websocket-adapter.js.map +1 -1
  59. package/dist/core/routing/index.d.ts +12 -7
  60. package/dist/core/routing/index.js +7 -2
  61. package/dist/core/routing/index.js.map +1 -1
  62. package/dist/core/routing/unified-router.d.ts +48 -9
  63. package/dist/core/routing/unified-router.js +112 -34
  64. package/dist/core/routing/unified-router.js.map +1 -1
  65. package/dist/core/utilities/package-utils.d.ts +11 -0
  66. package/dist/core/utilities/package-utils.js +3 -0
  67. package/dist/core/utilities/package-utils.js.map +1 -1
  68. package/dist/core/workers/worker-manager.js +2 -2
  69. package/dist/core/workers/worker-manager.js.map +1 -1
  70. package/dist/index.d.ts +4 -3
  71. package/dist/index.js +2 -1
  72. package/dist/index.js.map +1 -1
  73. package/dist/moro.d.ts +29 -18
  74. package/dist/moro.js +63 -7
  75. package/dist/moro.js.map +1 -1
  76. package/dist/types/cache.d.ts +2 -0
  77. package/dist/types/cache.js.map +1 -1
  78. package/dist/types/config.d.ts +9 -0
  79. package/dist/types/config.js.map +1 -1
  80. package/dist/types/http.d.ts +6 -0
  81. package/dist/types/http.js.map +1 -1
  82. package/dist/types/session.d.ts +1 -0
  83. package/dist/types/session.js.map +1 -1
  84. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"http-server.js","sourceRoot":"","sources":["../../../src/core/http/http-server.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EACL,cAAc,IAAI,oBAAoB,GAEvC,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAS9D,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAEtE,+EAA+E;AAC/E,4EAA4E;AAC5E,8EAA8E;AAC9E,+EAA+E;AAC/E,kEAAkE;AAClE,sEAAsE;AACtE,gFAAgF;AAChF,mEAAmE;AACnE,MAAM,cAAc,GAAG,aAAa,CAAC,UAAU,CAAC,CAAC;AAEjD,8EAA8E;AAC9E,4EAA4E;AAC5E,6EAA6E;AAC7E,uEAAuE;AACvE,0EAA0E;AAC1E,MAAM,IAAI,GAAG,cAAc,CAA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C,CAAC;IACL,CAAC;IAED,iCAAiC;IACjC,YAAY;QACV,IAAI,CAAC,iBAAiB,EAAE,CAAC;IAC3B,CAAC;IAED,SAAS;QACP,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED,yBAAyB;IACzB,mBAAmB;QACjB,MAAM,SAAS,GAAG,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC;QAC9C,OAAO;YACL,mBAAmB,EAAE,SAAS,CAAC,SAAS,CAAC,QAAQ;YACjD,mBAAmB,EAAE,SAAS,CAAC,SAAS,CAAC,QAAQ;YACjD,oBAAoB,EAAE,SAAS,CAAC,UAAU,CAAC,QAAQ;YACnD,WAAW,EAAE,SAAS;SACvB,CAAC;IACJ,CAAC","sourcesContent":["// src/core/http-server.ts\nimport type { IncomingMessage, ServerResponse, Server } from 'http';\nimport type { Server as HttpsServer } from 'https';\nimport { createRequire } from 'module';\nimport { promisify } from 'util';\nimport { randomUUID } from 'crypto';\nimport { createFrameworkLogger } from '../logger/index.js';\nimport {\n parseMultipart as parseMultipartBuffer,\n type MultipartLimits,\n} from './utils/multipart-parser.js';\nimport { parseRawQueryString } from './utils/query-parser.js';\nimport type { HttpRuntimeLimits } from './utils/size.js';\nimport {\n HttpRequest,\n HttpResponse,\n HttpHandler,\n Middleware,\n RouteEntry,\n} from '../../types/http.js';\nimport { PathMatcher } from '../routing/path-matcher.js';\nimport { ObjectPoolManager } from '../pooling/object-pool-manager.js';\n\n// `node:https` and `node:zlib` are resolved on first use rather than at import\n// time. This module is on every app's startup path, but plaintext HTTP apps\n// never touch https (~1.9 MB RSS, it drags in tls) and uncompressed responses\n// never touch zlib (~0.3 MB). Builtins are always synchronously requirable, so\n// the secure-server and compression paths stay fully synchronous.\n// Resolves Node builtins ONLY, so the base passed to createRequire is\n// irrelevant - 'file:///' is used instead of import.meta.url so this file still\n// compiles under the CJS transform Jest applies to the test suite.\nconst requireBuiltin = createRequire('file:///');\n\n// `node:http` is pulled through createRequire rather than `import`. In an ESM\n// package the two are NOT equivalent: building the ESM facade for node:http\n// drags in http2, tls, zlib and worker_threads and costs ~10.4 MB RSS, while\n// require('http') costs ~0.9 MB and pulls only net. Same objects, same\n// semantics - measurably less memory. See also the lazy https/zlib below.\nconst http = requireBuiltin('http') as typeof import('http');\nconst createServer = http.createServer;\n\nlet gzipFn: ((buf: Buffer) => Promise<Buffer>) | undefined;\nlet deflateFn: ((buf: Buffer) => Promise<Buffer>) | undefined;\nfunction compressors() {\n if (!gzipFn) {\n const zlib = requireBuiltin('zlib') as typeof import('zlib');\n gzipFn = promisify(zlib.gzip) as (buf: Buffer) => Promise<Buffer>;\n deflateFn = promisify(zlib.deflate) as (buf: Buffer) => Promise<Buffer>;\n }\n return {\n gzip: gzipFn,\n deflate: deflateFn as (buf: Buffer) => Promise<Buffer>,\n };\n}\n\nconst JSON_CONTENT_TYPE = 'application/json; charset=utf-8';\n\nconst STATUS_MESSAGES: Record<number, string> = {\n 200: 'OK',\n 201: 'Created',\n 202: 'Accepted',\n 204: 'No Content',\n 301: 'Moved Permanently',\n 302: 'Found',\n 304: 'Not Modified',\n 400: 'Bad Request',\n 401: 'Unauthorized',\n 403: 'Forbidden',\n 404: 'Not Found',\n 409: 'Conflict',\n 410: 'Gone',\n 422: 'Unprocessable Entity',\n 429: 'Too Many Requests',\n 500: 'Internal Server Error',\n 502: 'Bad Gateway',\n 503: 'Service Unavailable',\n};\n\nconst TYPE_SHORTHANDS: Record<string, string> = {\n json: 'application/json; charset=utf-8',\n html: 'text/html; charset=utf-8',\n text: 'text/plain; charset=utf-8',\n txt: 'text/plain; charset=utf-8',\n xml: 'application/xml',\n js: 'application/javascript',\n css: 'text/css; charset=utf-8',\n form: 'application/x-www-form-urlencoded',\n};\n\n// Canonical query parsing shared with the uWS/engine transports - identical\n// req.query semantics everywhere ('+' as space, malformed escapes tolerated).\nconst parseQueryString = parseRawQueryString;\n\nfunction parseCookieHeader(cookieHeader: string): Record<string, string> {\n const cookies: Record<string, string> = {};\n if (!cookieHeader) return cookies;\n\n const cookieParts = cookieHeader.split(';');\n const cookiePartsLen = cookieParts.length;\n for (let i = 0; i < cookiePartsLen; i++) {\n const cookie = cookieParts[i];\n if (cookie === undefined) continue;\n const equalIndex = cookie.indexOf('=');\n if (equalIndex > 0) {\n const name = cookie.substring(0, equalIndex).trim();\n const value = cookie.substring(equalIndex + 1);\n if (name && value) {\n try {\n cookies[name] = decodeURIComponent(value);\n } catch {\n // Malformed percent-encoding: keep the raw value rather than throwing a 500\n cookies[name] = value;\n }\n }\n }\n }\n return cookies;\n}\n\n// ---------------------------------------------------------------------------\n// Prototype-based request/response enhancement.\n//\n// All helper methods live on shared prototypes (defined once per process)\n// instead of being re-created as ~40 closures on every request, and derived\n// request fields (query, cookies, hostname, ips, ...) are lazy memoized\n// getters so a request only pays for what its handler actually reads.\n// Each MoroHttpServer binds per-instance subclasses whose prototype carries\n// the `_server` back-reference, so methods can reach server config (logger,\n// compression settings) without any per-request allocation.\n// ---------------------------------------------------------------------------\n\nexport class MoroIncomingMessage extends http.IncomingMessage {\n /** Bound on the per-server subclass prototype - no per-request write needed */\n declare _server: MoroHttpServer;\n\n // Hot per-request fields (assigned in handleRequest; declared here for\n // stable shape). Everything else lives behind the single `_lazy` slot -\n // per-request construction pays 5 field initializations instead of 16.\n params: Record<string, string> = {};\n body: any = null;\n path = '';\n _queryString: string | null = null;\n\n // Single slot for every lazily-computed/assigned helper value (query,\n // cookies, requestId, hostname, ...). Allocated on first access - a plain\n // JSON GET that never touches the helpers never allocates it, and the\n // request object keeps one stable hidden-class shape either way.\n _lazy: Record<string, any> | undefined = undefined;\n\n get query(): Record<string, string> {\n const L = this._lazy ?? (this._lazy = {});\n let q = L.query;\n if (q === undefined) {\n const qs = this._queryString;\n q = qs ? parseQueryString(qs) : {};\n L.query = q;\n }\n return q;\n }\n set query(value: Record<string, string>) {\n (this._lazy ?? (this._lazy = {})).query = value;\n }\n\n get cookies(): Record<string, string> {\n const L = this._lazy ?? (this._lazy = {});\n let c = L.cookies;\n if (c === undefined) {\n const header = this.headers.cookie;\n c = header ? parseCookieHeader(header) : {};\n L.cookies = c;\n }\n return c;\n }\n set cookies(value: Record<string, string>) {\n (this._lazy ?? (this._lazy = {})).cookies = value;\n }\n\n get context(): Record<string, any> {\n const L = this._lazy ?? (this._lazy = {});\n let ctx = L.context;\n if (ctx === undefined) {\n ctx = {};\n L.context = ctx;\n }\n return ctx;\n }\n set context(value: Record<string, any>) {\n (this._lazy ?? (this._lazy = {})).context = value;\n }\n\n get requestId(): string {\n const L = this._lazy ?? (this._lazy = {});\n let id = L.requestId;\n if (id === undefined) {\n const server = this._server;\n id = server && server.requestTrackingEnabled ? randomUUID() : '';\n L.requestId = id;\n }\n return id;\n }\n set requestId(value: string) {\n (this._lazy ?? (this._lazy = {})).requestId = value;\n }\n\n get ip(): string {\n const L = this._lazy ?? (this._lazy = {});\n let v = L.ip;\n if (v === undefined) {\n v = (this.socket && this.socket.remoteAddress) || '';\n L.ip = v;\n }\n return v;\n }\n set ip(value: string) {\n (this._lazy ?? (this._lazy = {})).ip = value;\n }\n\n get originalUrl(): string {\n const v = this._lazy?.originalUrl;\n return v !== undefined ? v : this.url || '';\n }\n set originalUrl(value: string) {\n (this._lazy ?? (this._lazy = {})).originalUrl = value;\n }\n\n get hostname(): string {\n const L = this._lazy ?? (this._lazy = {});\n let v = L.hostname;\n if (v === undefined) {\n const host = (this.headers.host || '') as string;\n v = host ? host.split(':')[0] : '';\n L.hostname = v;\n }\n return v;\n }\n set hostname(value: string) {\n (this._lazy ?? (this._lazy = {})).hostname = value;\n }\n\n get protocol(): string {\n const L = this._lazy ?? (this._lazy = {});\n let v = L.protocol;\n if (v === undefined) {\n const forwardedProto = this.headers['x-forwarded-proto'] as string | undefined;\n v = forwardedProto\n ? (forwardedProto.split(',')[0] ?? '').trim()\n : (this.socket as any)?.encrypted\n ? 'https'\n : 'http';\n L.protocol = v;\n }\n return v;\n }\n set protocol(value: string) {\n (this._lazy ?? (this._lazy = {})).protocol = value;\n }\n\n get secure(): boolean {\n const v = this._lazy?.secure;\n return v !== undefined ? v : this.protocol === 'https';\n }\n set secure(value: boolean) {\n (this._lazy ?? (this._lazy = {})).secure = value;\n }\n\n get xhr(): boolean {\n const L = this._lazy ?? (this._lazy = {});\n let v = L.xhr;\n if (v === undefined) {\n const xrw = this.headers['x-requested-with'] as string | undefined;\n v = !!xrw && xrw.toLowerCase() === 'xmlhttprequest';\n L.xhr = v;\n }\n return v;\n }\n set xhr(value: boolean) {\n (this._lazy ?? (this._lazy = {})).xhr = value;\n }\n\n get ips(): string[] {\n const L = this._lazy ?? (this._lazy = {});\n let v = L.ips;\n if (v === undefined) {\n const forwardedFor = this.headers['x-forwarded-for'] as string | undefined;\n v = forwardedFor\n ? forwardedFor\n .split(',')\n .map(s => s.trim())\n .filter(Boolean)\n : [];\n L.ips = v;\n }\n return v;\n }\n set ips(value: string[]) {\n (this._lazy ?? (this._lazy = {})).ips = value;\n }\n\n get subdomains(): string[] {\n const L = this._lazy ?? (this._lazy = {});\n let v = L.subdomains;\n if (v === undefined) {\n const hostnameParts = this.hostname.split('.');\n // Matches Express: subdomains are parts before the last two (domain + tld),\n // reversed (closest subdomain first).\n v = hostnameParts.length > 2 ? hostnameParts.slice(0, -2).reverse() : [];\n L.subdomains = v;\n }\n return v;\n }\n set subdomains(value: string[]) {\n (this._lazy ?? (this._lazy = {})).subdomains = value;\n }\n\n // Express-compatible request helpers (shared prototype methods, not closures)\n get(name: string): string | undefined {\n const lower = name.toLowerCase();\n if (lower === 'referer' || lower === 'referrer') {\n return (this.headers.referer || (this.headers as any).referrer) as string | undefined;\n }\n const v = this.headers[lower];\n return Array.isArray(v) ? v[0] : (v as string | undefined);\n }\n\n header(name: string): string | undefined {\n return this.get(name);\n }\n\n is(type: string): boolean {\n const ct = (this.headers['content-type'] || '') as string;\n if (!ct) return false;\n const mime = (ct.split(';')[0] ?? '').trim().toLowerCase();\n const t = type.toLowerCase();\n if (t.indexOf('/') === -1) {\n // e.g. 'json' → match */json or +json suffix\n return mime.endsWith(`/${t}`) || mime.endsWith(`+${t}`);\n }\n if (t.endsWith('/*')) {\n return mime.startsWith(t.slice(0, -1));\n }\n return mime === t;\n }\n\n accepts(types?: string | string[]): string | false {\n const accept = (this.headers.accept || '*/*') as string;\n if (!types) return accept;\n const wanted = Array.isArray(types) ? types : [types];\n if (accept === '*/*' || accept === '') return wanted[0] || false;\n const acceptTypes = accept.split(',').map(s => (s.split(';')[0] ?? '').trim().toLowerCase());\n for (const w of wanted) {\n const wl = w.toLowerCase();\n const wMime = wl.indexOf('/') === -1 ? `application/${wl}` : wl;\n for (const at of acceptTypes) {\n if (at === '*/*') return w;\n if (at === wMime) return w;\n if (at.endsWith('/*') && wMime.startsWith(at.slice(0, -1))) return w;\n }\n }\n return false;\n }\n\n acceptsLanguages(langs?: string | string[]): string | false {\n const acceptLang = (this.headers['accept-language'] || '') as string;\n if (!langs) return acceptLang || false;\n const wanted = Array.isArray(langs) ? langs : [langs];\n if (!acceptLang) return wanted[0] || false;\n // Parse with q values; sort by q desc to match Express's \"best match wins\"\n const accepted = acceptLang\n .split(',')\n .map(s => {\n const parts = s.trim().split(';');\n const tag = (parts[0] ?? '').toLowerCase();\n const qPart = parts.find(p => p.trim().startsWith('q='));\n const q = qPart ? parseFloat(qPart.trim().slice(2)) : 1;\n return { tag, q: isNaN(q) ? 0 : q };\n })\n .filter(a => a.q > 0)\n .sort((a, b) => b.q - a.q);\n for (const { tag } of accepted) {\n for (const w of wanted) {\n const wl = w.toLowerCase();\n if (tag === '*' || tag === wl || tag.split('-')[0] === wl.split('-')[0]) return w;\n }\n }\n return false;\n }\n}\n\nexport class MoroServerResponse extends http.ServerResponse {\n /** Bound on the per-server subclass prototype - no per-request write needed */\n declare _server: MoroHttpServer;\n\n _locals: Record<string, any> | undefined = undefined;\n\n get locals(): Record<string, any> {\n let l = this._locals;\n if (l === undefined) {\n l = {};\n this._locals = l;\n }\n return l;\n }\n set locals(value: Record<string, any>) {\n this._locals = value;\n }\n\n status(code: number): this {\n this.statusCode = code;\n return this;\n }\n\n json(data: any): void {\n if (this.headersSent) return;\n\n const jsonString = JSON.stringify(data);\n const server = this._server;\n\n // Compression - EARLY EXIT if disabled or below threshold\n if (server && server.compressionEnabled && jsonString.length > server.compressionThreshold) {\n const acceptEncoding = (this as any).req?.headers['accept-encoding'];\n\n if (acceptEncoding && acceptEncoding.includes('gzip')) {\n const buffer = Buffer.from(jsonString, 'utf8');\n compressors()\n .gzip(buffer)\n .then(compressed => {\n if (this.headersSent) return;\n this.writeHead(this.statusCode || 200, {\n 'Content-Type': JSON_CONTENT_TYPE,\n 'Content-Encoding': 'gzip',\n Vary: 'Accept-Encoding',\n 'Content-Length': compressed.length,\n });\n this.end(compressed);\n })\n .catch(err => {\n server.logger.error('Response compression failed', 'HttpServer', {\n error: err instanceof Error ? err.message : String(err),\n });\n if (!this.headersSent) {\n this.writeHead(this.statusCode || 200, {\n 'Content-Type': JSON_CONTENT_TYPE,\n 'Content-Length': Buffer.byteLength(jsonString),\n });\n this.end(jsonString);\n } else {\n this.end();\n }\n });\n return;\n } else if (acceptEncoding && acceptEncoding.includes('deflate')) {\n const buffer = Buffer.from(jsonString, 'utf8');\n compressors()\n .deflate(buffer)\n .then(compressed => {\n if (this.headersSent) return;\n this.writeHead(this.statusCode || 200, {\n 'Content-Type': JSON_CONTENT_TYPE,\n 'Content-Encoding': 'deflate',\n Vary: 'Accept-Encoding',\n 'Content-Length': compressed.length,\n });\n this.end(compressed);\n })\n .catch(err => {\n server.logger.error('Response compression failed', 'HttpServer', {\n error: err instanceof Error ? err.message : String(err),\n });\n if (!this.headersSent) {\n this.writeHead(this.statusCode || 200, {\n 'Content-Type': JSON_CONTENT_TYPE,\n 'Content-Length': Buffer.byteLength(jsonString),\n });\n this.end(jsonString);\n } else {\n this.end();\n }\n });\n return;\n }\n }\n\n // SYNC PATH - no compression: single serialize, single write, no Buffer copy\n this.writeHead(this.statusCode || 200, {\n 'Content-Type': JSON_CONTENT_TYPE,\n 'Content-Length': Buffer.byteLength(jsonString),\n });\n this.end(jsonString);\n }\n\n send(data: string | Buffer): void {\n if (this.headersSent) return;\n\n // Auto-detect content type if not already set\n if (!this.getHeader('Content-Type')) {\n if (typeof data === 'string') {\n // Cheap JSON sniff: first non-whitespace char is '{', '[' or '\"'\n // (replaces a full JSON.parse of the body just to pick a content type)\n let i = 0;\n const len = data.length;\n while (i < len) {\n const c = data.charCodeAt(i);\n if (c !== 32 && c !== 9 && c !== 10 && c !== 13) break;\n i++;\n }\n const first = i < len ? data.charCodeAt(i) : 0;\n if (first === 123 /* { */ || first === 91 /* [ */ || first === 34 /* \" */) {\n this.setHeader('Content-Type', JSON_CONTENT_TYPE);\n } else {\n this.setHeader('Content-Type', 'text/plain; charset=utf-8');\n }\n } else {\n this.setHeader('Content-Type', 'application/octet-stream');\n }\n }\n\n this.end(data);\n }\n\n cookie(name: string, value: string, options: any = {}): this {\n if (this.headersSent) {\n const isCritical =\n options.critical ||\n name.includes('session') ||\n name.includes('auth') ||\n name.includes('csrf');\n const message = `Cookie '${name}' could not be set - headers already sent`;\n\n if (isCritical || options.throwOnLateSet) {\n throw new Error(`${message}. This may cause authentication or security issues.`);\n } else {\n this._server?.logger.warn(message, 'CookieWarning', {\n cookieName: name,\n critical: isCritical,\n stackTrace: new Error().stack,\n });\n }\n return this;\n }\n\n const cookieValue = encodeURIComponent(value);\n let cookieString = `${name}=${cookieValue}`;\n\n // maxAge: 0 is meaningful (immediate expiry - clearCookie relies on it)\n if (options.maxAge !== undefined && options.maxAge !== null)\n cookieString += `; Max-Age=${options.maxAge}`;\n if (options.expires) cookieString += `; Expires=${options.expires.toUTCString()}`;\n if (options.httpOnly) cookieString += '; HttpOnly';\n if (options.secure) cookieString += '; Secure';\n if (options.sameSite) cookieString += `; SameSite=${options.sameSite}`;\n if (options.domain) cookieString += `; Domain=${options.domain}`;\n // Path defaults to '/' (Express behavior) so clearCookie() from a nested\n // route can clear a cookie originally set at the site root.\n cookieString += `; Path=${options.path ?? '/'}`;\n\n const existingCookies = this.getHeader('Set-Cookie') || [];\n // Avoid spread operator - direct array manipulation\n const cookies = Array.isArray(existingCookies) ? existingCookies : [existingCookies as string];\n cookies.push(cookieString);\n this.setHeader('Set-Cookie', cookies);\n\n return this;\n }\n\n clearCookie(name: string, options: any = {}): this {\n // Avoid spread operator - manually set properties\n const clearOptions: any = {\n expires: new Date(0),\n maxAge: 0,\n };\n // Copy other options manually\n if (options.path !== undefined) clearOptions.path = options.path;\n if (options.domain !== undefined) clearOptions.domain = options.domain;\n if (options.httpOnly !== undefined) clearOptions.httpOnly = options.httpOnly;\n if (options.secure !== undefined) clearOptions.secure = options.secure;\n if (options.sameSite !== undefined) clearOptions.sameSite = options.sameSite;\n return this.cookie(name, '', clearOptions);\n }\n\n redirect(url: string, status: number = 302): void {\n if (this.headersSent) return;\n this.statusCode = status;\n const safeUrl = url.replace(/[\\r\\n]/g, '');\n this.setHeader('Location', safeUrl);\n this.end();\n }\n\n async sendFile(filePath: string): Promise<void> {\n if (this.headersSent) return;\n\n try {\n const fs = await import('fs/promises');\n const path = await import('path');\n const extension = path.extname(filePath);\n const mime = await this._server.getMimeType(extension);\n\n const stats = await fs.stat(filePath);\n const data = await fs.readFile(filePath);\n\n // Add charset for text-based files\n const contentType = this._server.addCharsetIfNeeded(mime);\n this.setHeader('Content-Type', contentType);\n this.setHeader('Content-Length', stats.size);\n\n // Add security headers for file downloads\n this.setHeader('X-Content-Type-Options', 'nosniff');\n\n // Add caching headers\n this.setHeader('Last-Modified', stats.mtime.toUTCString());\n this.setHeader('Cache-Control', 'public, max-age=31536000'); // 1 year for static files\n\n this.end(data);\n } catch {\n this.status(404).json({ success: false, error: 'File not found' });\n }\n }\n\n // Standardized response helpers\n success<T = any>(data: T, message?: string): void {\n const response: any = {\n success: true,\n data,\n };\n if (message !== undefined) {\n response.message = message;\n }\n this.json(response);\n }\n\n error(error: string, code?: string, message?: string): void {\n const response: any = {\n success: false,\n error,\n };\n if (code !== undefined) {\n response.code = code;\n }\n if (message !== undefined) {\n response.message = message;\n }\n this.json(response);\n }\n\n // Common HTTP error helpers (automatically set status code)\n unauthorized(message: string = 'Authentication required'): void {\n this.statusCode = 401;\n this.json({\n success: false,\n error: 'Unauthorized',\n code: 'UNAUTHORIZED',\n message,\n });\n }\n\n forbidden(message: string = 'Insufficient permissions'): void {\n this.statusCode = 403;\n this.json({\n success: false,\n error: 'Forbidden',\n code: 'FORBIDDEN',\n message,\n });\n }\n\n notFound(resource: string = 'Resource'): void {\n this.statusCode = 404;\n this.json({\n success: false,\n error: 'Not Found',\n code: 'NOT_FOUND',\n message: `${resource} not found`,\n });\n }\n\n badRequest(message: string = 'Invalid request'): void {\n this.statusCode = 400;\n this.json({\n success: false,\n error: 'Bad Request',\n code: 'BAD_REQUEST',\n message,\n });\n }\n\n conflict(message: string): void {\n this.statusCode = 409;\n this.json({\n success: false,\n error: 'Conflict',\n code: 'CONFLICT',\n message,\n });\n }\n\n internalError(message: string = 'Internal server error'): void {\n this.statusCode = 500;\n this.json({\n success: false,\n error: 'Internal Server Error',\n code: 'INTERNAL_ERROR',\n message,\n });\n }\n\n validationError(errors: Array<{ field: string; message: string; code?: string }>): void {\n this.statusCode = 422;\n this.json({\n success: false,\n error: 'Validation Failed',\n code: 'VALIDATION_ERROR',\n errors,\n });\n }\n\n rateLimited(retryAfter?: number): void {\n this.statusCode = 429;\n if (retryAfter) {\n this.setHeader('Retry-After', retryAfter.toString());\n }\n this.json({\n success: false,\n error: 'Rate Limit Exceeded',\n code: 'RATE_LIMITED',\n message: retryAfter\n ? `Too many requests. Retry after ${retryAfter} seconds.`\n : 'Too many requests',\n retryAfter,\n });\n }\n\n // Common success patterns\n created<T = any>(data: T, location?: string): void {\n this.statusCode = 201;\n if (location) {\n this.setHeader('Location', location);\n }\n this.json({\n success: true,\n data,\n });\n }\n\n noContent(): void {\n this.statusCode = 204;\n this.end();\n }\n\n paginated<T = any>(data: T[], pagination: { page: number; limit: number; total: number }): void {\n const totalPages = Math.ceil(pagination.total / pagination.limit);\n this.json({\n success: true,\n data,\n pagination: {\n page: pagination.page,\n limit: pagination.limit,\n total: pagination.total,\n totalPages,\n hasNext: pagination.page < totalPages,\n hasPrev: pagination.page > 1,\n },\n });\n }\n\n // Header management utilities\n override hasHeader(name: string): boolean {\n return this.getHeader(name) !== undefined;\n }\n\n setBulkHeaders(headers: Record<string, string | number>): this {\n if (this.headersSent) {\n // Only enumerate keys for warning if headers were already sent\n const attemptedHeaderKeys = [];\n for (const key in headers) {\n attemptedHeaderKeys.push(key);\n }\n this._server?.logger.warn('Cannot set headers - headers already sent', 'HeaderWarning', {\n attemptedHeaders: attemptedHeaderKeys,\n });\n return this;\n }\n\n for (const key in headers) {\n const value = headers[key];\n if (value !== undefined) this.setHeader(key, value);\n }\n return this;\n }\n\n override appendHeader(name: string, value: string | string[]): this {\n if (this.headersSent) {\n this._server?.logger.warn(\n `Cannot append to header '${name}' - headers already sent`,\n 'HeaderWarning'\n );\n return this;\n }\n\n const existing = this.getHeader(name);\n if (existing) {\n const values = Array.isArray(existing) ? existing : [existing.toString()];\n const newValues = Array.isArray(value) ? value : [value];\n this.setHeader(name, [...values, ...newValues]);\n } else {\n this.setHeader(name, value);\n }\n return this;\n }\n\n // Express-compatible response helpers\n set(\n field: string | Record<string, string | string[] | number>,\n value?: string | string[] | number\n ): this {\n if (this.headersSent) return this;\n if (typeof field === 'string') {\n if (value !== undefined) {\n this.setHeader(field, value as any);\n }\n } else {\n for (const key in field) {\n this.setHeader(key, field[key] as any);\n }\n }\n return this;\n }\n\n get(field: string): any {\n return this.getHeader(field) as any;\n }\n\n append(field: string, value: string | string[]): this {\n return this.appendHeader(field, value);\n }\n\n type(contentType: string): this {\n if (this.headersSent) return this;\n // If no \"/\" treat as shorthand (e.g. \"json\" → \"application/json\")\n let ct = contentType;\n if (ct.indexOf('/') === -1) {\n ct = TYPE_SHORTHANDS[ct.toLowerCase()] || `application/${ct}`;\n }\n this.setHeader('Content-Type', ct);\n return this;\n }\n\n sendStatus(code: number): void {\n if (this.headersSent) return;\n this.statusCode = code;\n const body = STATUS_MESSAGES[code] || String(code);\n this.setHeader('Content-Type', 'text/plain; charset=utf-8');\n this.end(body);\n }\n\n location(url: string): this {\n if (this.headersSent) return this;\n const safe = url.replace(/[\\r\\n]/g, '');\n this.setHeader('Location', safe);\n return this;\n }\n\n vary(field: string | string[]): this {\n if (this.headersSent) return this;\n const existing = this.getHeader('Vary');\n const existingList = existing\n ? String(existing)\n .split(',')\n .map(s => s.trim())\n .filter(Boolean)\n : [];\n const incoming = Array.isArray(field) ? field : [field];\n for (const f of incoming) {\n if (!existingList.some(e => e.toLowerCase() === f.toLowerCase())) {\n existingList.push(f);\n }\n }\n this.setHeader('Vary', existingList.join(', '));\n return this;\n }\n\n attachment(filename?: string): this {\n if (this.headersSent) return this;\n if (filename) {\n const safeName = filename.replace(/[\\r\\n\"]/g, '');\n this.setHeader('Content-Disposition', `attachment; filename=\"${safeName}\"`);\n // Set Content-Type from extension if not already set\n if (!this.getHeader('Content-Type')) {\n // fire-and-forget mime lookup; not awaited to keep signature chainable\n void this._server\n .getMimeType(filename.substring(filename.lastIndexOf('.')))\n .then(mime => {\n if (!this.getHeader('Content-Type') && !this.headersSent) {\n this.setHeader('Content-Type', mime);\n }\n })\n .catch(() => {\n // best-effort content-type inference\n });\n }\n } else {\n this.setHeader('Content-Disposition', 'attachment');\n }\n return this;\n }\n\n async download(filePath: string, filename?: string): Promise<void> {\n this.attachment(filename || filePath.split('/').pop());\n return this.sendFile(filePath);\n }\n\n format(handlers: Record<string, () => any | Promise<any>>): void {\n const types = Object.keys(handlers).filter(k => k !== 'default');\n const matched = ((this as any).req as HttpRequest).accepts(types);\n const chosen = matched ? handlers[matched as string] : handlers.default;\n if (!chosen) {\n this.statusCode = 406;\n this.setHeader('Content-Type', 'text/plain; charset=utf-8');\n this.end('Not Acceptable');\n return;\n }\n this.vary('Accept');\n if (matched && typeof matched === 'string') {\n this.type(matched);\n }\n chosen();\n }\n\n links(links: Record<string, string>): this {\n if (this.headersSent) return this;\n const parts: string[] = [];\n for (const rel in links) {\n parts.push(`<${links[rel]}>; rel=\"${rel}\"`);\n }\n if (parts.length > 0) {\n const existing = this.getHeader('Link');\n const combined = existing ? `${existing}, ${parts.join(', ')}` : parts.join(', ');\n this.setHeader('Link', combined);\n }\n return this;\n }\n\n // Response state utilities\n canSetHeaders(): boolean {\n return !this.headersSent;\n }\n\n getResponseState() {\n return {\n headersSent: this.headersSent,\n statusCode: this.statusCode,\n headers: this.getHeaders ? this.getHeaders() : {},\n finished: this.finished || false,\n writable: this.writable,\n };\n }\n}\n\nexport class MoroHttpServer {\n private server: Server | HttpsServer;\n /** Multipart limits threaded to parseMultipart at the call site. */\n private multipartLimits?: MultipartLimits;\n /** TCP backlog for listen(), when configured. */\n private listenBacklog?: number;\n private routes: RouteEntry[] = [];\n private globalMiddleware: Middleware[] = [];\n /** @internal read by MoroServerResponse prototype methods */\n compressionEnabled = true;\n /** @internal read by MoroServerResponse prototype methods */\n compressionThreshold = 1024;\n /** @internal read by MoroIncomingMessage prototype methods */\n requestTrackingEnabled = true; // Generate request IDs\n /** @internal read by MoroServerResponse prototype methods */\n logger = createFrameworkLogger('HttpServer');\n private hookManager: any;\n private requestCounter = 0;\n private errorHandler?: (err: any, req: HttpRequest, res: HttpResponse) => any | Promise<any>;\n private requestDecorations: Record<string, any> = {};\n private responseDecorations: Record<string, any> = {};\n\n // Per-server request/response subclasses; their prototype carries the\n // `_server` back-reference plus user decorations (applied once, not per request)\n private RequestClass!: typeof MoroIncomingMessage;\n private ResponseClass!: typeof MoroServerResponse;\n\n // Direct router dispatch slot - runs after global middleware without the\n // per-middleware promise machinery (set from Moro.listen via setRouterHandler)\n private routerHandler?: (req: HttpRequest, res: HttpResponse) => boolean | Promise<boolean>;\n\n // Body size limits - defaults overridden by config in constructor\n private maxBodySize: number = 10 * 1024 * 1024; // Default 10MB (overridden by server.bodySizeLimit config)\n private maxUploadSize: number = 100 * 1024 * 1024; // Default 100MB for file uploads (future: configurable)\n\n // Use shared object pool manager\n private poolManager = ObjectPoolManager.getInstance();\n\n // Interned method strings for fast reference equality comparison\n private static readonly METHOD_POST = 'POST';\n private static readonly METHOD_PUT = 'PUT';\n private static readonly METHOD_PATCH = 'PATCH';\n private static readonly METHOD_GET = 'GET';\n private static readonly METHOD_DELETE = 'DELETE';\n private static readonly METHOD_HEAD = 'HEAD';\n private static readonly METHOD_OPTIONS = 'OPTIONS';\n\n // Pre-compiled response templates for common responses\n private static readonly RESPONSE_TEMPLATES = {\n notFound: Buffer.from('{\"success\":false,\"error\":\"Not found\"}'),\n unauthorized: Buffer.from('{\"success\":false,\"error\":\"Unauthorized\"}'),\n forbidden: Buffer.from('{\"success\":false,\"error\":\"Forbidden\"}'),\n internalError: Buffer.from('{\"success\":false,\"error\":\"Internal server error\"}'),\n methodNotAllowed: Buffer.from('{\"success\":false,\"error\":\"Method not allowed\"}'),\n rateLimited: Buffer.from('{\"success\":false,\"error\":\"Rate limit exceeded\"}'),\n };\n\n constructor(options?: {\n maxBodySize?: number;\n maxUploadSize?: number;\n /** node-style TLS material (from the unified ssl normalizer). When present\n * the server is created via https.createServer. */\n ssl?: {\n key: string | Buffer;\n cert: string | Buffer;\n ca?: Array<string | Buffer>;\n passphrase?: string;\n minVersion?: string;\n requestCert?: boolean;\n rejectUnauthorized?: boolean;\n };\n limits?: HttpRuntimeLimits;\n }) {\n // Per-instance subclasses so prototype methods can reach this server's\n // config (logger, compression) with zero per-request allocation.\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const boundServer = this;\n class BoundRequest extends MoroIncomingMessage {}\n class BoundResponse extends MoroServerResponse {}\n BoundRequest.prototype._server = boundServer;\n BoundResponse.prototype._server = boundServer;\n this.RequestClass = BoundRequest;\n this.ResponseClass = BoundResponse;\n\n const limits = options?.limits;\n // maxHeaderSize is a createServer option (not a mutable property), so it\n // must be passed here.\n const serverOpts: any = {\n IncomingMessage: BoundRequest as any,\n ServerResponse: BoundResponse as any,\n ...(limits?.maxHeaderSize && { maxHeaderSize: limits.maxHeaderSize }),\n };\n\n if (options?.ssl) {\n // In-process HTTPS. The https ServerOptions extends the http one, so the\n // IncomingMessage/ServerResponse subclass injection carries over.\n const https = requireBuiltin('https') as typeof import('https');\n this.server = https.createServer(\n { ...serverOpts, ...options.ssl },\n this.handleRequest.bind(this) as any\n );\n this.logger.info('HTTPS server created (in-process TLS)', 'HttpServer');\n } else {\n this.server = createServer(serverOpts, this.handleRequest.bind(this) as any);\n }\n\n // Configure body size limits from options\n if (options?.maxBodySize) {\n this.maxBodySize = options.maxBodySize;\n }\n if (options?.maxUploadSize) {\n this.maxUploadSize = options.maxUploadSize;\n }\n if (limits?.multipart) this.multipartLimits = limits.multipart;\n\n // Timeouts: the previous hardcodes (keepAlive 5000, headers 6000) become\n // the documented defaults; a configured value overrides them. Socket idle\n // timeout stays 0 (disabled) unless set - a non-zero value arms a\n // per-request timer that shows up in CPU profiles under load.\n const t = limits?.timeouts ?? {};\n this.server.keepAliveTimeout = t.keepAlive ?? 5000;\n this.server.headersTimeout = t.headers ?? 6000;\n this.server.timeout = t.idle ?? 0;\n if (t.request) this.server.requestTimeout = t.request;\n if (limits?.maxConnections && limits.maxConnections > 0) {\n this.server.maxConnections = limits.maxConnections;\n }\n if (limits?.maxHeaders) this.server.maxHeadersCount = limits.maxHeaders;\n if (limits?.backlog !== undefined) this.listenBacklog = limits.backlog;\n }\n\n // Direct router dispatch - called after global middleware, before the legacy\n // route table. Returning true (or a promise of true) means the request was handled.\n setRouterHandler(fn: (req: HttpRequest, res: HttpResponse) => boolean | Promise<boolean>): void {\n this.routerHandler = fn;\n }\n\n // Configure server for maximum performance (can disable all overhead)\n configurePerformance(\n config: {\n compression?: { enabled: boolean; threshold?: number };\n minimal?: boolean;\n } = {}\n ) {\n if (config.compression !== undefined) {\n this.compressionEnabled = config.compression.enabled;\n if (config.compression.threshold !== undefined) {\n this.compressionThreshold = config.compression.threshold;\n }\n }\n\n // Minimal mode - disable ALL overhead for pure speed\n if (config.minimal) {\n this.compressionEnabled = false;\n this.compressionThreshold = Infinity; // Never compress\n }\n }\n\n // Configure request tracking (ID generation)\n setRequestTracking(enabled: boolean): void {\n this.requestTrackingEnabled = enabled;\n }\n\n // Register a global error handler (called from Moro.setErrorHandler)\n setErrorHandler(fn: (err: any, req: HttpRequest, res: HttpResponse) => any | Promise<any>): void {\n this.errorHandler = fn;\n }\n\n // Apply request/response decoration maps (called from Moro.decorateRequest/Reply).\n // Decorations are installed on the per-server prototypes once, so requests pay\n // nothing for them; per-request writes to the same key simply shadow the prototype.\n setRequestDecorations(decorations: Record<string, any>): void {\n this.requestDecorations = decorations;\n for (const key in decorations) {\n Object.defineProperty(this.RequestClass.prototype, key, {\n value: decorations[key],\n writable: true,\n enumerable: true,\n configurable: true,\n });\n }\n }\n\n setResponseDecorations(decorations: Record<string, any>): void {\n this.responseDecorations = decorations;\n for (const key in decorations) {\n Object.defineProperty(this.ResponseClass.prototype, key, {\n value: decorations[key],\n writable: true,\n enumerable: true,\n configurable: true,\n });\n }\n }\n\n // Middleware management\n use(middleware: Middleware): void {\n // Defensive check: Don't add MiddlewareInterface objects to globalMiddleware\n // MiddlewareInterface objects should only be handled by MiddlewareManager\n if (\n middleware &&\n typeof middleware === 'object' &&\n (middleware as any).install &&\n (middleware as any).metadata\n ) {\n this.logger?.warn?.(\n `Attempted to add MiddlewareInterface \"${(middleware as any).metadata?.name}\" to HTTP server globalMiddleware. ` +\n `This should be handled by MiddlewareManager instead. Skipping.`,\n 'Middleware'\n );\n return;\n }\n\n this.globalMiddleware.push(middleware);\n }\n\n // Set hooks manager for request processing\n setHookManager(hookManager: any): void {\n this.hookManager = hookManager;\n }\n\n // Routing methods\n get(path: string, ...handlers: (Middleware | HttpHandler)[]): void {\n this.addRoute('GET', path, handlers);\n }\n\n post(path: string, ...handlers: (Middleware | HttpHandler)[]): void {\n this.addRoute('POST', path, handlers);\n }\n\n put(path: string, ...handlers: (Middleware | HttpHandler)[]): void {\n this.addRoute('PUT', path, handlers);\n }\n\n delete(path: string, ...handlers: (Middleware | HttpHandler)[]): void {\n this.addRoute('DELETE', path, handlers);\n }\n\n patch(path: string, ...handlers: (Middleware | HttpHandler)[]): void {\n this.addRoute('PATCH', path, handlers);\n }\n\n private addRoute(method: string, path: string, handlers: (Middleware | HttpHandler)[]): void {\n const { pattern, paramNames } = this.pathToRegex(path);\n const handler = handlers.pop() as HttpHandler;\n const middleware = handlers as Middleware[];\n\n const route = {\n method,\n path,\n pattern,\n paramNames,\n handler,\n middleware,\n };\n\n this.routes.push(route);\n\n // Organize routes for optimal lookup\n if (paramNames.length === 0) {\n // Static route - O(1) lookup\n const staticKey = `${method}:${path}`;\n this.staticRoutes.set(staticKey, route);\n } else {\n // Dynamic route - organize by segment count for faster matching\n this.dynamicRoutes.push(route);\n\n const segmentCount = PathMatcher.countSegments(path);\n\n if (!this.routesBySegmentCount.has(segmentCount)) {\n this.routesBySegmentCount.set(segmentCount, []);\n }\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n this.routesBySegmentCount.get(segmentCount)!.push(route);\n }\n }\n\n private pathToRegex(path: string): { pattern: RegExp; paramNames: string[] } {\n // Use shared PathMatcher for consistent path compilation\n const compiled = PathMatcher.compile(path);\n return {\n pattern: compiled.pattern || new RegExp(`^${path.replace(/\\//g, '\\\\/')}$`),\n paramNames: compiled.paramNames,\n };\n }\n\n // Request entry point. Deliberately NOT an async function: the common case\n // (no body, no hooks, no global middleware, sync route handler) completes\n // fully synchronously with zero promise allocations and zero microtask\n // hops. Anything that genuinely needs to await routes through\n // handleRequestSlow.\n private handleRequest(req: IncomingMessage, res: ServerResponse): void {\n // req/res arrive as the per-server subclasses (MoroIncomingMessage /\n // MoroServerResponse) - all helpers are already on their prototypes.\n const httpReq = req as unknown as HttpRequest & MoroIncomingMessage;\n const httpRes = res as unknown as HttpResponse & MoroServerResponse;\n\n // URL split - query string parsing is lazy (MoroIncomingMessage#query getter)\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const urlString = req.url!;\n const queryIndex = urlString.indexOf('?');\n\n if (queryIndex === -1) {\n httpReq.path = urlString;\n } else {\n httpReq.path = urlString.substring(0, queryIndex);\n httpReq._queryString = urlString.substring(queryIndex + 1);\n }\n\n // Intern method string for fast reference equality comparison (50-100% faster)\n switch (req.method) {\n case 'POST':\n httpReq.method = MoroHttpServer.METHOD_POST;\n break;\n case 'PUT':\n httpReq.method = MoroHttpServer.METHOD_PUT;\n break;\n case 'PATCH':\n httpReq.method = MoroHttpServer.METHOD_PATCH;\n break;\n case 'GET':\n httpReq.method = MoroHttpServer.METHOD_GET;\n break;\n case 'DELETE':\n httpReq.method = MoroHttpServer.METHOD_DELETE;\n break;\n case 'HEAD':\n httpReq.method = MoroHttpServer.METHOD_HEAD;\n break;\n case 'OPTIONS':\n httpReq.method = MoroHttpServer.METHOD_OPTIONS;\n break;\n }\n\n const needsBody =\n httpReq.method === MoroHttpServer.METHOD_POST ||\n httpReq.method === MoroHttpServer.METHOD_PUT ||\n httpReq.method === MoroHttpServer.METHOD_PATCH;\n const hookManager = this.hookManager;\n const hasHooks = !!(\n hookManager &&\n (hookManager.hasHooks === undefined ||\n hookManager.hasHooks('request') ||\n hookManager.hasHooks('response'))\n );\n\n if (needsBody || hasHooks || this.globalMiddleware.length > 0) {\n // Slow path: real awaits ahead (body parse / hooks / middleware).\n // Errors are fully handled inside - the returned promise never rejects.\n void this.handleRequestSlow(httpReq, httpRes, req, needsBody, hasHooks);\n return;\n }\n\n // FAST PATH - no promises unless the route handler itself is async\n try {\n const routerHandler = this.routerHandler;\n if (routerHandler) {\n const handled = routerHandler(httpReq, httpRes);\n if (handled) {\n if (typeof (handled as any).then === 'function') {\n (handled as Promise<boolean>).then(\n wasHandled => {\n if (!wasHandled && !httpRes.headersSent) {\n try {\n this.dispatchLegacyRoute(httpReq, httpRes, req);\n } catch (error) {\n void this.onRequestError(error, httpReq, httpRes, req);\n }\n }\n },\n error => void this.onRequestError(error, httpReq, httpRes, req)\n );\n }\n return;\n }\n if (httpRes.headersSent) return;\n }\n\n this.dispatchLegacyRoute(httpReq, httpRes, req);\n } catch (error) {\n void this.onRequestError(error, httpReq, httpRes, req);\n }\n }\n\n // Full async pipeline for requests that need it: bodied methods, hook\n // consumers, and apps with global middleware.\n private async handleRequestSlow(\n httpReq: HttpRequest & MoroIncomingMessage,\n httpRes: HttpResponse & MoroServerResponse,\n req: IncomingMessage,\n needsBody: boolean,\n hasHooks: boolean\n ): Promise<void> {\n try {\n if (needsBody) {\n httpReq.body = await this.parseBody(req);\n }\n\n if (hasHooks) {\n await this.hookManager.execute('request', {\n request: httpReq,\n response: httpRes,\n });\n\n // Post-response hooks (session persistence, auth session refresh,\n // CDN invalidation) run after the response is flushed, off the\n // request's critical path.\n if (this.hookManager.hasHooks === undefined || this.hookManager.hasHooks('response')) {\n httpRes.once('finish', () => {\n void Promise.resolve(\n this.hookManager.execute('response', { request: httpReq, response: httpRes })\n ).catch((error: any) =>\n this.logger?.error?.(`Response hook error: ${error?.message || error}`, 'Hooks')\n );\n });\n }\n }\n\n // A request hook may answer the request itself (rate limiting, auth\n // rejection). Registration of the response hooks above still stands.\n if (httpRes.headersSent) return;\n\n // executeMiddleware returns undefined when the whole chain completed\n // synchronously, so a sync chain costs zero promise allocations.\n if (this.globalMiddleware.length > 0) {\n const mwResult = this.executeMiddleware(this.globalMiddleware, httpReq, httpRes);\n if (mwResult) await mwResult;\n }\n\n // If middleware handled the request, don't continue\n if (httpRes.headersSent) {\n return;\n }\n\n // Unified router direct dispatch - no middleware-chain promise wrapper\n const routerHandler = this.routerHandler;\n if (routerHandler) {\n const handled = routerHandler(httpReq, httpRes);\n if (handled) {\n if (typeof (handled as any).then === 'function') {\n if (await handled) return;\n } else {\n return;\n }\n }\n if (httpRes.headersSent) return;\n }\n\n this.dispatchLegacyRoute(httpReq, httpRes, req);\n } catch (error) {\n await this.onRequestError(error, httpReq, httpRes, req);\n }\n }\n\n // Legacy direct-route table dispatch + 404 fallback. Synchronous; async\n // route middleware/handlers are continued via promise callbacks wired to\n // onRequestError so the sync fast path stays promise-free.\n private dispatchLegacyRoute(\n httpReq: HttpRequest & MoroIncomingMessage,\n httpRes: HttpResponse & MoroServerResponse,\n req: IncomingMessage\n ): void {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const route = this.findRoute(req.method!, httpReq.path);\n if (!route) {\n // 404 response with pre-compiled buffer\n httpRes.statusCode = 404;\n httpRes.setHeader('Content-Type', 'application/json; charset=utf-8');\n httpRes.setHeader('Content-Length', MoroHttpServer.RESPONSE_TEMPLATES.notFound.length);\n httpRes.end(MoroHttpServer.RESPONSE_TEMPLATES.notFound);\n return;\n }\n\n // Extract path parameters\n const matches = httpReq.path.match(route.pattern);\n if (matches) {\n const params: Record<string, string> = {};\n const paramNames = route.paramNames;\n const paramNamesLen = paramNames.length;\n for (let i = 0; i < paramNamesLen; i++) {\n const paramName = paramNames[i];\n const value = matches[i + 1];\n if (paramName !== undefined && value !== undefined) {\n params[paramName] = value;\n }\n }\n httpReq.params = params;\n }\n\n const runHandler = () => {\n // Execute handler - Don't await sync handlers\n const handlerResult = route.handler(httpReq, httpRes);\n if (handlerResult && typeof handlerResult.then === 'function') {\n (handlerResult as Promise<void>).catch(\n error => void this.onRequestError(error, httpReq, httpRes, req)\n );\n }\n };\n\n // Execute middleware chain - EARLY EXIT if no route middleware\n if (route.middleware.length > 0) {\n const mwResult = this.executeMiddleware(route.middleware, httpReq, httpRes);\n if (mwResult) {\n mwResult.then(runHandler, error => void this.onRequestError(error, httpReq, httpRes, req));\n return;\n }\n }\n\n runHandler();\n }\n\n // Shared error handling for all request paths (sync throw, slow-path catch,\n // and promise rejections from async handlers/middleware). Never throws.\n private async onRequestError(\n error: unknown,\n httpReq: HttpRequest & MoroIncomingMessage,\n httpRes: HttpResponse & MoroServerResponse,\n req: IncomingMessage\n ): Promise<void> {\n // Error hooks are observational (Sentry-style reporting, audit trails):\n // fire-and-forget so a slow or throwing observer can never delay or\n // alter the error response.\n if (\n this.hookManager &&\n (this.hookManager.hasHooks === undefined || this.hookManager.hasHooks('error'))\n ) {\n void Promise.resolve(\n this.hookManager.execute('error', { request: httpReq, response: httpRes, error })\n ).catch((hookError: any) =>\n this.logger?.error?.(`Error hook error: ${hookError?.message || hookError}`, 'Hooks')\n );\n }\n\n try {\n // Debug: Log the actual error and where it came from\n this.logger.debug('Request error details', 'RequestHandler', {\n errorType: typeof error,\n errorMessage: error instanceof Error ? error.message : String(error),\n errorStack: error instanceof Error ? error.stack : 'No stack trace',\n requestPath: req.url,\n requestMethod: req.method,\n });\n\n // Payload-too-large from parseBody: respond 413 (matches the old bodySize\n // middleware semantics, now enforced in-server)\n if ((error as any)?.statusCode === 413 && !httpRes.headersSent) {\n httpRes.statusCode = 413;\n httpRes.json({\n success: false,\n error: 'Request entity too large',\n });\n return;\n }\n\n this.logger.error('Request error', 'RequestHandler', {\n error: error instanceof Error ? error.message : String(error),\n requestId: httpReq.requestId,\n method: req.method,\n path: req.url,\n });\n\n // User-registered global error handler takes precedence over the default 500.\n if (this.errorHandler && !httpRes.headersSent) {\n try {\n const handlerResult = this.errorHandler(error, httpReq, httpRes);\n if (handlerResult && typeof (handlerResult as any).then === 'function') {\n await handlerResult;\n }\n if (httpRes.headersSent) return;\n } catch (handlerErr) {\n this.logger.error('Error handler itself threw', 'RequestHandler', {\n error: handlerErr instanceof Error ? handlerErr.message : String(handlerErr),\n });\n }\n }\n\n if (!httpRes.headersSent) {\n // A malformed body is a client error: default to 400 (parity with the\n // engine/uWS transports), not the generic 500.\n const isBadRequest = (error as any)?.statusCode === 400;\n const defaultStatus = isBadRequest ? 400 : 500;\n const defaultError = isBadRequest ? 'Invalid request body' : 'Internal server error';\n // Ensure response is properly enhanced before using custom methods\n if (typeof httpRes.status === 'function' && typeof httpRes.json === 'function') {\n httpRes.status(defaultStatus).json({\n success: false,\n error: defaultError,\n requestId: httpReq.requestId,\n });\n } else {\n // Defensive fallback - check each method individually\n if (typeof httpRes.setHeader === 'function') {\n httpRes.statusCode = defaultStatus;\n httpRes.setHeader('Content-Type', 'application/json');\n } else {\n // Even setHeader doesn't exist - object is completely wrong\n this.logger.error('Response object is not a proper ServerResponse', 'RequestHandler', {\n responseType: typeof httpRes,\n responseKeys: Object.keys(httpRes),\n });\n }\n\n if (typeof httpRes.end === 'function') {\n httpRes.end(\n JSON.stringify({\n success: false,\n error: defaultError,\n requestId: httpReq.requestId,\n })\n );\n } else {\n this.logger.error(\n 'Cannot send error response - end() method missing',\n 'RequestHandler'\n );\n }\n }\n }\n } catch (fatalError) {\n // Error handling itself failed (e.g. the connection died mid-response) -\n // never let this escape as an unhandled rejection\n this.logger.error('Failed while handling request error', 'RequestHandler', {\n error: fatalError instanceof Error ? fatalError.message : String(fatalError),\n });\n }\n }\n\n // Force cleanup of all pooled objects\n private forceCleanupPools(): void {\n // Use shared pool manager cleanup\n this.poolManager.clearAll();\n\n // Force garbage collection if available\n if (globalThis?.gc) {\n globalThis.gc();\n }\n }\n\n private acquireBuffer(size: number): Buffer {\n return this.poolManager.acquireBuffer(size);\n }\n\n private releaseBuffer(buffer: Buffer): void {\n this.poolManager.releaseBuffer(buffer);\n }\n\n private streamLargeResponse(res: any, data: any): void {\n res.setHeader('Content-Type', 'application/json; charset=utf-8');\n res.setHeader('Transfer-Encoding', 'chunked');\n\n // Stream large JSON responses to prevent memory issues\n if (Array.isArray(data) && data.length > 100) {\n // Stream large arrays element by element\n res.write('[');\n\n // Stream each array element\n let first = true;\n for (const item of data) {\n if (!first) res.write(',');\n res.write(JSON.stringify(item));\n first = false;\n }\n\n // Write closing bracket and end\n res.end(']');\n } else if (typeof data === 'object' && data !== null && Object.keys(data).length > 50) {\n // For large objects, stream key-value pairs\n res.write('{');\n const keys = Object.keys(data);\n let first = true;\n\n for (const key of keys) {\n if (!first) res.write(',');\n // Properly escape the key using JSON.stringify\n res.write(`${JSON.stringify(key)}:${JSON.stringify(data[key])}`);\n first = false;\n }\n\n res.end('}');\n } else {\n // For smaller data, still avoid the old chunking approach\n const jsonString = JSON.stringify(data);\n res.end(jsonString);\n }\n }\n\n private normalizePath(path: string): string {\n // Check cache first\n if (this.pathNormalizationCache.has(path)) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n return this.pathNormalizationCache.get(path)!;\n }\n\n // Normalization: remove trailing slash (except root), decode once\n let normalized = path;\n if (normalized.length > 1 && normalized.endsWith('/')) {\n normalized = normalized.slice(0, -1);\n }\n\n // Cache result (limit cache size)\n if (this.pathNormalizationCache.size < 200) {\n this.pathNormalizationCache.set(path, normalized);\n }\n\n return normalized;\n }\n\n /** @internal called by MoroServerResponse prototype methods */\n async getMimeType(ext: string): Promise<string> {\n const mimeTypes: Record<string, string> = {\n '.html': 'text/html',\n '.css': 'text/css',\n '.js': 'application/javascript',\n '.json': 'application/json',\n '.png': 'image/png',\n '.jpg': 'image/jpeg',\n '.jpeg': 'image/jpeg',\n '.gif': 'image/gif',\n '.svg': 'image/svg+xml',\n '.ico': 'image/x-icon',\n '.pdf': 'application/pdf',\n '.txt': 'text/plain',\n '.xml': 'application/xml',\n };\n\n return mimeTypes[ext.toLowerCase()] || 'application/octet-stream';\n }\n\n /** @internal called by MoroServerResponse prototype methods */\n addCharsetIfNeeded(mimeType: string): string {\n // Add charset for text-based content types - optimized with early exit\n // Check most common cases first\n if (\n mimeType.startsWith('text/') ||\n mimeType.startsWith('application/json') ||\n mimeType.startsWith('application/javascript') ||\n mimeType.startsWith('application/xml') ||\n mimeType.startsWith('image/svg+xml')\n ) {\n if (!mimeType.includes('charset')) {\n return `${mimeType}; charset=utf-8`;\n }\n }\n\n return mimeType;\n }\n\n private async parseBody(req: IncomingMessage): Promise<any> {\n const contentType = req.headers['content-type'] || '';\n const contentLength = parseInt(req.headers['content-length'] || '0');\n\n // Use different limits based on content type\n // Multipart (file uploads) need much larger limits than JSON/form data\n const isMultipart = contentType.includes('multipart/form-data');\n const maxSize = isMultipart\n ? this.maxUploadSize // Configurable file upload limit (default 100MB)\n : this.maxBodySize; // Configurable body size limit (default 10MB, from server.bodySizeLimit config)\n\n // Early rejection from the declared Content-Length - nothing is read off the wire\n if (contentLength > maxSize) {\n const error: any = new Error('Request entity too large');\n error.statusCode = 413;\n error.limit = maxSize;\n error.received = contentLength;\n return Promise.reject(error);\n }\n\n // Buffer every body up to maxSize and parse it into its real shape. The\n // incremental limit check below already bounds memory, and every other\n // backend (uWS, engine) returns the parsed body here - previously bodies\n // between maxSize/2 and maxSize resolved to a { type, parser } descriptor\n // object instead, so handlers/validation on the Node backend silently saw\n // a bogus shape for the exact same request that parsed normally elsewhere.\n return new Promise((resolve, reject) => {\n const chunks: Buffer[] = [];\n let totalLength = 0;\n\n req.on('data', (chunk: Buffer) => {\n totalLength += chunk.length;\n if (totalLength > maxSize) {\n const errorMessage = isMultipart\n ? `File upload too large. Maximum ${Math.floor(maxSize / (1024 * 1024))}MB allowed.`\n : 'Request body too large';\n const error: any = new Error(errorMessage);\n error.statusCode = 413;\n error.limit = maxSize;\n reject(error);\n return;\n }\n chunks.push(chunk);\n });\n\n req.on('end', () => {\n try {\n // Single-chunk fast path (most JSON bodies arrive in one chunk);\n // otherwise concat with the known total length to avoid a re-scan\n const firstChunk = chunks[0];\n const body =\n chunks.length === 1 && firstChunk !== undefined\n ? firstChunk\n : Buffer.concat(chunks, totalLength);\n\n if (contentType.includes('application/json')) {\n // Empty JSON body -> null (parity with the engine/uWS servers, and\n // avoids JSON.parse('') throwing and 500ing an empty POST).\n resolve(totalLength === 0 ? null : JSON.parse(body.toString()));\n } else if (contentType.includes('application/x-www-form-urlencoded')) {\n resolve(this.parseUrlEncoded(body.toString()));\n } else if (contentType.includes('multipart/form-data')) {\n resolve(this.parseMultipart(body, contentType));\n } else {\n resolve(body.toString());\n }\n } catch (error) {\n // A malformed body is a client error (400), not a server error (500).\n // Tag it so the request-error path answers 400, matching the engine\n // and uWS transports.\n if (error instanceof Error && (error as any).statusCode === undefined) {\n (error as any).statusCode = 400;\n }\n reject(error);\n }\n });\n\n req.on('error', reject);\n });\n }\n\n private parseMultipart(\n buffer: Buffer,\n contentType: string\n ): { fields: Record<string, string>; files: Record<string, any> } {\n // Shared implementation - the native engine server parses uploads with\n // the exact same code so both transports agree on body/files shape\n return parseMultipartBuffer(buffer, contentType, this.multipartLimits);\n }\n\n private parseUrlEncoded(body: string): Record<string, string> {\n const params = new URLSearchParams(body);\n const result: Record<string, string> = {};\n for (const [key, value] of params) {\n result[key] = value;\n }\n return result;\n }\n\n // Legacy methods for backward compatibility - the hot path now parses query\n // strings lazily via the MoroIncomingMessage#query getter (no pooling: a fresh\n // object literal is cheaper than pool bookkeeping)\n private parseQueryString(queryString: string): Record<string, string> {\n return parseQueryString(queryString);\n }\n\n private parseQueryStringPooled(queryString: string): Record<string, string> {\n return parseQueryString(queryString);\n }\n\n // Advanced route optimization: cache + static routes + segment grouping\n private routeCache = new Map<string, RouteEntry | null>();\n private staticRoutes = new Map<string, RouteEntry>();\n private dynamicRoutes: RouteEntry[] = [];\n private routesBySegmentCount = new Map<number, RouteEntry[]>();\n private pathNormalizationCache = new Map<string, string>();\n\n // CPU cache-friendly optimizations\n private routeHitCount = new Map<string, number>(); // Track route popularity for cache optimization\n private static readonly HOT_ROUTE_THRESHOLD = 100; // Routes accessed 100+ times get hot path treatment\n\n private findRoute(method: string, path: string): RouteEntry | null {\n // Skip normalization and hit tracking for cached routes\n const cacheKey = `${method}:${path}`;\n\n // Check cache first (hot path optimization) - BEFORE any other work\n if (this.routeCache.has(cacheKey)) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n return this.routeCache.get(cacheKey)!;\n }\n\n // Normalize path for consistent matching (only if not cached)\n const normalizedPath = this.normalizePath(path);\n const normalizedCacheKey = normalizedPath !== path ? `${method}:${normalizedPath}` : cacheKey;\n\n // Check cache again with normalized path\n if (normalizedPath !== path && this.routeCache.has(normalizedCacheKey)) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n return this.routeCache.get(normalizedCacheKey)!;\n }\n\n // O(1) static route lookup\n const staticRoute = this.staticRoutes.get(normalizedCacheKey);\n if (staticRoute) {\n this.routeCache.set(normalizedCacheKey, staticRoute);\n if (normalizedPath !== path) {\n this.routeCache.set(cacheKey, staticRoute);\n }\n return staticRoute;\n }\n\n // Dynamic route matching by segment count\n let route: RouteEntry | null = null;\n const dynamicRoutesLen = this.dynamicRoutes.length;\n if (dynamicRoutesLen > 0) {\n // Use shared utility for DRY principle\n const segmentCount = PathMatcher.countSegments(normalizedPath);\n\n const candidateRoutes = this.routesBySegmentCount.get(segmentCount) || this.dynamicRoutes;\n const candidateLen = candidateRoutes.length;\n\n // Only test routes with matching method and segment count\n for (let i = 0; i < candidateLen; i++) {\n const candidateRoute = candidateRoutes[i];\n if (candidateRoute === undefined) continue;\n if (candidateRoute.method === method && candidateRoute.pattern.test(normalizedPath)) {\n route = candidateRoute;\n break;\n }\n }\n }\n\n // Cache result (limit cache size to prevent memory leaks)\n if (this.routeCache.size < 500) {\n this.routeCache.set(normalizedCacheKey, route);\n if (normalizedPath !== path) {\n this.routeCache.set(cacheKey, route);\n }\n }\n\n return route;\n }\n\n // Middleware execution with Express-compatible error propagation.\n // Supports: 3-arg (req, res, next), 4-arg (err, req, res, next) error middlewares,\n // and next(err) to skip forward to the next error middleware.\n //\n // Sync-aware dispatch: middleware that calls next() synchronously (or throws\n // synchronously) advances the chain in a plain loop with ZERO promise\n // allocations. A promise is only created when a middleware actually completes\n // asynchronously. Returns undefined when the whole chain ran synchronously.\n private executeMiddleware(\n middleware: Middleware[],\n req: HttpRequest,\n res: HttpResponse\n ): void | Promise<void> {\n return this.dispatchMiddleware(middleware, req, res, 0, undefined);\n }\n\n private dispatchMiddleware(\n middleware: Middleware[],\n req: HttpRequest,\n res: HttpResponse,\n startIndex: number,\n initialError: any\n ): void | Promise<void> {\n const len = middleware.length;\n let activeError: any = initialError;\n let i = startIndex;\n\n while (i < len) {\n if (res.headersSent) return;\n\n const mw = middleware[i] as any;\n i++;\n const isErrorHandler = mw.length >= 4;\n\n // Non-error middleware is skipped while an error is active; error middleware\n // is skipped while no error is active. Matches Express semantics.\n if (activeError !== undefined && !isErrorHandler) continue;\n if (activeError === undefined && isErrorHandler) continue;\n\n let settled = false;\n let settledError: any = undefined;\n let asyncResolve: ((err: any) => void) | undefined;\n\n const next = (err?: any) => {\n if (settled) return;\n settled = true;\n settledError = err;\n if (asyncResolve) asyncResolve(err);\n };\n\n let result: any;\n try {\n result = isErrorHandler ? mw(activeError, req, res, next) : mw(req, res, next);\n } catch (err) {\n if (!settled) {\n settled = true;\n settledError = err;\n }\n }\n\n const isThenable = result && typeof result.then === 'function';\n\n if (settled) {\n // Completed synchronously (next() called sync, or threw sync).\n // Matches the old behavior: a still-pending returned promise no longer\n // gates the chain once next() has been called; swallow late rejections.\n if (isThenable) {\n (result as Promise<void>).then(undefined, () => {});\n }\n activeError = settledError;\n continue;\n }\n\n if (!isThenable) {\n // Sync-looking middleware that neither called next() nor returned a\n // promise: it will call next() later (e.g. from an event callback).\n // Fall back to a promise for the remainder of the chain.\n const resumeIndex = i;\n return new Promise<any>(resolve => {\n asyncResolve = resolve;\n }).then(err => this.dispatchMiddleware(middleware, req, res, resumeIndex, err));\n }\n\n // Async middleware: completion is next() OR promise settle, whichever\n // happens first (same semantics as the previous implementation).\n const resumeIndex = i;\n return new Promise<any>(resolve => {\n asyncResolve = resolve;\n (result as Promise<void>).then(\n () => {\n if (!settled) next();\n },\n (err: any) => {\n if (!settled) next(err);\n }\n );\n }).then(err => this.dispatchMiddleware(middleware, req, res, resumeIndex, err));\n }\n\n // If an error is still unhandled after the chain, re-throw so the top-level\n // catch in handleRequest can invoke the registered errorHandler / default 500.\n if (activeError !== undefined) {\n throw activeError;\n }\n }\n\n listen(port: number, callback?: () => void): void;\n listen(port: number, host: string, callback?: () => void): void;\n listen(port: number, host?: string | (() => void), callback?: () => void): void {\n // Handle overloaded parameters (port, callback) or (port, host, callback)\n if (typeof host === 'function') {\n callback = host;\n host = undefined;\n }\n\n const backlog = this.listenBacklog;\n if (host && backlog) {\n this.server.listen(port, host, backlog, callback);\n } else if (host) {\n this.server.listen(port, host, callback);\n } else {\n this.server.listen(port, callback);\n }\n }\n\n close(): Promise<void> {\n return new Promise(resolve => {\n this.server.close(() => resolve());\n });\n }\n\n // Public method to force cleanup\n forceCleanup(): void {\n this.forceCleanupPools();\n }\n\n getServer(): Server {\n return this.server;\n }\n\n // Performance statistics\n getPerformanceStats() {\n const poolStats = this.poolManager.getStats();\n return {\n paramObjectPoolSize: poolStats.paramPool.poolSize,\n queryObjectPoolSize: poolStats.queryPool.poolSize,\n headerObjectPoolSize: poolStats.headerPool.poolSize,\n poolManager: poolStats,\n };\n }\n}\n"]}
1
+ {"version":3,"file":"http-server.js","sourceRoot":"","sources":["../../../src/core/http/http-server.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EACL,cAAc,IAAI,oBAAoB,GAEvC,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAS9D,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAEtE,+EAA+E;AAC/E,4EAA4E;AAC5E,8EAA8E;AAC9E,+EAA+E;AAC/E,kEAAkE;AAClE,sEAAsE;AACtE,gFAAgF;AAChF,mEAAmE;AACnE,MAAM,cAAc,GAAG,aAAa,CAAC,UAAU,CAAC,CAAC;AAEjD,8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AC;YAChB,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC;QAC3C,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QACrC,CAAC;IACH,CAAC;IAED,KAAK;QACH,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE;YAC3B,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC;QACrC,CAAC,CAAC,CAAC;IACL,CAAC;IAED,iCAAiC;IACjC,YAAY;QACV,IAAI,CAAC,iBAAiB,EAAE,CAAC;IAC3B,CAAC;IAED;;;OAGG;IACH,SAAS,CAAC,GAQT;QACC,MAAM,MAAM,GAAG,IAAI,CAAC,MAAa,CAAC;QAClC,IAAI,OAAO,MAAM,CAAC,gBAAgB,KAAK,UAAU,EAAE,CAAC;YAClD,MAAM,IAAI,KAAK,CAAC,8DAA8D,CAAC,CAAC;QAClF,CAAC;QACD,MAAM,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC;IAC/B,CAAC;IAED,SAAS;QACP,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED,yBAAyB;IACzB,mBAAmB;QACjB,MAAM,SAAS,GAAG,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC;QAC9C,OAAO;YACL,mBAAmB,EAAE,SAAS,CAAC,SAAS,CAAC,QAAQ;YACjD,mBAAmB,EAAE,SAAS,CAAC,SAAS,CAAC,QAAQ;YACjD,oBAAoB,EAAE,SAAS,CAAC,UAAU,CAAC,QAAQ;YACnD,WAAW,EAAE,SAAS;SACvB,CAAC;IACJ,CAAC","sourcesContent":["// src/core/http-server.ts\nimport type { IncomingMessage, ServerResponse, Server } from 'http';\nimport { bodyIsText } from './utils/body-type.js';\nimport type { Server as HttpsServer } from 'https';\nimport { createRequire } from 'module';\nimport { promisify } from 'util';\nimport { randomUUID } from 'crypto';\nimport { createFrameworkLogger } from '../logger/index.js';\nimport {\n parseMultipart as parseMultipartBuffer,\n type MultipartLimits,\n} from './utils/multipart-parser.js';\nimport { parseRawQueryString } from './utils/query-parser.js';\nimport type { HttpRuntimeLimits } from './utils/size.js';\nimport {\n HttpRequest,\n HttpResponse,\n HttpHandler,\n Middleware,\n RouteEntry,\n} from '../../types/http.js';\nimport { PathMatcher } from '../routing/path-matcher.js';\nimport { ObjectPoolManager } from '../pooling/object-pool-manager.js';\n\n// `node:https` and `node:zlib` are resolved on first use rather than at import\n// time. This module is on every app's startup path, but plaintext HTTP apps\n// never touch https (~1.9 MB RSS, it drags in tls) and uncompressed responses\n// never touch zlib (~0.3 MB). Builtins are always synchronously requirable, so\n// the secure-server and compression paths stay fully synchronous.\n// Resolves Node builtins ONLY, so the base passed to createRequire is\n// irrelevant - 'file:///' is used instead of import.meta.url so this file still\n// compiles under the CJS transform Jest applies to the test suite.\nconst requireBuiltin = createRequire('file:///');\n\n// `node:http` is pulled through createRequire rather than `import`. In an ESM\n// package the two are NOT equivalent: building the ESM facade for node:http\n// drags in http2, tls, zlib and worker_threads and costs ~10.4 MB RSS, while\n// require('http') costs ~0.9 MB and pulls only net. Same objects, same\n// semantics - measurably less memory. See also the lazy https/zlib below.\nconst http = requireBuiltin('http') as typeof import('http');\nconst createServer = http.createServer;\n\nlet gzipFn: ((buf: Buffer) => Promise<Buffer>) | undefined;\nlet deflateFn: ((buf: Buffer) => Promise<Buffer>) | undefined;\nfunction compressors() {\n if (!gzipFn) {\n const zlib = requireBuiltin('zlib') as typeof import('zlib');\n gzipFn = promisify(zlib.gzip) as (buf: Buffer) => Promise<Buffer>;\n deflateFn = promisify(zlib.deflate) as (buf: Buffer) => Promise<Buffer>;\n }\n return {\n gzip: gzipFn,\n deflate: deflateFn as (buf: Buffer) => Promise<Buffer>,\n };\n}\n\nconst JSON_CONTENT_TYPE = 'application/json; charset=utf-8';\n\nconst STATUS_MESSAGES: Record<number, string> = {\n 200: 'OK',\n 201: 'Created',\n 202: 'Accepted',\n 204: 'No Content',\n 301: 'Moved Permanently',\n 302: 'Found',\n 304: 'Not Modified',\n 400: 'Bad Request',\n 401: 'Unauthorized',\n 403: 'Forbidden',\n 404: 'Not Found',\n 409: 'Conflict',\n 410: 'Gone',\n 422: 'Unprocessable Entity',\n 429: 'Too Many Requests',\n 500: 'Internal Server Error',\n 502: 'Bad Gateway',\n 503: 'Service Unavailable',\n};\n\nconst TYPE_SHORTHANDS: Record<string, string> = {\n json: 'application/json; charset=utf-8',\n html: 'text/html; charset=utf-8',\n text: 'text/plain; charset=utf-8',\n txt: 'text/plain; charset=utf-8',\n xml: 'application/xml',\n js: 'application/javascript',\n css: 'text/css; charset=utf-8',\n form: 'application/x-www-form-urlencoded',\n};\n\n// Canonical query parsing shared with the uWS/engine transports - identical\n// req.query semantics everywhere ('+' as space, malformed escapes tolerated).\nconst parseQueryString = parseRawQueryString;\n\nfunction parseCookieHeader(cookieHeader: string): Record<string, string> {\n const cookies: Record<string, string> = {};\n if (!cookieHeader) return cookies;\n\n const cookieParts = cookieHeader.split(';');\n const cookiePartsLen = cookieParts.length;\n for (let i = 0; i < cookiePartsLen; i++) {\n const cookie = cookieParts[i];\n if (cookie === undefined) continue;\n const equalIndex = cookie.indexOf('=');\n if (equalIndex > 0) {\n const name = cookie.substring(0, equalIndex).trim();\n const value = cookie.substring(equalIndex + 1);\n if (name && value) {\n try {\n cookies[name] = decodeURIComponent(value);\n } catch {\n // Malformed percent-encoding: keep the raw value rather than throwing a 500\n cookies[name] = value;\n }\n }\n }\n }\n return cookies;\n}\n\n// ---------------------------------------------------------------------------\n// Prototype-based request/response enhancement.\n//\n// All helper methods live on shared prototypes (defined once per process)\n// instead of being re-created as ~40 closures on every request, and derived\n// request fields (query, cookies, hostname, ips, ...) are lazy memoized\n// getters so a request only pays for what its handler actually reads.\n// Each MoroHttpServer binds per-instance subclasses whose prototype carries\n// the `_server` back-reference, so methods can reach server config (logger,\n// compression settings) without any per-request allocation.\n// ---------------------------------------------------------------------------\n\nexport class MoroIncomingMessage extends http.IncomingMessage {\n /** Bound on the per-server subclass prototype - no per-request write needed */\n declare _server: MoroHttpServer;\n\n // Hot per-request fields (assigned in handleRequest; declared here for\n // stable shape). Everything else lives behind the single `_lazy` slot -\n // per-request construction pays 5 field initializations instead of 16.\n params: Record<string, string> = {};\n body: any = null;\n path = '';\n _queryString: string | null = null;\n /** Set by parseBody only when a body arrived (no per-request init on GETs) */\n declare _rawBody: Buffer | undefined;\n\n /** The request body exactly as received, before any parsing; null when empty. */\n get rawBody(): Buffer | null {\n return this._rawBody ?? null;\n }\n\n // Single slot for every lazily-computed/assigned helper value (query,\n // cookies, requestId, hostname, ...). Allocated on first access - a plain\n // JSON GET that never touches the helpers never allocates it, and the\n // request object keeps one stable hidden-class shape either way.\n _lazy: Record<string, any> | undefined = undefined;\n\n get query(): Record<string, string> {\n const L = this._lazy ?? (this._lazy = {});\n let q = L.query;\n if (q === undefined) {\n const qs = this._queryString;\n q = qs ? parseQueryString(qs) : {};\n L.query = q;\n }\n return q;\n }\n set query(value: Record<string, string>) {\n (this._lazy ?? (this._lazy = {})).query = value;\n }\n\n get cookies(): Record<string, string> {\n const L = this._lazy ?? (this._lazy = {});\n let c = L.cookies;\n if (c === undefined) {\n const header = this.headers.cookie;\n c = header ? parseCookieHeader(header) : {};\n L.cookies = c;\n }\n return c;\n }\n set cookies(value: Record<string, string>) {\n (this._lazy ?? (this._lazy = {})).cookies = value;\n }\n\n get context(): Record<string, any> {\n const L = this._lazy ?? (this._lazy = {});\n let ctx = L.context;\n if (ctx === undefined) {\n ctx = {};\n L.context = ctx;\n }\n return ctx;\n }\n set context(value: Record<string, any>) {\n (this._lazy ?? (this._lazy = {})).context = value;\n }\n\n get requestId(): string {\n const L = this._lazy ?? (this._lazy = {});\n let id = L.requestId;\n if (id === undefined) {\n const server = this._server;\n id = server && server.requestTrackingEnabled ? randomUUID() : '';\n L.requestId = id;\n }\n return id;\n }\n set requestId(value: string) {\n (this._lazy ?? (this._lazy = {})).requestId = value;\n }\n\n get ip(): string {\n const L = this._lazy ?? (this._lazy = {});\n let v = L.ip;\n if (v === undefined) {\n v = (this.socket && this.socket.remoteAddress) || '';\n L.ip = v;\n }\n return v;\n }\n set ip(value: string) {\n (this._lazy ?? (this._lazy = {})).ip = value;\n }\n\n get originalUrl(): string {\n const v = this._lazy?.originalUrl;\n return v !== undefined ? v : this.url || '';\n }\n set originalUrl(value: string) {\n (this._lazy ?? (this._lazy = {})).originalUrl = value;\n }\n\n get hostname(): string {\n const L = this._lazy ?? (this._lazy = {});\n let v = L.hostname;\n if (v === undefined) {\n const host = (this.headers.host || '') as string;\n v = host ? host.split(':')[0] : '';\n L.hostname = v;\n }\n return v;\n }\n set hostname(value: string) {\n (this._lazy ?? (this._lazy = {})).hostname = value;\n }\n\n get protocol(): string {\n const L = this._lazy ?? (this._lazy = {});\n let v = L.protocol;\n if (v === undefined) {\n const forwardedProto = this.headers['x-forwarded-proto'] as string | undefined;\n v = forwardedProto\n ? (forwardedProto.split(',')[0] ?? '').trim()\n : (this.socket as any)?.encrypted\n ? 'https'\n : 'http';\n L.protocol = v;\n }\n return v;\n }\n set protocol(value: string) {\n (this._lazy ?? (this._lazy = {})).protocol = value;\n }\n\n get secure(): boolean {\n const v = this._lazy?.secure;\n return v !== undefined ? v : this.protocol === 'https';\n }\n set secure(value: boolean) {\n (this._lazy ?? (this._lazy = {})).secure = value;\n }\n\n get xhr(): boolean {\n const L = this._lazy ?? (this._lazy = {});\n let v = L.xhr;\n if (v === undefined) {\n const xrw = this.headers['x-requested-with'] as string | undefined;\n v = !!xrw && xrw.toLowerCase() === 'xmlhttprequest';\n L.xhr = v;\n }\n return v;\n }\n set xhr(value: boolean) {\n (this._lazy ?? (this._lazy = {})).xhr = value;\n }\n\n get ips(): string[] {\n const L = this._lazy ?? (this._lazy = {});\n let v = L.ips;\n if (v === undefined) {\n const forwardedFor = this.headers['x-forwarded-for'] as string | undefined;\n v = forwardedFor\n ? forwardedFor\n .split(',')\n .map(s => s.trim())\n .filter(Boolean)\n : [];\n L.ips = v;\n }\n return v;\n }\n set ips(value: string[]) {\n (this._lazy ?? (this._lazy = {})).ips = value;\n }\n\n get subdomains(): string[] {\n const L = this._lazy ?? (this._lazy = {});\n let v = L.subdomains;\n if (v === undefined) {\n const hostnameParts = this.hostname.split('.');\n // Matches Express: subdomains are parts before the last two (domain + tld),\n // reversed (closest subdomain first).\n v = hostnameParts.length > 2 ? hostnameParts.slice(0, -2).reverse() : [];\n L.subdomains = v;\n }\n return v;\n }\n set subdomains(value: string[]) {\n (this._lazy ?? (this._lazy = {})).subdomains = value;\n }\n\n // Express-compatible request helpers (shared prototype methods, not closures)\n get(name: string): string | undefined {\n const lower = name.toLowerCase();\n if (lower === 'referer' || lower === 'referrer') {\n return (this.headers.referer || (this.headers as any).referrer) as string | undefined;\n }\n const v = this.headers[lower];\n return Array.isArray(v) ? v[0] : (v as string | undefined);\n }\n\n header(name: string): string | undefined {\n return this.get(name);\n }\n\n is(type: string): boolean {\n const ct = (this.headers['content-type'] || '') as string;\n if (!ct) return false;\n const mime = (ct.split(';')[0] ?? '').trim().toLowerCase();\n const t = type.toLowerCase();\n if (t.indexOf('/') === -1) {\n // e.g. 'json' → match */json or +json suffix\n return mime.endsWith(`/${t}`) || mime.endsWith(`+${t}`);\n }\n if (t.endsWith('/*')) {\n return mime.startsWith(t.slice(0, -1));\n }\n return mime === t;\n }\n\n accepts(types?: string | string[]): string | false {\n const accept = (this.headers.accept || '*/*') as string;\n if (!types) return accept;\n const wanted = Array.isArray(types) ? types : [types];\n if (accept === '*/*' || accept === '') return wanted[0] || false;\n const acceptTypes = accept.split(',').map(s => (s.split(';')[0] ?? '').trim().toLowerCase());\n for (const w of wanted) {\n const wl = w.toLowerCase();\n const wMime = wl.indexOf('/') === -1 ? `application/${wl}` : wl;\n for (const at of acceptTypes) {\n if (at === '*/*') return w;\n if (at === wMime) return w;\n if (at.endsWith('/*') && wMime.startsWith(at.slice(0, -1))) return w;\n }\n }\n return false;\n }\n\n acceptsLanguages(langs?: string | string[]): string | false {\n const acceptLang = (this.headers['accept-language'] || '') as string;\n if (!langs) return acceptLang || false;\n const wanted = Array.isArray(langs) ? langs : [langs];\n if (!acceptLang) return wanted[0] || false;\n // Parse with q values; sort by q desc to match Express's \"best match wins\"\n const accepted = acceptLang\n .split(',')\n .map(s => {\n const parts = s.trim().split(';');\n const tag = (parts[0] ?? '').toLowerCase();\n const qPart = parts.find(p => p.trim().startsWith('q='));\n const q = qPart ? parseFloat(qPart.trim().slice(2)) : 1;\n return { tag, q: isNaN(q) ? 0 : q };\n })\n .filter(a => a.q > 0)\n .sort((a, b) => b.q - a.q);\n for (const { tag } of accepted) {\n for (const w of wanted) {\n const wl = w.toLowerCase();\n if (tag === '*' || tag === wl || tag.split('-')[0] === wl.split('-')[0]) return w;\n }\n }\n return false;\n }\n}\n\nexport class MoroServerResponse extends http.ServerResponse {\n /** Bound on the per-server subclass prototype - no per-request write needed */\n declare _server: MoroHttpServer;\n\n _locals: Record<string, any> | undefined = undefined;\n\n get locals(): Record<string, any> {\n let l = this._locals;\n if (l === undefined) {\n l = {};\n this._locals = l;\n }\n return l;\n }\n set locals(value: Record<string, any>) {\n this._locals = value;\n }\n\n status(code: number): this {\n this.statusCode = code;\n return this;\n }\n\n json(data: any): void {\n if (this.headersSent) return;\n\n const jsonString = JSON.stringify(data);\n const server = this._server;\n\n // Compression - EARLY EXIT if disabled or below threshold\n if (server && server.compressionEnabled && jsonString.length > server.compressionThreshold) {\n const acceptEncoding = (this as any).req?.headers['accept-encoding'];\n\n if (acceptEncoding && acceptEncoding.includes('gzip')) {\n const buffer = Buffer.from(jsonString, 'utf8');\n compressors()\n .gzip(buffer)\n .then(compressed => {\n if (this.headersSent) return;\n this.writeHead(this.statusCode || 200, {\n 'Content-Type': JSON_CONTENT_TYPE,\n 'Content-Encoding': 'gzip',\n Vary: 'Accept-Encoding',\n 'Content-Length': compressed.length,\n });\n this.end(compressed);\n })\n .catch(err => {\n server.logger.error('Response compression failed', 'HttpServer', {\n error: err instanceof Error ? err.message : String(err),\n });\n if (!this.headersSent) {\n this.writeHead(this.statusCode || 200, {\n 'Content-Type': JSON_CONTENT_TYPE,\n 'Content-Length': Buffer.byteLength(jsonString),\n });\n this.end(jsonString);\n } else {\n this.end();\n }\n });\n return;\n } else if (acceptEncoding && acceptEncoding.includes('deflate')) {\n const buffer = Buffer.from(jsonString, 'utf8');\n compressors()\n .deflate(buffer)\n .then(compressed => {\n if (this.headersSent) return;\n this.writeHead(this.statusCode || 200, {\n 'Content-Type': JSON_CONTENT_TYPE,\n 'Content-Encoding': 'deflate',\n Vary: 'Accept-Encoding',\n 'Content-Length': compressed.length,\n });\n this.end(compressed);\n })\n .catch(err => {\n server.logger.error('Response compression failed', 'HttpServer', {\n error: err instanceof Error ? err.message : String(err),\n });\n if (!this.headersSent) {\n this.writeHead(this.statusCode || 200, {\n 'Content-Type': JSON_CONTENT_TYPE,\n 'Content-Length': Buffer.byteLength(jsonString),\n });\n this.end(jsonString);\n } else {\n this.end();\n }\n });\n return;\n }\n }\n\n // SYNC PATH - no compression: single serialize, single write, no Buffer copy\n this.writeHead(this.statusCode || 200, {\n 'Content-Type': JSON_CONTENT_TYPE,\n 'Content-Length': Buffer.byteLength(jsonString),\n });\n this.end(jsonString);\n }\n\n send(data: string | Buffer): void {\n if (this.headersSent) return;\n\n // Auto-detect content type if not already set\n if (!this.getHeader('Content-Type')) {\n if (typeof data === 'string') {\n // Cheap JSON sniff: first non-whitespace char is '{', '[' or '\"'\n // (replaces a full JSON.parse of the body just to pick a content type)\n let i = 0;\n const len = data.length;\n while (i < len) {\n const c = data.charCodeAt(i);\n if (c !== 32 && c !== 9 && c !== 10 && c !== 13) break;\n i++;\n }\n const first = i < len ? data.charCodeAt(i) : 0;\n if (first === 123 /* { */ || first === 91 /* [ */ || first === 34 /* \" */) {\n this.setHeader('Content-Type', JSON_CONTENT_TYPE);\n } else {\n this.setHeader('Content-Type', 'text/plain; charset=utf-8');\n }\n } else {\n this.setHeader('Content-Type', 'application/octet-stream');\n }\n }\n\n this.end(data);\n }\n\n cookie(name: string, value: string, options: any = {}): this {\n if (this.headersSent) {\n const isCritical =\n options.critical ||\n name.includes('session') ||\n name.includes('auth') ||\n name.includes('csrf');\n const message = `Cookie '${name}' could not be set - headers already sent`;\n\n if (isCritical || options.throwOnLateSet) {\n throw new Error(`${message}. This may cause authentication or security issues.`);\n } else {\n this._server?.logger.warn(message, 'CookieWarning', {\n cookieName: name,\n critical: isCritical,\n stackTrace: new Error().stack,\n });\n }\n return this;\n }\n\n const cookieValue = encodeURIComponent(value);\n let cookieString = `${name}=${cookieValue}`;\n\n // maxAge: 0 is meaningful (immediate expiry - clearCookie relies on it)\n if (options.maxAge !== undefined && options.maxAge !== null)\n cookieString += `; Max-Age=${options.maxAge}`;\n if (options.expires) cookieString += `; Expires=${options.expires.toUTCString()}`;\n if (options.httpOnly) cookieString += '; HttpOnly';\n if (options.secure) cookieString += '; Secure';\n if (options.sameSite) cookieString += `; SameSite=${options.sameSite}`;\n if (options.domain) cookieString += `; Domain=${options.domain}`;\n // Path defaults to '/' (Express behavior) so clearCookie() from a nested\n // route can clear a cookie originally set at the site root.\n cookieString += `; Path=${options.path ?? '/'}`;\n\n const existingCookies = this.getHeader('Set-Cookie') || [];\n // Avoid spread operator - direct array manipulation\n const cookies = Array.isArray(existingCookies) ? existingCookies : [existingCookies as string];\n cookies.push(cookieString);\n this.setHeader('Set-Cookie', cookies);\n\n return this;\n }\n\n clearCookie(name: string, options: any = {}): this {\n // Avoid spread operator - manually set properties\n const clearOptions: any = {\n expires: new Date(0),\n maxAge: 0,\n };\n // Copy other options manually\n if (options.path !== undefined) clearOptions.path = options.path;\n if (options.domain !== undefined) clearOptions.domain = options.domain;\n if (options.httpOnly !== undefined) clearOptions.httpOnly = options.httpOnly;\n if (options.secure !== undefined) clearOptions.secure = options.secure;\n if (options.sameSite !== undefined) clearOptions.sameSite = options.sameSite;\n return this.cookie(name, '', clearOptions);\n }\n\n redirect(url: string, status: number = 302): void {\n if (this.headersSent) return;\n this.statusCode = status;\n const safeUrl = url.replace(/[\\r\\n]/g, '');\n this.setHeader('Location', safeUrl);\n this.end();\n }\n\n async sendFile(filePath: string): Promise<void> {\n if (this.headersSent) return;\n\n try {\n const fs = await import('fs/promises');\n const path = await import('path');\n const extension = path.extname(filePath);\n const mime = await this._server.getMimeType(extension);\n\n const stats = await fs.stat(filePath);\n const data = await fs.readFile(filePath);\n\n // Add charset for text-based files\n const contentType = this._server.addCharsetIfNeeded(mime);\n this.setHeader('Content-Type', contentType);\n this.setHeader('Content-Length', stats.size);\n\n // Add security headers for file downloads\n this.setHeader('X-Content-Type-Options', 'nosniff');\n\n // Add caching headers\n this.setHeader('Last-Modified', stats.mtime.toUTCString());\n this.setHeader('Cache-Control', 'public, max-age=31536000'); // 1 year for static files\n\n this.end(data);\n } catch {\n this.status(404).json({ success: false, error: 'File not found' });\n }\n }\n\n // Standardized response helpers\n success<T = any>(data: T, message?: string): void {\n const response: any = {\n success: true,\n data,\n };\n if (message !== undefined) {\n response.message = message;\n }\n this.json(response);\n }\n\n error(error: string, code?: string, message?: string): void {\n const response: any = {\n success: false,\n error,\n };\n if (code !== undefined) {\n response.code = code;\n }\n if (message !== undefined) {\n response.message = message;\n }\n this.json(response);\n }\n\n // Common HTTP error helpers (automatically set status code)\n unauthorized(message: string = 'Authentication required'): void {\n this.statusCode = 401;\n this.json({\n success: false,\n error: 'Unauthorized',\n code: 'UNAUTHORIZED',\n message,\n });\n }\n\n forbidden(message: string = 'Insufficient permissions'): void {\n this.statusCode = 403;\n this.json({\n success: false,\n error: 'Forbidden',\n code: 'FORBIDDEN',\n message,\n });\n }\n\n notFound(resource: string = 'Resource'): void {\n this.statusCode = 404;\n this.json({\n success: false,\n error: 'Not Found',\n code: 'NOT_FOUND',\n message: `${resource} not found`,\n });\n }\n\n badRequest(message: string = 'Invalid request'): void {\n this.statusCode = 400;\n this.json({\n success: false,\n error: 'Bad Request',\n code: 'BAD_REQUEST',\n message,\n });\n }\n\n conflict(message: string): void {\n this.statusCode = 409;\n this.json({\n success: false,\n error: 'Conflict',\n code: 'CONFLICT',\n message,\n });\n }\n\n internalError(message: string = 'Internal server error'): void {\n this.statusCode = 500;\n this.json({\n success: false,\n error: 'Internal Server Error',\n code: 'INTERNAL_ERROR',\n message,\n });\n }\n\n validationError(errors: Array<{ field: string; message: string; code?: string }>): void {\n this.statusCode = 422;\n this.json({\n success: false,\n error: 'Validation Failed',\n code: 'VALIDATION_ERROR',\n errors,\n });\n }\n\n rateLimited(retryAfter?: number): void {\n this.statusCode = 429;\n if (retryAfter) {\n this.setHeader('Retry-After', retryAfter.toString());\n }\n this.json({\n success: false,\n error: 'Rate Limit Exceeded',\n code: 'RATE_LIMITED',\n message: retryAfter\n ? `Too many requests. Retry after ${retryAfter} seconds.`\n : 'Too many requests',\n retryAfter,\n });\n }\n\n // Common success patterns\n created<T = any>(data: T, location?: string): void {\n this.statusCode = 201;\n if (location) {\n this.setHeader('Location', location);\n }\n this.json({\n success: true,\n data,\n });\n }\n\n noContent(): void {\n this.statusCode = 204;\n this.end();\n }\n\n paginated<T = any>(data: T[], pagination: { page: number; limit: number; total: number }): void {\n const totalPages = Math.ceil(pagination.total / pagination.limit);\n this.json({\n success: true,\n data,\n pagination: {\n page: pagination.page,\n limit: pagination.limit,\n total: pagination.total,\n totalPages,\n hasNext: pagination.page < totalPages,\n hasPrev: pagination.page > 1,\n },\n });\n }\n\n // Header management utilities\n override hasHeader(name: string): boolean {\n return this.getHeader(name) !== undefined;\n }\n\n setBulkHeaders(headers: Record<string, string | number>): this {\n if (this.headersSent) {\n // Only enumerate keys for warning if headers were already sent\n const attemptedHeaderKeys = [];\n for (const key in headers) {\n attemptedHeaderKeys.push(key);\n }\n this._server?.logger.warn('Cannot set headers - headers already sent', 'HeaderWarning', {\n attemptedHeaders: attemptedHeaderKeys,\n });\n return this;\n }\n\n for (const key in headers) {\n const value = headers[key];\n if (value !== undefined) this.setHeader(key, value);\n }\n return this;\n }\n\n override appendHeader(name: string, value: string | string[]): this {\n if (this.headersSent) {\n this._server?.logger.warn(\n `Cannot append to header '${name}' - headers already sent`,\n 'HeaderWarning'\n );\n return this;\n }\n\n const existing = this.getHeader(name);\n if (existing) {\n const values = Array.isArray(existing) ? existing : [existing.toString()];\n const newValues = Array.isArray(value) ? value : [value];\n this.setHeader(name, [...values, ...newValues]);\n } else {\n this.setHeader(name, value);\n }\n return this;\n }\n\n // Express-compatible response helpers\n set(\n field: string | Record<string, string | string[] | number>,\n value?: string | string[] | number\n ): this {\n if (this.headersSent) return this;\n if (typeof field === 'string') {\n if (value !== undefined) {\n this.setHeader(field, value as any);\n }\n } else {\n for (const key in field) {\n this.setHeader(key, field[key] as any);\n }\n }\n return this;\n }\n\n get(field: string): any {\n return this.getHeader(field) as any;\n }\n\n append(field: string, value: string | string[]): this {\n return this.appendHeader(field, value);\n }\n\n type(contentType: string): this {\n if (this.headersSent) return this;\n // If no \"/\" treat as shorthand (e.g. \"json\" → \"application/json\")\n let ct = contentType;\n if (ct.indexOf('/') === -1) {\n ct = TYPE_SHORTHANDS[ct.toLowerCase()] || `application/${ct}`;\n }\n this.setHeader('Content-Type', ct);\n return this;\n }\n\n sendStatus(code: number): void {\n if (this.headersSent) return;\n this.statusCode = code;\n const body = STATUS_MESSAGES[code] || String(code);\n this.setHeader('Content-Type', 'text/plain; charset=utf-8');\n this.end(body);\n }\n\n location(url: string): this {\n if (this.headersSent) return this;\n const safe = url.replace(/[\\r\\n]/g, '');\n this.setHeader('Location', safe);\n return this;\n }\n\n vary(field: string | string[]): this {\n if (this.headersSent) return this;\n const existing = this.getHeader('Vary');\n const existingList = existing\n ? String(existing)\n .split(',')\n .map(s => s.trim())\n .filter(Boolean)\n : [];\n const incoming = Array.isArray(field) ? field : [field];\n for (const f of incoming) {\n if (!existingList.some(e => e.toLowerCase() === f.toLowerCase())) {\n existingList.push(f);\n }\n }\n this.setHeader('Vary', existingList.join(', '));\n return this;\n }\n\n attachment(filename?: string): this {\n if (this.headersSent) return this;\n if (filename) {\n const safeName = filename.replace(/[\\r\\n\"]/g, '');\n this.setHeader('Content-Disposition', `attachment; filename=\"${safeName}\"`);\n // Set Content-Type from extension if not already set\n if (!this.getHeader('Content-Type')) {\n // fire-and-forget mime lookup; not awaited to keep signature chainable\n void this._server\n .getMimeType(filename.substring(filename.lastIndexOf('.')))\n .then(mime => {\n if (!this.getHeader('Content-Type') && !this.headersSent) {\n this.setHeader('Content-Type', mime);\n }\n })\n .catch(() => {\n // best-effort content-type inference\n });\n }\n } else {\n this.setHeader('Content-Disposition', 'attachment');\n }\n return this;\n }\n\n async download(filePath: string, filename?: string): Promise<void> {\n this.attachment(filename || filePath.split('/').pop());\n return this.sendFile(filePath);\n }\n\n format(handlers: Record<string, () => any | Promise<any>>): void {\n const types = Object.keys(handlers).filter(k => k !== 'default');\n const matched = ((this as any).req as HttpRequest).accepts(types);\n const chosen = matched ? handlers[matched as string] : handlers.default;\n if (!chosen) {\n this.statusCode = 406;\n this.setHeader('Content-Type', 'text/plain; charset=utf-8');\n this.end('Not Acceptable');\n return;\n }\n this.vary('Accept');\n if (matched && typeof matched === 'string') {\n this.type(matched);\n }\n chosen();\n }\n\n links(links: Record<string, string>): this {\n if (this.headersSent) return this;\n const parts: string[] = [];\n for (const rel in links) {\n parts.push(`<${links[rel]}>; rel=\"${rel}\"`);\n }\n if (parts.length > 0) {\n const existing = this.getHeader('Link');\n const combined = existing ? `${existing}, ${parts.join(', ')}` : parts.join(', ');\n this.setHeader('Link', combined);\n }\n return this;\n }\n\n // Response state utilities\n canSetHeaders(): boolean {\n return !this.headersSent;\n }\n\n getResponseState() {\n return {\n headersSent: this.headersSent,\n statusCode: this.statusCode,\n headers: this.getHeaders ? this.getHeaders() : {},\n finished: this.finished || false,\n writable: this.writable,\n };\n }\n}\n\nexport class MoroHttpServer {\n private server: Server | HttpsServer;\n /** Multipart limits threaded to parseMultipart at the call site. */\n private multipartLimits?: MultipartLimits;\n /** TCP backlog for listen(), when configured. */\n private listenBacklog?: number;\n private routes: RouteEntry[] = [];\n private globalMiddleware: Middleware[] = [];\n /** @internal read by MoroServerResponse prototype methods */\n compressionEnabled = true;\n /** @internal read by MoroServerResponse prototype methods */\n compressionThreshold = 1024;\n /** @internal read by MoroIncomingMessage prototype methods */\n requestTrackingEnabled = true; // Generate request IDs\n /** @internal read by MoroServerResponse prototype methods */\n logger = createFrameworkLogger('HttpServer');\n private hookManager: any;\n private requestCounter = 0;\n private errorHandler?: (err: any, req: HttpRequest, res: HttpResponse) => any | Promise<any>;\n private requestDecorations: Record<string, any> = {};\n private responseDecorations: Record<string, any> = {};\n\n // Per-server request/response subclasses; their prototype carries the\n // `_server` back-reference plus user decorations (applied once, not per request)\n private RequestClass!: typeof MoroIncomingMessage;\n private ResponseClass!: typeof MoroServerResponse;\n\n // Direct router dispatch slot - runs after global middleware without the\n // per-middleware promise machinery (set from Moro.listen via setRouterHandler)\n private routerHandler?: (req: HttpRequest, res: HttpResponse) => boolean | Promise<boolean>;\n\n // Body size limits - defaults overridden by config in constructor\n private maxBodySize: number = 10 * 1024 * 1024; // Default 10MB (overridden by server.bodySizeLimit config)\n private maxUploadSize: number = 100 * 1024 * 1024; // Default 100MB for file uploads (future: configurable)\n\n // Use shared object pool manager\n private poolManager = ObjectPoolManager.getInstance();\n\n // Interned method strings for fast reference equality comparison\n private static readonly METHOD_POST = 'POST';\n private static readonly METHOD_PUT = 'PUT';\n private static readonly METHOD_PATCH = 'PATCH';\n private static readonly METHOD_GET = 'GET';\n private static readonly METHOD_DELETE = 'DELETE';\n private static readonly METHOD_HEAD = 'HEAD';\n private static readonly METHOD_OPTIONS = 'OPTIONS';\n\n // Pre-compiled response templates for common responses\n private static readonly RESPONSE_TEMPLATES = {\n notFound: Buffer.from('{\"success\":false,\"error\":\"Not found\"}'),\n unauthorized: Buffer.from('{\"success\":false,\"error\":\"Unauthorized\"}'),\n forbidden: Buffer.from('{\"success\":false,\"error\":\"Forbidden\"}'),\n internalError: Buffer.from('{\"success\":false,\"error\":\"Internal server error\"}'),\n methodNotAllowed: Buffer.from('{\"success\":false,\"error\":\"Method not allowed\"}'),\n rateLimited: Buffer.from('{\"success\":false,\"error\":\"Rate limit exceeded\"}'),\n };\n\n constructor(options?: {\n maxBodySize?: number;\n maxUploadSize?: number;\n /** node-style TLS material (from the unified ssl normalizer). When present\n * the server is created via https.createServer. */\n ssl?: {\n key: string | Buffer;\n cert: string | Buffer;\n ca?: Array<string | Buffer>;\n passphrase?: string;\n minVersion?: string;\n requestCert?: boolean;\n rejectUnauthorized?: boolean;\n };\n limits?: HttpRuntimeLimits;\n }) {\n // Per-instance subclasses so prototype methods can reach this server's\n // config (logger, compression) with zero per-request allocation.\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const boundServer = this;\n class BoundRequest extends MoroIncomingMessage {}\n class BoundResponse extends MoroServerResponse {}\n BoundRequest.prototype._server = boundServer;\n BoundResponse.prototype._server = boundServer;\n this.RequestClass = BoundRequest;\n this.ResponseClass = BoundResponse;\n\n const limits = options?.limits;\n // maxHeaderSize is a createServer option (not a mutable property), so it\n // must be passed here.\n const serverOpts: any = {\n IncomingMessage: BoundRequest as any,\n ServerResponse: BoundResponse as any,\n ...(limits?.maxHeaderSize && { maxHeaderSize: limits.maxHeaderSize }),\n };\n\n if (options?.ssl) {\n // In-process HTTPS. The https ServerOptions extends the http one, so the\n // IncomingMessage/ServerResponse subclass injection carries over.\n const https = requireBuiltin('https') as typeof import('https');\n this.server = https.createServer(\n { ...serverOpts, ...options.ssl },\n this.handleRequest.bind(this) as any\n );\n this.logger.info('HTTPS server created (in-process TLS)', 'HttpServer');\n } else {\n this.server = createServer(serverOpts, this.handleRequest.bind(this) as any);\n }\n\n // Configure body size limits from options\n if (options?.maxBodySize) {\n this.maxBodySize = options.maxBodySize;\n }\n if (options?.maxUploadSize) {\n this.maxUploadSize = options.maxUploadSize;\n }\n if (limits?.multipart) this.multipartLimits = limits.multipart;\n\n // Timeouts: the previous hardcodes (keepAlive 5000, headers 6000) become\n // the documented defaults; a configured value overrides them. Socket idle\n // timeout stays 0 (disabled) unless set - a non-zero value arms a\n // per-request timer that shows up in CPU profiles under load.\n const t = limits?.timeouts ?? {};\n this.server.keepAliveTimeout = t.keepAlive ?? 5000;\n this.server.headersTimeout = t.headers ?? 6000;\n this.server.timeout = t.idle ?? 0;\n if (t.request) this.server.requestTimeout = t.request;\n if (limits?.maxConnections && limits.maxConnections > 0) {\n this.server.maxConnections = limits.maxConnections;\n }\n if (limits?.maxHeaders) this.server.maxHeadersCount = limits.maxHeaders;\n if (limits?.backlog !== undefined) this.listenBacklog = limits.backlog;\n }\n\n // Direct router dispatch - called after global middleware, before the legacy\n // route table. Returning true (or a promise of true) means the request was handled.\n setRouterHandler(fn: (req: HttpRequest, res: HttpResponse) => boolean | Promise<boolean>): void {\n this.routerHandler = fn;\n }\n\n // Configure server for maximum performance (can disable all overhead)\n configurePerformance(\n config: {\n compression?: { enabled: boolean; threshold?: number };\n minimal?: boolean;\n } = {}\n ) {\n if (config.compression !== undefined) {\n this.compressionEnabled = config.compression.enabled;\n if (config.compression.threshold !== undefined) {\n this.compressionThreshold = config.compression.threshold;\n }\n }\n\n // Minimal mode - disable ALL overhead for pure speed\n if (config.minimal) {\n this.compressionEnabled = false;\n this.compressionThreshold = Infinity; // Never compress\n }\n }\n\n // Configure request tracking (ID generation)\n setRequestTracking(enabled: boolean): void {\n this.requestTrackingEnabled = enabled;\n }\n\n // Register a global error handler (called from Moro.setErrorHandler)\n setErrorHandler(fn: (err: any, req: HttpRequest, res: HttpResponse) => any | Promise<any>): void {\n this.errorHandler = fn;\n }\n\n // Apply request/response decoration maps (called from Moro.decorateRequest/Reply).\n // Decorations are installed on the per-server prototypes once, so requests pay\n // nothing for them; per-request writes to the same key simply shadow the prototype.\n setRequestDecorations(decorations: Record<string, any>): void {\n this.requestDecorations = decorations;\n for (const key in decorations) {\n Object.defineProperty(this.RequestClass.prototype, key, {\n value: decorations[key],\n writable: true,\n enumerable: true,\n configurable: true,\n });\n }\n }\n\n setResponseDecorations(decorations: Record<string, any>): void {\n this.responseDecorations = decorations;\n for (const key in decorations) {\n Object.defineProperty(this.ResponseClass.prototype, key, {\n value: decorations[key],\n writable: true,\n enumerable: true,\n configurable: true,\n });\n }\n }\n\n // Middleware management\n use(middleware: Middleware): void {\n // Defensive check: Don't add MiddlewareInterface objects to globalMiddleware\n // MiddlewareInterface objects should only be handled by MiddlewareManager\n if (\n middleware &&\n typeof middleware === 'object' &&\n (middleware as any).install &&\n (middleware as any).metadata\n ) {\n this.logger?.warn?.(\n `Attempted to add MiddlewareInterface \"${(middleware as any).metadata?.name}\" to HTTP server globalMiddleware. ` +\n `This should be handled by MiddlewareManager instead. Skipping.`,\n 'Middleware'\n );\n return;\n }\n\n this.globalMiddleware.push(middleware);\n }\n\n // Set hooks manager for request processing\n setHookManager(hookManager: any): void {\n this.hookManager = hookManager;\n }\n\n // Routing methods\n get(path: string, ...handlers: (Middleware | HttpHandler)[]): void {\n this.addRoute('GET', path, handlers);\n }\n\n post(path: string, ...handlers: (Middleware | HttpHandler)[]): void {\n this.addRoute('POST', path, handlers);\n }\n\n put(path: string, ...handlers: (Middleware | HttpHandler)[]): void {\n this.addRoute('PUT', path, handlers);\n }\n\n delete(path: string, ...handlers: (Middleware | HttpHandler)[]): void {\n this.addRoute('DELETE', path, handlers);\n }\n\n patch(path: string, ...handlers: (Middleware | HttpHandler)[]): void {\n this.addRoute('PATCH', path, handlers);\n }\n\n private addRoute(method: string, path: string, handlers: (Middleware | HttpHandler)[]): void {\n const { pattern, paramNames } = this.pathToRegex(path);\n const handler = handlers.pop() as HttpHandler;\n const middleware = handlers as Middleware[];\n\n const route = {\n method,\n path,\n pattern,\n paramNames,\n handler,\n middleware,\n };\n\n this.routes.push(route);\n\n // Organize routes for optimal lookup\n if (paramNames.length === 0) {\n // Static route - O(1) lookup\n const staticKey = `${method}:${path}`;\n this.staticRoutes.set(staticKey, route);\n } else {\n // Dynamic route - organize by segment count for faster matching\n this.dynamicRoutes.push(route);\n\n const segmentCount = PathMatcher.countSegments(path);\n\n if (!this.routesBySegmentCount.has(segmentCount)) {\n this.routesBySegmentCount.set(segmentCount, []);\n }\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n this.routesBySegmentCount.get(segmentCount)!.push(route);\n }\n }\n\n private pathToRegex(path: string): { pattern: RegExp; paramNames: string[] } {\n // Use shared PathMatcher for consistent path compilation\n const compiled = PathMatcher.compile(path);\n return {\n pattern: compiled.pattern || new RegExp(`^${path.replace(/\\//g, '\\\\/')}$`),\n paramNames: compiled.paramNames,\n };\n }\n\n // Request entry point. Deliberately NOT an async function: the common case\n // (no body, no hooks, no global middleware, sync route handler) completes\n // fully synchronously with zero promise allocations and zero microtask\n // hops. Anything that genuinely needs to await routes through\n // handleRequestSlow.\n private handleRequest(req: IncomingMessage, res: ServerResponse): void {\n // req/res arrive as the per-server subclasses (MoroIncomingMessage /\n // MoroServerResponse) - all helpers are already on their prototypes.\n const httpReq = req as unknown as HttpRequest & MoroIncomingMessage;\n const httpRes = res as unknown as HttpResponse & MoroServerResponse;\n\n // URL split - query string parsing is lazy (MoroIncomingMessage#query getter)\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const urlString = req.url!;\n const queryIndex = urlString.indexOf('?');\n\n if (queryIndex === -1) {\n httpReq.path = urlString;\n } else {\n httpReq.path = urlString.substring(0, queryIndex);\n httpReq._queryString = urlString.substring(queryIndex + 1);\n }\n\n // Intern method string for fast reference equality comparison (50-100% faster)\n switch (req.method) {\n case 'POST':\n httpReq.method = MoroHttpServer.METHOD_POST;\n break;\n case 'PUT':\n httpReq.method = MoroHttpServer.METHOD_PUT;\n break;\n case 'PATCH':\n httpReq.method = MoroHttpServer.METHOD_PATCH;\n break;\n case 'GET':\n httpReq.method = MoroHttpServer.METHOD_GET;\n break;\n case 'DELETE':\n httpReq.method = MoroHttpServer.METHOD_DELETE;\n break;\n case 'HEAD':\n httpReq.method = MoroHttpServer.METHOD_HEAD;\n break;\n case 'OPTIONS':\n httpReq.method = MoroHttpServer.METHOD_OPTIONS;\n break;\n }\n\n const needsBody =\n httpReq.method === MoroHttpServer.METHOD_POST ||\n httpReq.method === MoroHttpServer.METHOD_PUT ||\n httpReq.method === MoroHttpServer.METHOD_PATCH;\n const hookManager = this.hookManager;\n const hasHooks = !!(\n hookManager &&\n (hookManager.hasHooks === undefined ||\n hookManager.hasHooks('request') ||\n hookManager.hasHooks('response'))\n );\n\n if (needsBody || hasHooks || this.globalMiddleware.length > 0) {\n // Slow path: real awaits ahead (body parse / hooks / middleware).\n // Errors are fully handled inside - the returned promise never rejects.\n void this.handleRequestSlow(httpReq, httpRes, req, needsBody, hasHooks);\n return;\n }\n\n // FAST PATH - no promises unless the route handler itself is async\n try {\n const routerHandler = this.routerHandler;\n if (routerHandler) {\n const handled = routerHandler(httpReq, httpRes);\n if (handled) {\n if (typeof (handled as any).then === 'function') {\n (handled as Promise<boolean>).then(\n wasHandled => {\n if (!wasHandled && !httpRes.headersSent) {\n try {\n this.dispatchLegacyRoute(httpReq, httpRes, req);\n } catch (error) {\n void this.onRequestError(error, httpReq, httpRes, req);\n }\n }\n },\n error => void this.onRequestError(error, httpReq, httpRes, req)\n );\n }\n return;\n }\n if (httpRes.headersSent) return;\n }\n\n this.dispatchLegacyRoute(httpReq, httpRes, req);\n } catch (error) {\n void this.onRequestError(error, httpReq, httpRes, req);\n }\n }\n\n // Full async pipeline for requests that need it: bodied methods, hook\n // consumers, and apps with global middleware.\n private async handleRequestSlow(\n httpReq: HttpRequest & MoroIncomingMessage,\n httpRes: HttpResponse & MoroServerResponse,\n req: IncomingMessage,\n needsBody: boolean,\n hasHooks: boolean\n ): Promise<void> {\n try {\n if (needsBody) {\n httpReq.body = await this.parseBody(req);\n }\n\n if (hasHooks) {\n await this.hookManager.execute('request', {\n request: httpReq,\n response: httpRes,\n });\n\n // Post-response hooks (session persistence, auth session refresh,\n // CDN invalidation) run after the response is flushed, off the\n // request's critical path.\n if (this.hookManager.hasHooks === undefined || this.hookManager.hasHooks('response')) {\n httpRes.once('finish', () => {\n void Promise.resolve(\n this.hookManager.execute('response', { request: httpReq, response: httpRes })\n ).catch((error: any) =>\n this.logger?.error?.(`Response hook error: ${error?.message || error}`, 'Hooks')\n );\n });\n }\n }\n\n // A request hook may answer the request itself (rate limiting, auth\n // rejection). Registration of the response hooks above still stands.\n if (httpRes.headersSent) return;\n\n // executeMiddleware returns undefined when the whole chain completed\n // synchronously, so a sync chain costs zero promise allocations.\n if (this.globalMiddleware.length > 0) {\n const mwResult = this.executeMiddleware(this.globalMiddleware, httpReq, httpRes);\n if (mwResult) await mwResult;\n }\n\n // If middleware handled the request, don't continue\n if (httpRes.headersSent) {\n return;\n }\n\n // Unified router direct dispatch - no middleware-chain promise wrapper\n const routerHandler = this.routerHandler;\n if (routerHandler) {\n const handled = routerHandler(httpReq, httpRes);\n if (handled) {\n if (typeof (handled as any).then === 'function') {\n if (await handled) return;\n } else {\n return;\n }\n }\n if (httpRes.headersSent) return;\n }\n\n this.dispatchLegacyRoute(httpReq, httpRes, req);\n } catch (error) {\n await this.onRequestError(error, httpReq, httpRes, req);\n }\n }\n\n // Legacy direct-route table dispatch + 404 fallback. Synchronous; async\n // route middleware/handlers are continued via promise callbacks wired to\n // onRequestError so the sync fast path stays promise-free.\n private dispatchLegacyRoute(\n httpReq: HttpRequest & MoroIncomingMessage,\n httpRes: HttpResponse & MoroServerResponse,\n req: IncomingMessage\n ): void {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const route = this.findRoute(req.method!, httpReq.path);\n if (!route) {\n // 404 response with pre-compiled buffer\n httpRes.statusCode = 404;\n httpRes.setHeader('Content-Type', 'application/json; charset=utf-8');\n httpRes.setHeader('Content-Length', MoroHttpServer.RESPONSE_TEMPLATES.notFound.length);\n httpRes.end(MoroHttpServer.RESPONSE_TEMPLATES.notFound);\n return;\n }\n\n // Extract path parameters\n const matches = httpReq.path.match(route.pattern);\n if (matches) {\n const params: Record<string, string> = {};\n const paramNames = route.paramNames;\n const paramNamesLen = paramNames.length;\n for (let i = 0; i < paramNamesLen; i++) {\n const paramName = paramNames[i];\n const value = matches[i + 1];\n if (paramName !== undefined && value !== undefined) {\n params[paramName] = value;\n }\n }\n httpReq.params = params;\n }\n\n const runHandler = () => {\n // Execute handler - Don't await sync handlers\n const handlerResult = route.handler(httpReq, httpRes);\n if (handlerResult && typeof handlerResult.then === 'function') {\n (handlerResult as Promise<void>).catch(\n error => void this.onRequestError(error, httpReq, httpRes, req)\n );\n }\n };\n\n // Execute middleware chain - EARLY EXIT if no route middleware\n if (route.middleware.length > 0) {\n const mwResult = this.executeMiddleware(route.middleware, httpReq, httpRes);\n if (mwResult) {\n mwResult.then(runHandler, error => void this.onRequestError(error, httpReq, httpRes, req));\n return;\n }\n }\n\n runHandler();\n }\n\n // Shared error handling for all request paths (sync throw, slow-path catch,\n // and promise rejections from async handlers/middleware). Never throws.\n private async onRequestError(\n error: unknown,\n httpReq: HttpRequest & MoroIncomingMessage,\n httpRes: HttpResponse & MoroServerResponse,\n req: IncomingMessage\n ): Promise<void> {\n // Error hooks are observational (Sentry-style reporting, audit trails):\n // fire-and-forget so a slow or throwing observer can never delay or\n // alter the error response.\n if (\n this.hookManager &&\n (this.hookManager.hasHooks === undefined || this.hookManager.hasHooks('error'))\n ) {\n void Promise.resolve(\n this.hookManager.execute('error', { request: httpReq, response: httpRes, error })\n ).catch((hookError: any) =>\n this.logger?.error?.(`Error hook error: ${hookError?.message || hookError}`, 'Hooks')\n );\n }\n\n try {\n // Debug: Log the actual error and where it came from\n this.logger.debug('Request error details', 'RequestHandler', {\n errorType: typeof error,\n errorMessage: error instanceof Error ? error.message : String(error),\n errorStack: error instanceof Error ? error.stack : 'No stack trace',\n requestPath: req.url,\n requestMethod: req.method,\n });\n\n // Payload-too-large from parseBody: respond 413 (matches the old bodySize\n // middleware semantics, now enforced in-server)\n if ((error as any)?.statusCode === 413 && !httpRes.headersSent) {\n httpRes.statusCode = 413;\n httpRes.json({\n success: false,\n error: 'Request entity too large',\n });\n return;\n }\n\n this.logger.error('Request error', 'RequestHandler', {\n error: error instanceof Error ? error.message : String(error),\n requestId: httpReq.requestId,\n method: req.method,\n path: req.url,\n });\n\n // User-registered global error handler takes precedence over the default 500.\n if (this.errorHandler && !httpRes.headersSent) {\n try {\n const handlerResult = this.errorHandler(error, httpReq, httpRes);\n if (handlerResult && typeof (handlerResult as any).then === 'function') {\n await handlerResult;\n }\n if (httpRes.headersSent) return;\n } catch (handlerErr) {\n this.logger.error('Error handler itself threw', 'RequestHandler', {\n error: handlerErr instanceof Error ? handlerErr.message : String(handlerErr),\n });\n }\n }\n\n if (!httpRes.headersSent) {\n // A malformed body is a client error: default to 400 (parity with the\n // engine/uWS transports), not the generic 500.\n const isBadRequest = (error as any)?.statusCode === 400;\n const defaultStatus = isBadRequest ? 400 : 500;\n const defaultError = isBadRequest ? 'Invalid request body' : 'Internal server error';\n // Ensure response is properly enhanced before using custom methods\n if (typeof httpRes.status === 'function' && typeof httpRes.json === 'function') {\n httpRes.status(defaultStatus).json({\n success: false,\n error: defaultError,\n requestId: httpReq.requestId,\n });\n } else {\n // Defensive fallback - check each method individually\n if (typeof httpRes.setHeader === 'function') {\n httpRes.statusCode = defaultStatus;\n httpRes.setHeader('Content-Type', 'application/json');\n } else {\n // Even setHeader doesn't exist - object is completely wrong\n this.logger.error('Response object is not a proper ServerResponse', 'RequestHandler', {\n responseType: typeof httpRes,\n responseKeys: Object.keys(httpRes),\n });\n }\n\n if (typeof httpRes.end === 'function') {\n httpRes.end(\n JSON.stringify({\n success: false,\n error: defaultError,\n requestId: httpReq.requestId,\n })\n );\n } else {\n this.logger.error(\n 'Cannot send error response - end() method missing',\n 'RequestHandler'\n );\n }\n }\n }\n } catch (fatalError) {\n // Error handling itself failed (e.g. the connection died mid-response) -\n // never let this escape as an unhandled rejection\n this.logger.error('Failed while handling request error', 'RequestHandler', {\n error: fatalError instanceof Error ? fatalError.message : String(fatalError),\n });\n }\n }\n\n // Force cleanup of all pooled objects\n private forceCleanupPools(): void {\n // Use shared pool manager cleanup\n this.poolManager.clearAll();\n\n // Force garbage collection if available\n if (globalThis?.gc) {\n globalThis.gc();\n }\n }\n\n private acquireBuffer(size: number): Buffer {\n return this.poolManager.acquireBuffer(size);\n }\n\n private releaseBuffer(buffer: Buffer): void {\n this.poolManager.releaseBuffer(buffer);\n }\n\n private streamLargeResponse(res: any, data: any): void {\n res.setHeader('Content-Type', 'application/json; charset=utf-8');\n res.setHeader('Transfer-Encoding', 'chunked');\n\n // Stream large JSON responses to prevent memory issues\n if (Array.isArray(data) && data.length > 100) {\n // Stream large arrays element by element\n res.write('[');\n\n // Stream each array element\n let first = true;\n for (const item of data) {\n if (!first) res.write(',');\n res.write(JSON.stringify(item));\n first = false;\n }\n\n // Write closing bracket and end\n res.end(']');\n } else if (typeof data === 'object' && data !== null && Object.keys(data).length > 50) {\n // For large objects, stream key-value pairs\n res.write('{');\n const keys = Object.keys(data);\n let first = true;\n\n for (const key of keys) {\n if (!first) res.write(',');\n // Properly escape the key using JSON.stringify\n res.write(`${JSON.stringify(key)}:${JSON.stringify(data[key])}`);\n first = false;\n }\n\n res.end('}');\n } else {\n // For smaller data, still avoid the old chunking approach\n const jsonString = JSON.stringify(data);\n res.end(jsonString);\n }\n }\n\n private normalizePath(path: string): string {\n // Check cache first\n if (this.pathNormalizationCache.has(path)) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n return this.pathNormalizationCache.get(path)!;\n }\n\n // Normalization: remove trailing slash (except root), decode once\n let normalized = path;\n if (normalized.length > 1 && normalized.endsWith('/')) {\n normalized = normalized.slice(0, -1);\n }\n\n // Cache result (limit cache size)\n if (this.pathNormalizationCache.size < 200) {\n this.pathNormalizationCache.set(path, normalized);\n }\n\n return normalized;\n }\n\n /** @internal called by MoroServerResponse prototype methods */\n async getMimeType(ext: string): Promise<string> {\n const mimeTypes: Record<string, string> = {\n '.html': 'text/html',\n '.css': 'text/css',\n '.js': 'application/javascript',\n '.json': 'application/json',\n '.png': 'image/png',\n '.jpg': 'image/jpeg',\n '.jpeg': 'image/jpeg',\n '.gif': 'image/gif',\n '.svg': 'image/svg+xml',\n '.ico': 'image/x-icon',\n '.pdf': 'application/pdf',\n '.txt': 'text/plain',\n '.xml': 'application/xml',\n };\n\n return mimeTypes[ext.toLowerCase()] || 'application/octet-stream';\n }\n\n /** @internal called by MoroServerResponse prototype methods */\n addCharsetIfNeeded(mimeType: string): string {\n // Add charset for text-based content types - optimized with early exit\n // Check most common cases first\n if (\n mimeType.startsWith('text/') ||\n mimeType.startsWith('application/json') ||\n mimeType.startsWith('application/javascript') ||\n mimeType.startsWith('application/xml') ||\n mimeType.startsWith('image/svg+xml')\n ) {\n if (!mimeType.includes('charset')) {\n return `${mimeType}; charset=utf-8`;\n }\n }\n\n return mimeType;\n }\n\n private async parseBody(req: IncomingMessage): Promise<any> {\n const contentType = req.headers['content-type'] || '';\n const contentLength = parseInt(req.headers['content-length'] || '0');\n\n // Use different limits based on content type\n // Multipart (file uploads) need much larger limits than JSON/form data\n const isMultipart = contentType.includes('multipart/form-data');\n const maxSize = isMultipart\n ? this.maxUploadSize // Configurable file upload limit (default 100MB)\n : this.maxBodySize; // Configurable body size limit (default 10MB, from server.bodySizeLimit config)\n\n // Early rejection from the declared Content-Length - nothing is read off the wire\n if (contentLength > maxSize) {\n const error: any = new Error('Request entity too large');\n error.statusCode = 413;\n error.limit = maxSize;\n error.received = contentLength;\n return Promise.reject(error);\n }\n\n // Buffer every body up to maxSize and parse it into its real shape. The\n // incremental limit check below already bounds memory, and every other\n // backend (uWS, engine) returns the parsed body here - previously bodies\n // between maxSize/2 and maxSize resolved to a { type, parser } descriptor\n // object instead, so handlers/validation on the Node backend silently saw\n // a bogus shape for the exact same request that parsed normally elsewhere.\n return new Promise((resolve, reject) => {\n const chunks: Buffer[] = [];\n let totalLength = 0;\n\n req.on('data', (chunk: Buffer) => {\n totalLength += chunk.length;\n if (totalLength > maxSize) {\n const errorMessage = isMultipart\n ? `File upload too large. Maximum ${Math.floor(maxSize / (1024 * 1024))}MB allowed.`\n : 'Request body too large';\n const error: any = new Error(errorMessage);\n error.statusCode = 413;\n error.limit = maxSize;\n reject(error);\n return;\n }\n chunks.push(chunk);\n });\n\n req.on('end', () => {\n try {\n // Single-chunk fast path (most JSON bodies arrive in one chunk);\n // otherwise concat with the known total length to avoid a re-scan\n const firstChunk = chunks[0];\n const body =\n chunks.length === 1 && firstChunk !== undefined\n ? firstChunk\n : Buffer.concat(chunks, totalLength);\n if (totalLength > 0) (req as MoroIncomingMessage)._rawBody = body;\n\n if (contentType.includes('application/json')) {\n // Empty JSON body -> null (parity with the engine/uWS servers, and\n // avoids JSON.parse('') throwing and 500ing an empty POST).\n resolve(totalLength === 0 ? null : JSON.parse(body.toString()));\n } else if (contentType.includes('application/x-www-form-urlencoded')) {\n resolve(this.parseUrlEncoded(body.toString()));\n } else if (contentType.includes('multipart/form-data')) {\n resolve(this.parseMultipart(body, contentType));\n } else {\n // Text decodes to a string; binary (octet-stream, images, protobuf,\n // ...) stays a Buffer - decoding it would corrupt it irreversibly.\n resolve(bodyIsText(contentType) ? body.toString() : body);\n }\n } catch (error) {\n // A malformed body is a client error (400), not a server error (500).\n // Tag it so the request-error path answers 400, matching the engine\n // and uWS transports.\n if (error instanceof Error && (error as any).statusCode === undefined) {\n (error as any).statusCode = 400;\n }\n reject(error);\n }\n });\n\n req.on('error', reject);\n });\n }\n\n private parseMultipart(\n buffer: Buffer,\n contentType: string\n ): { fields: Record<string, string>; files: Record<string, any> } {\n // Shared implementation - the native engine server parses uploads with\n // the exact same code so both transports agree on body/files shape\n return parseMultipartBuffer(buffer, contentType, this.multipartLimits);\n }\n\n private parseUrlEncoded(body: string): Record<string, string> {\n const params = new URLSearchParams(body);\n const result: Record<string, string> = {};\n for (const [key, value] of params) {\n result[key] = value;\n }\n return result;\n }\n\n // Legacy methods for backward compatibility - the hot path now parses query\n // strings lazily via the MoroIncomingMessage#query getter (no pooling: a fresh\n // object literal is cheaper than pool bookkeeping)\n private parseQueryString(queryString: string): Record<string, string> {\n return parseQueryString(queryString);\n }\n\n private parseQueryStringPooled(queryString: string): Record<string, string> {\n return parseQueryString(queryString);\n }\n\n // Advanced route optimization: cache + static routes + segment grouping\n private routeCache = new Map<string, RouteEntry | null>();\n private staticRoutes = new Map<string, RouteEntry>();\n private dynamicRoutes: RouteEntry[] = [];\n private routesBySegmentCount = new Map<number, RouteEntry[]>();\n private pathNormalizationCache = new Map<string, string>();\n\n // CPU cache-friendly optimizations\n private routeHitCount = new Map<string, number>(); // Track route popularity for cache optimization\n private static readonly HOT_ROUTE_THRESHOLD = 100; // Routes accessed 100+ times get hot path treatment\n\n private findRoute(method: string, path: string): RouteEntry | null {\n // Skip normalization and hit tracking for cached routes\n const cacheKey = `${method}:${path}`;\n\n // Check cache first (hot path optimization) - BEFORE any other work\n if (this.routeCache.has(cacheKey)) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n return this.routeCache.get(cacheKey)!;\n }\n\n // Normalize path for consistent matching (only if not cached)\n const normalizedPath = this.normalizePath(path);\n const normalizedCacheKey = normalizedPath !== path ? `${method}:${normalizedPath}` : cacheKey;\n\n // Check cache again with normalized path\n if (normalizedPath !== path && this.routeCache.has(normalizedCacheKey)) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n return this.routeCache.get(normalizedCacheKey)!;\n }\n\n // O(1) static route lookup\n const staticRoute = this.staticRoutes.get(normalizedCacheKey);\n if (staticRoute) {\n this.routeCache.set(normalizedCacheKey, staticRoute);\n if (normalizedPath !== path) {\n this.routeCache.set(cacheKey, staticRoute);\n }\n return staticRoute;\n }\n\n // Dynamic route matching by segment count\n let route: RouteEntry | null = null;\n const dynamicRoutesLen = this.dynamicRoutes.length;\n if (dynamicRoutesLen > 0) {\n // Use shared utility for DRY principle\n const segmentCount = PathMatcher.countSegments(normalizedPath);\n\n const candidateRoutes = this.routesBySegmentCount.get(segmentCount) || this.dynamicRoutes;\n const candidateLen = candidateRoutes.length;\n\n // Only test routes with matching method and segment count\n for (let i = 0; i < candidateLen; i++) {\n const candidateRoute = candidateRoutes[i];\n if (candidateRoute === undefined) continue;\n if (candidateRoute.method === method && candidateRoute.pattern.test(normalizedPath)) {\n route = candidateRoute;\n break;\n }\n }\n }\n\n // Cache result (limit cache size to prevent memory leaks)\n if (this.routeCache.size < 500) {\n this.routeCache.set(normalizedCacheKey, route);\n if (normalizedPath !== path) {\n this.routeCache.set(cacheKey, route);\n }\n }\n\n return route;\n }\n\n // Middleware execution with Express-compatible error propagation.\n // Supports: 3-arg (req, res, next), 4-arg (err, req, res, next) error middlewares,\n // and next(err) to skip forward to the next error middleware.\n //\n // Sync-aware dispatch: middleware that calls next() synchronously (or throws\n // synchronously) advances the chain in a plain loop with ZERO promise\n // allocations. A promise is only created when a middleware actually completes\n // asynchronously. Returns undefined when the whole chain ran synchronously.\n private executeMiddleware(\n middleware: Middleware[],\n req: HttpRequest,\n res: HttpResponse\n ): void | Promise<void> {\n return this.dispatchMiddleware(middleware, req, res, 0, undefined);\n }\n\n private dispatchMiddleware(\n middleware: Middleware[],\n req: HttpRequest,\n res: HttpResponse,\n startIndex: number,\n initialError: any\n ): void | Promise<void> {\n const len = middleware.length;\n let activeError: any = initialError;\n let i = startIndex;\n\n while (i < len) {\n if (res.headersSent) return;\n\n const mw = middleware[i] as any;\n i++;\n const isErrorHandler = mw.length >= 4;\n\n // Non-error middleware is skipped while an error is active; error middleware\n // is skipped while no error is active. Matches Express semantics.\n if (activeError !== undefined && !isErrorHandler) continue;\n if (activeError === undefined && isErrorHandler) continue;\n\n let settled = false;\n let settledError: any = undefined;\n let asyncResolve: ((err: any) => void) | undefined;\n\n const next = (err?: any) => {\n if (settled) return;\n settled = true;\n settledError = err;\n if (asyncResolve) asyncResolve(err);\n };\n\n let result: any;\n try {\n result = isErrorHandler ? mw(activeError, req, res, next) : mw(req, res, next);\n } catch (err) {\n if (!settled) {\n settled = true;\n settledError = err;\n }\n }\n\n const isThenable = result && typeof result.then === 'function';\n\n if (settled) {\n // Completed synchronously (next() called sync, or threw sync).\n // Matches the old behavior: a still-pending returned promise no longer\n // gates the chain once next() has been called; swallow late rejections.\n if (isThenable) {\n (result as Promise<void>).then(undefined, () => {});\n }\n activeError = settledError;\n continue;\n }\n\n if (!isThenable) {\n // Sync-looking middleware that neither called next() nor returned a\n // promise: it will call next() later (e.g. from an event callback).\n // Fall back to a promise for the remainder of the chain.\n const resumeIndex = i;\n return new Promise<any>(resolve => {\n asyncResolve = resolve;\n }).then(err => this.dispatchMiddleware(middleware, req, res, resumeIndex, err));\n }\n\n // Async middleware: completion is next() OR promise settle, whichever\n // happens first (same semantics as the previous implementation).\n const resumeIndex = i;\n return new Promise<any>(resolve => {\n asyncResolve = resolve;\n (result as Promise<void>).then(\n () => {\n if (!settled) next();\n },\n (err: any) => {\n if (!settled) next(err);\n }\n );\n }).then(err => this.dispatchMiddleware(middleware, req, res, resumeIndex, err));\n }\n\n // If an error is still unhandled after the chain, re-throw so the top-level\n // catch in handleRequest can invoke the registered errorHandler / default 500.\n if (activeError !== undefined) {\n throw activeError;\n }\n }\n\n listen(port: number, callback?: () => void): void;\n listen(port: number, host: string, callback?: () => void): void;\n listen(port: number, host?: string | (() => void), callback?: () => void): void {\n // Handle overloaded parameters (port, callback) or (port, host, callback)\n if (typeof host === 'function') {\n callback = host;\n host = undefined;\n }\n\n const backlog = this.listenBacklog;\n if (host && backlog) {\n this.server.listen(port, host, backlog, callback);\n } else if (host) {\n this.server.listen(port, host, callback);\n } else {\n this.server.listen(port, callback);\n }\n }\n\n close(): Promise<void> {\n return new Promise(resolve => {\n this.server.close(() => resolve());\n });\n }\n\n // Public method to force cleanup\n forceCleanup(): void {\n this.forceCleanupPools();\n }\n\n /**\n * Replace the TLS certificate/key for new handshakes (node's\n * tls.Server#setSecureContext). Throws when the server is plain HTTP.\n */\n updateSsl(ssl: {\n key: string | Buffer;\n cert: string | Buffer;\n ca?: Array<string | Buffer>;\n passphrase?: string;\n minVersion?: string;\n requestCert?: boolean;\n rejectUnauthorized?: boolean;\n }): void {\n const server = this.server as any;\n if (typeof server.setSecureContext !== 'function') {\n throw new Error('updateSsl: this server was not started with TLS (server.ssl)');\n }\n server.setSecureContext(ssl);\n }\n\n getServer(): Server {\n return this.server;\n }\n\n // Performance statistics\n getPerformanceStats() {\n const poolStats = this.poolManager.getStats();\n return {\n paramObjectPoolSize: poolStats.paramPool.poolSize,\n queryObjectPoolSize: poolStats.queryPool.poolSize,\n headerObjectPoolSize: poolStats.headerPool.poolSize,\n poolManager: poolStats,\n };\n }\n}\n"]}