{"canonical_url":"https://engineer.company/glossary/gopher/","content_markdown":"# Gopher\n\n## What it is\n\nGopher is a protocol for fetching documents and menus over the internet, in which a client opens a\nTCP connection, sends one line naming what it wants, reads the answer and is done. It is formally\nthe Internet Gopher protocol, its addresses begin with `gopher://`, and a site published over it\nis usually called a gopher hole. It dates from 1991, and RFC 1436 described it in March 1993.\n\nThe exchange is short enough to type by hand. The client connects to port 70, sends a selector (a\nstring the server handed out earlier, possibly empty) followed by a carriage return and line feed,\nand the server answers and closes the connection. Nothing is remembered between requests: no\nsession, no cookie, no headers. An empty selector asks for the server's top menu.\n\nA menu is the heart of it. Each line of a menu is one item, made of a single type character, a\ndisplay string, then a selector, a host and a port separated by tabs. A line holding only a full\nstop ends the menu. Here is a small one, with each tab written as `\u003cTAB\u003e`:\n\n```text\n0About this server\u003cTAB\u003e/about.txt\u003cTAB\u003eexample.org\u003cTAB\u003e70\n1Reports\u003cTAB\u003e/reports\u003cTAB\u003eexample.org\u003cTAB\u003e70\n7Search the reports\u003cTAB\u003e/search\u003cTAB\u003eexample.org\u003cTAB\u003e70\n.\n```\n\nThe type character tells the client what it will get before it asks. RFC 1436 defines `0` for a\ntext file, `1` for another menu, `7` for a search server, `9` for a binary file, `g` for a GIF\nimage and a handful more. Two types in wide use today come from practice rather than the RFC: `i`\nfor a line of plain text shown inside a menu, and `h` for an HTML document, which clients also\nuse to hand a web address to a browser.\n\nThe design is deliberately small. RFC 1436 has a section headed \"Simplicity is intentional\", and\nit is an Informational RFC, not an Internet standard. The `gopher://` address format came later,\nin RFC 4266, where the first character of the path is the item type and the rest is the selector.\n\n## Why it matters\n\nGopher matters today less as a way to reach a large audience than as a clear picture of what a\ndocument needs and what it can live without. A menu is navigation reduced to its bones: every way\nout of a page is listed, typed and on its own line, with nothing hidden behind a hover or a script.\nPublishing to it forces questions that HTML lets an author postpone. What is this page called? What\nare its real links? Does the text still make sense once the links are taken out of it?\n\nFor an organisation, a gopher hole is an extra front door, never a replacement for the web.\nReaders need a dedicated client, and they are few. The cost of the door depends entirely on how\nit is built. Maintained by hand as a second copy of the site, it drifts the first time one copy\nis edited and the other is forgotten. Generated from the same source by the same build, it costs a\ntemplate and some disk space, and it serves mainly as a stress test of the writing.\n\nThe second thing to understand is security. Gopher has no encryption layer. Every selector, and so\nevery page a reader asks for, crosses the network in clear text, and so does every answer. RFC 1436\nhas nothing for signing in, and the words a reader types into a search item travel in clear text as\nwell. That is acceptable for public documents and wrong for anything else, and it means the\noperator's own logs deserve as much thought as the content.\n\nIt is also cheap to debug. With no TLS, no headers and no state, a single command line shows the\nexact bytes a client receives, which makes a gopher copy one of the easiest outputs of a site to\ncheck.\n\n## What it looks like in practice\n\nThis site is a gopher hole as well as a website. The\n[Engineer in a terminal](/cli/) page gives the address, `gopher://engineer.company/`, describes\nGopher as a menu protocol from 1991 with plain TCP, no encryption and no scripting, and says the\nsite there is a set of menus, one per directory. It names Lynx, Bombadillo and gopher-cli as\nclients and shows a request made by hand with `printf` and `nc` on port 70, the entire protocol in\none line.\n\nThe build behind it is described in\n[the write-up of mirroring the site to Gemini and Gopher](/portfolio/mirrored-the-site-to-gemini-and-gopher/).\nThe same build that writes the HTML also wrote 777 Gopher menus at the recorded implementation\nstage, deployed to the same tree and served by a small daemon on the same host. A menu line is a\nset of tab-separated fields, so there is no way to put a link inside a sentence, and prose is\nhard-wrapped at sixty-eight columns while the site is built. Working within that sharpened the\nwriting.\n\nThe templates show how each page becomes a menu. Inline links keep their words and lose their\ntargets, headings lose their hash marks, bullets become indented asterisks and the prose is wrapped\nat 68 columns. Code is the exception and passes through unwrapped, because a code line broken at\ncolumn 68 is a different program. Categories and services become type `1` items pointing at their\nown menus, and the foot of each page carries an `h` item whose `URL:` selector leads to the web\nversion of the same page.\n\nRunning a gopher hole also taught the site something about logs. The\n[Privacy](/privacy/) page explains that since September 2026 the site counts only how many requests\nthe Gemini and Gopher copies answered each day, with no address, no page and no visitor. The day\ncounting began, it turned out that the operating system starts the Gopher copy afresh for each\nvisitor and names that moment after the address the visitor came from, in a log of its own. That\nlog now expires after thirty days, like everything else the site keeps.\n\n## Where it goes wrong\n\n### A page stops halfway and lists the directory\n\nA reader opens a page and gets the first half of it, then a listing of the files in the folder.\nServers such as Gophernicus read a gophermap before sending it, and a line without tabs whose first\ncharacter is one of their directives is treated as an instruction: `#` hides it as a comment, `=`\nincludes another file, and `*` or `.` stops the menu. This site met it when a line of CSS in its\nUkrainian note about Safari underlines began with the star that closes a CSS comment, and the live\nserver cut the page there and printed index.html, index.md and index.gmi instead. Write every such\nline as an explicit `i` item, and fail the build on any bare line that still begins with a\ndirective character.\n\n### Markup and entities arrive as text\n\nA paragraph shows up as a single very long line full of angle brackets, or with an ampersand still\nspelled out as its HTML entity. The converter copied HTML into a format that has no idea what HTML\nis. Strip tags while keeping the anchor text, decode entities, and leave inline code alone so its\nsymbols survive.\n\n### Lines run off the right edge\n\nProse spills past the screen, or display strings are cut mid-word. Gopher clients are not obliged\nto reflow anything, and RFC 1436 asks for display strings of under 70 characters. Wrap prose during\nthe build, truncate menu labels deliberately, and keep code out of the wrapper.\n\n### A link fetches the wrong thing\n\nA `gopher://` address opens an error or an unrelated item. RFC 4266 reads the first character of\nthe path as the item type, so `gopher://example.org/reports` asks for type `r` and the selector\n`eports`. Put the type in front of the selector, as in `gopher://example.org/1/reports`, and copy\naddresses from a working menu rather than typing them.\n\n### The reading list travels in the clear\n\nEvery page a reader opens is visible to anyone on the network path, and possibly in logs nobody\nmeant to keep. Publish only what would be fine on a postcard, read the logs of the whole machine\nand not just the daemon's, and give each one an expiry.\n\n## Further reading\n\n- [RFC 1436: The Internet Gopher Protocol](https://www.rfc-editor.org/rfc/rfc1436)\n  — the original description: the request and response cycle, menu lines, item types and the\n  reasons for keeping it simple.\n- [RFC 4266: The gopher URI Scheme](https://www.rfc-editor.org/rfc/rfc4266)\n  — how a `gopher://` address encodes host, port, item type and selector.\n- [IANA Service Name and Transport Protocol Port Number Registry](https://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xhtml)\n  — the official record of port 70 as the gopher port.\n- [Gophernicus](https://github.com/gophernicus/gophernicus) — source and documentation of a current\n  Gopher server, including the gophermap format it reads.\n\n\u003chttps://engineer.company/glossary/gopher/\u003e\n","date_modified":"2026-11-08T02:22:23Z","description":"How Gopher serves typed menus over TCP port 70, what RFC 1436 does and does not specify, and what breaks when a modern site is published over it.","formats":{"gemtext":"https://engineer.company/glossary/gopher/index.gmi","gopher":"https://engineer.company/glossary/gopher/gophermap","html":"https://engineer.company/glossary/gopher/","json":"https://engineer.company/glossary/gopher/index.json","markdown":"https://engineer.company/glossary/gopher/index.md","pdf":"https://engineer.company/glossary/gopher/index.pdf"},"kind":"page","language":"en","title":"What is Gopher?","url":"https://engineer.company/glossary/gopher/","version":1}