mu*index
reading
plain text
theme

protocol

MCCP

Stream compression. Cheap, widely deployed, and the protocol that produced the most instructive bug in this project's history.

https://www.mudhalla.net/tintin/protocols/mccp/

Measured adoption

216 of 886 listed games — 24.4%

The games not counted here are not games without the protocol. A game is counted when we observed its server offering the option in a handshake; the rest are servers that did not offer it to us and servers whose handshake we have not read, and we cannot tell you which.

Games observed offering MCCP in a handshake, by the codebase we identified them as running.
codebase offered it identified
CoffeeMUD 31 32
FluffOS 24 28
ROM 13 55
Evennia 11 11
DikuMUD 8 35
CircleMUD 4 47
MUCK 3 24
SMAUG 2 20
AresMUSH 0 18
CobraMUSH 0 2
PennMUSH 0 34
RhostMUSH 0 40
tbaMUD 0 5
TinyMUSH 0 9

MCCP compresses the server-to-client stream with zlib. Version 1 is telnet option 85 and is effectively historical; version 2 is option 86 and is what modern servers negotiate. After the server sends IAC SB MCCP2 IAC SE, every byte that follows is part of one continuous zlib stream.

It is a real saving on a text protocol — MUD output compresses extremely well — and it is common in the Diku and LP families, where roughly a third of the codebases we surveyed negotiate it.

The failure mode, and why it matters here

A client that negotiates MCCP2 and then does not inflate the stream receives binary garbage from the compression marker onward. Not an error, not a disconnection: the connect screen arrives as a wall of replacement characters, and everything after it — the WHO reply, any later MSSP, the whole session — is lost.

This is not hypothetical. Our own telnet library did exactly that. It negotiated the option, fired its "compression enabled" callback, and never inflated a byte. The payload decompressed cleanly with a stock zlib call, which is what made it unambiguous that the servers were correct and we were not. Thirteen of the thirty-eight codebases in our survey were affected, and for the duration we could not observe what those servers negotiated after compression started — so our record of their capabilities understated them.

It was fixed upstream. A follow-on defect — the inflater being re-created per read rather than kept for the connection, which fails partway through a large connect screen — is filed and open, and affects the tail of the largest screens.

Two things a reader should take from this. A protocol figure on this page is a measurement of our crawler as much as of the hobby, and where we know it has been wrong we say so. And if you are writing a client: negotiating MCCP is easy and inflating it correctly is where the work is.

See also

  • ROM Merc's best-known descendant, and the combat engine a large share of nineties MUDs were built on.
  • DikuMUD The root of the combat-MUD family. Levels, classes, equipment and area files — and a licence that shaped a generation of derivatives.
  • GMCP The Generic Mud Communication Protocol — structured JSON messages alongside the text, and the out-of-band channel most modern clients build against.