import { type Logger } from '@luminable/logger'; import * as http from 'http'; import * as https from 'https'; import { type Mesh, type ScopeProvider } from 'mesh-ioc'; import { type Socket } from 'net'; import { HttpContext } from './HttpContext.js'; import { type HttpNext } from './types.js'; export interface HttpServerConfig { port: number; address: string; socketTimeout: number; shutdownDelay: number; requestBodyLimitBytes: number; tlsCert?: string; tlsKey?: string; tlsCa?: string; tlsCiphers?: string; } export declare class HttpServer { HTTP_PORT: number; HTTP_ADDRESS: string; HTTP_TIMEOUT: number; HTTP_SHUTDOWN_DELAY: number; HTTP_REQUEST_BODY_LIMIT_BYTES: number; HTTP_TLS_CERT: string; HTTP_TLS_KEY: string; HTTP_TLS_CA: string; HTTP_TLS_CIPHERS: string; protected logger: Logger; protected mesh: Mesh; protected createScope: ScopeProvider; protected config: HttpServerConfig; protected server: http.Server | https.Server | null; protected requestsPerSocket: Map; protected stopping: boolean; constructor(); start(): Promise; stop(): Promise; handle(ctx: HttpContext, next: HttpNext): Promise; getServer(): http.Server | https.Server | null; protected createServer(): http.Server; protected handleRequest(req: http.IncomingMessage, res: http.ServerResponse): Promise; /** * Tracks the number of pending requests per socket, so that the server could close gracefully */ protected onConnection(sock: Socket): void; /** * Tracks requests per connection, close connection during shutdown, when requests are served. */ protected onRequest(req: http.IncomingMessage, res: http.ServerResponse): void; protected getSocketRequests(socket: Socket): number; /** * Gracefully close idle sockets. */ protected closeIdleSockets(): void; /** * Destroy all sockets non-gracefully. */ protected destroyAllSockets(): void; }