@push.rocks/smartproxy
Version:
A powerful proxy package with unified route-based configuration for high traffic management. Features include SSL/TLS support, flexible routing patterns, WebSocket handling, advanced security options, and automatic ACME certificate management.
59 lines (58 loc) • 1.59 kB
TypeScript
/**
* HTTP Protocol Parser
* Generic HTTP parsing utilities
*/
import { type THttpMethod } from './constants.js';
import type { IHttpRequestLine, IHttpHeader } from './types.js';
/**
* HTTP parser utilities
*/
export declare class HttpParser {
/**
* Check if string is a valid HTTP method
*/
static isHttpMethod(str: string): str is THttpMethod;
/**
* Parse HTTP request line
*/
static parseRequestLine(line: string): IHttpRequestLine | null;
/**
* Parse HTTP header line
*/
static parseHeaderLine(line: string): IHttpHeader | null;
/**
* Parse HTTP headers from lines
*/
static parseHeaders(lines: string[]): Record<string, string>;
/**
* Extract domain from Host header value
*/
static extractDomainFromHost(hostHeader: string): string;
/**
* Validate domain name
*/
static isValidDomain(domain: string): boolean;
/**
* Extract line from buffer
*/
static extractLine(buffer: Buffer, offset?: number): {
line: string;
nextOffset: number;
} | null;
/**
* Check if buffer contains printable ASCII
*/
static isPrintableAscii(buffer: Buffer, length?: number): boolean;
/**
* Quick check if buffer starts with HTTP method
*/
static quickCheck(buffer: Buffer): boolean;
/**
* Parse query string
*/
static parseQueryString(queryString: string): Record<string, string>;
/**
* Build query string from params
*/
static buildQueryString(params: Record<string, string>): string;
}