DeterministicESPAsyncWebServer v6.27.1
Zero-allocation, bounded-execution async HTTP server for ESP32
Loading...
Searching...
No Matches
ssh_zlib.cpp File Reference

SSH server-to-client context-takeover DEFLATE - implementation. More...

Go to the source code of this file.

Detailed Description

SSH server-to-client context-takeover DEFLATE - implementation.

A fixed-Huffman (BTYPE=01) greedy-LZ77 compressor, like presentation/deflate, but STREAMING: it keeps a persistent sliding window across packets (context takeover) and wraps the output as a zlib stream (RFC 1950 header once) with a Z_SYNC_FLUSH boundary per packet. Because a new packet's matches may reach back into prior packets' bytes, each call runs LZ77 over [history || input] but only EMITS tokens for the input; the history is inserted into the hash chains first (search only, no output). Hash chains are rebuilt each call over the (possibly slid) history, so a window slide needs no chain relocation. Bits are packed LSB-first; Huffman codes are stored bit-reversed so writing them LSB-first puts them on the wire MSB-first (RFC 1951 sec 3.1.1).

The one architectural difference from the WebSocket compressor: it KEEPS the 00 00 ff ff sync marker on the wire (SSH sends it; permessage-deflate strips it) and prepends the 2-byte zlib header on the first packet. (The LZ77+Huffman core is deliberately a sibling of presentation/ deflate rather than a shared instance - the stateful vs stateless split is fundamental; unifying the two behind one parameterized streaming codec is a follow-up for the core review.)

Definition in file ssh_zlib.cpp.