Support for PARTIAL_FLUSH in Deflater
Martin Buchholz
martinrb at google.com
Tue Mar 9 02:37:52 UTC 2010
Hi FlaterMouses,
We added support for various "flush modes" to Deflater,
but we did not include support for PARTIAL_FLUSH.
Because not even zlib.h is enthusiastic about PARTIAL_FLUSH:
#define Z_PARTIAL_FLUSH 1 /* will be removed, use Z_SYNC_FLUSH instead */
But it sure looks like Z_PARTIAL_FLUSH will never actually be removed.
It's been a few years, and PARTIAL_FLUSH is actively used by SSH
implementations, as vaguely specified in RFC 4253.
Costin argued for PARTIAL_FLUSH elsewhere:
"""
The jzlib library was written exactly for this reason - it was not possible to
implement SSL using deflater, and with this change it still isn't possible.
The following compression methods are currently defined:
none REQUIRED no compression
zlib OPTIONAL ZLIB (LZ77) compression
The "zlib" compression is described in [RFC1950] and in [RFC1951].
The compression context is initialized after each key exchange, and
is passed from one packet to the next, with only a partial flush
being performed at the end of each packet. A partial flush means
that the current compressed block is ended and all data will be
output. If the current block is not a stored block, one or more
empty blocks are added after the current block to ensure that there
are at least 8 bits, counting from the start of the end-of-block code
of the current block to the end of the packet payload.
So anyone implementing SSH with compression will have to use introspection or
alternate compression library.
"""
Since adding the missing support seems easier than arguing about it,
I suggest we Just Do It.
Martin
More information about the core-libs-dev
mailing list