mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-09-14 19:02:17 +03:00
The wreq-js TLS-fingerprint transport resolved the Response as soon as upstream headers arrived, with zero guard around how long the caller then waited for the body's first byte. TlsClient's only timing control, a flat timeout, defaults to 600_000ms, matching the reported 90-600s stall window exactly. Add guardTlsFirstByte() (open-sse/utils/tlsFirstByteWatchdog.ts), which races the body's first read() against a short, env-overridable watchdog (TLS_FIRST_BYTE_WATCHDOG_MS, default 10s). A healthy body is unaffected (bytes already buffered are replayed through a passthrough stream); a stalled body cancels the wreq reader and throws, letting proxyFetch's existing TLS-fallback catch blocks fall through to the direct/proxy dispatcher. A non-replay-safe request (e.g. a POST with a body) still throws instead of being silently retried, reusing isTlsFallbackReplaySafe.