Plaintext Protocols

Jun 18, 2022

HTTP is a plaintext protocol. Sending an HTTP request is as simple as writing

GET / HTTP/1.1
Host: matt-rickard.com

If you want to see for yourself, you can run this command on the command line to send the raw HTTP request and see the result.

echo -en 'GET / HTTP/1.1\r\nHost: matt-rickard.com\r\n\r\n' | openssl s_client -ign_eof -connect matt-rickard.com:443

The response is plaintext as well

HTTP/1.1 200 OK
Connection: keep-alive
Content-Length: 20729
Content-Type: text/html; charset=utf-8

...

Plaintext protocols are

  • Simple to implement
  • Human readable
  • Easy to debug

Simple works best even for applications at planet scale (powering the internet). Why do Protocols Win? Even our most machine-oriented systems still have a human element to them. There's no guarantee that HTTP would have beat out other protocols if it were designed with full efficiency over practicality on day one.

Sure, binary formats are more efficient and transfer less data over the network. For example, HTTP/2 and the proposal for HTTP/3 are binary protocols. But performance enhancements don't come without complexity and new issues. And those improvements come decades after learning the optimizations needed for the simple plain text protocol.

Subscribe for daily posts on startups & engineering.