Az

Playing Around With Gopher

Released in 1991, Gopher was a protocol designed for retrieving documents over the internet and a direct competitor/predecessor to the World Wide Web. The system of hierarchical menus and documents made it excellent for information organisation and allowed digital libraries and interconnected directories, bridging gaps between research campuses. It’s simple protocol was also well suited to text-only output devices, but the rise of graphical user interfaces probably assisted in it’s slow demise compared with the lurid layout and formatting capabilities of HTML.

Having recently purchased a new Raspberry Pi I wanted to start experimenting with some retro technologies and this included setting up a Gopher server. You can now reach it inside my network at gopher://192.168.1.7:70/ but it’s also available via HTTP thanks to the server I’m using (PyGopherd) supporting converting Gopher to HTTP on the fly depending on what type of request it sees.

Installation and setup was pretty simple, really just sudo apt-get install pygopherd and let it roll with the default settings. The gopher root is at /var/gopher (compared to the /var/www used by most web server installs) and the default index file is gophermap.

Designing the directory files is probably the most complex part, you want to organise links like so:

0A Text File /text.txt
1Another Directory  / gopher.quux.org 70
IA Picture! /image.jpg

The structure is a bit weird, but it’s organised like so:

[Item Type][Descriptive Text]TAB[Path]TAB[Domain - optional]TAB[Port - optional]

Notice there is no space between the item type and it’s description. The description, path, and domain also cannot contain any tab characters.

Common item types:

  • 0 - text file
  • 1 - directory page
  • 3 - error
  • 7 - full text search (not handled by PyGopherd, needs third party integration)
  • 9 - binary file
  • I - image
  • g - GIF file

All of these are pretty self-explanatory except #7 which I still need to work out how to integrate sometime. But that’s a task for another day, much like porting this current blog so I can have a Gopher version of it running simultaneously.