# The Mud Client Compression Protocol - Specification

The protocol used by mcclient is based on 'telnet' option negotiation. See RFCs 854 and 855 for an overview of the mechanism used.

Compression is currently unidirectional - only output from the mud server is compressed. This simplifies the implementation, and also avoids potential problems with hostile clients sending data intended to cause problems (via crashing or excessive memory/cpu use) with the decompressor. The compressor is entirely controlled by the server. While attacks on the client are potentially possible, this seems less of a problem as the client is not a shared resource.

To indicate it supports compression, the server sends an `IAC WILL COMPRESS` sequence. The `COMPRESS` option (unofficial and completely arbitary) is option 85.

The client, if it wishes to enable compression, responds with `IAC DO COMPRESS`.

The server, once `IAC DO COMPRESS` is received, may then turn on compression. Since the start point of the compression stream needs to be known, the server prefixes the start of the stream with a suboption negotiation packet - `IAC SB COMPRESS WILL SE`. Immediately following this, a zlib stream (as defined in RFC 1950 - see also the zlib home page) begins.

Compression can only be terminated by the server - a normal end to the compression stream is assumed to mean "revert to uncompressed mode". It may be desirable for the server to automatically terminate compression when an `IAC DONT COMPRESS` sequence is received from the client.

Any decompression errors are unrecoverable, and should result in a disconnection. Given that TCP is a reliable transport mechanism, bug-free implementations should never encounter compression errors, so this should not affect normal operation. When an error _is_ encountered, something has gone badly wrong, and it seems hard to recover. Allowing raw (uncompressed) telnet negotiation to reset compression is one possibility, but requires escaping of all compressed data sent.

Feel free to contact me with any questions about the protocol.

[Mail me] [Up]