Arnt Gulbrandsen
About meAbout this blog

Postel's principle

Be conservative in what you send and liberal in what you accept does not mean what you probably think it does.

Jon Postel was talking about how to interpret RFCs. He was, after all, the RFC editor. When an RFC says that a particular protocol uses text lines with a maximum length of 512 bytes and CRLF as line terminators, you might be forgiven for wondering whether that's 510+2 or 512+2 bytes. In most cases there is some sentence that makes it clear, but that sentence can be easy to overlook.

If you overlook it, or you see it but think other implementers may overlook it, then Postel's Principle applies. In the example above being liberal means accepting 512 bytes plus CRLF, and being conservative means sending 512 including CRLF.

Postel's principle does not mean that you should accept 1024-byte lines or any other thing which the RFC forbids. Jon Postel was the RFC editor, he didn't want you to ignore the RFC's stated line length. His principle is about how to handle the boundary case whenever the boundary is underspecified or misunderstandable.