[1] Gopher Protocol
Developed in 1991 by a team at University of Minnesota, the gopher protocol is a TCP/IP document distribution system that was popular before the world wide web became the standard protocol. It is primarily devoted to serving plain text documents organized into a hierarchical directory structure and lacks formatting, dynamic content, and even the mixing of media and text. While the protocol may not have style sheets, it certainly has style.
The Protocol
The simplicity of the gopher protocol is evident from the mere fifteen pages of RFC 1436 — the Network Working Group’s 1993 document on implementing gopher servers and clients. For comparison, FTP’s RFC 765 is 68 pages, and HTTP/1.1 is represented by the 176-page 2616. A reader with even a cursory understanding of TCP/IP can learn the core of gopher over a cup of coffee.
Learning the complete internals is better suited to the RFC and is left as
an exercise to the reader, but we’ll go ahead and write a couple of one-line
scripts that handle the majority of the available interactions. All that you
need to know is that the default port is ‘70
’.
Script 1: Ask a gopher server to list its contents
First, the client opens a connection to the server, for the example: sdf.org on
port 70 Then, the client sends ‘CLRF’ to the server to request a directory
listing. ‘CLRF’ refers to “Carriage Return Line Feed”, but on most systems will
be handled by the simple newline character: ‘\n
’. To do this, use the
netcat
utility which is a command line program for establishing raw network
connections. This very powerful tool can be used for exploring remote hosts and
even listening as a server itself.
echo "\n" | netcat sdf.org 70
Assuming the host is online, your terminal should now contain a list of directories, as pictured in Figure 1 (below). It might not be the most beautiful output, but is certainly readable.
The numbers preceding each items refer to the type of item that it is. ‘1’ lets the client know that “SDF Member PHLOGOSPHERE” is a subdirectory, while ‘7’ marks “GopherSpace SEARCH Engine” as a gopher search server query.1
The string after the item’s name, such as “/sdf/faq/
” is the “magic
string” (actual RFC terminology) that directs the client to that particular
item.
Finally, the output contains a line whose sole character is a period. This line indicates that the server has listed everything and will then close the connection.
Script 2: Navigate to a particular item on the server
Now that we know, via the client, what is available at the root tier of the hierarchical structure, the client can dig deeper into the gopher hole.
echo "/sdf/faq/\n" | netcat sdf.org 70
Assuming all went well, you get a response similar to the one listed in Figure 2 (below).
With these two simple commands at your disposal, you can freely traverse the gopherspace! All of these are further subdirectories, but once you hit an item whose identifier is ‘0’, you will have finally arrived at a plain text file.
The Clients
I used this rudimentary network socket approach to demonstrate how trivial it is to communicate with a gopher server, but a variety of robust clients exists. As the text pages are pure streams of information without style sheets and dynamic behaviors, the content of a gopher site is particularly suited to terminal browsing; the classic terminal browser lynx has supported gopher natively since 1992. Alternatively, plugins are available for Firefox and most other mainstream browsers.2
Before continuing with the rest of the document, please take a moment to acquire a client and wander about the gopher sites. The most extensive portal to the gophers that I am aware of is over at Floodgap’s server.3 Be sure and check out the link to GopherVR. Having had a taste of the protocol’s simple pre-http delights, no doubt you are eager to set up your own home in the gopherspace. You have a couple options: either find a place in the city (existing server such as sdf.org) or try to make it out on your own in the country (run your own server).
The Servers
There are advantages to each. By setting up your own fresh gopher server, gopher’s web presence become further decentralized; it it not ideal to have everything crammed into a single point of failure. However, home-brew servers have a tendency to not last. Fresh holes may find themselves quickly buried when running a 24/7 instance doesn’t go as planned. On the other hand, by starting a site on sdf (or elsewhere), you help to strengthen the existing, but small, gopher community. Your content will be much more easily found and more likely to remain online.
Personally, I think the best approach is this: if you already run a server of some sort, then go ahead and add gopher. But if you just want to get content online, simply register on sdf, or wherever else you choose. That said, writing a gopher server is a great project for learning network programming: you learn how to work with client-server communications, read and implement specifications, and can have a complete product within a fairly short time. For writing the server in C, you may find Beej’s Guide to Network Programming a very helpful reference.4
Figures
!!!! EDITORS NOTE !!!! The following figures were too broad for the 80 character limit, so I have split those lines. Lines indented by three spaces belong to the end of their preceding line. –barnet
Figure 1: Response of the Gopher server ⤴
iWelcome to the SDF Public Access UNIX System .. est. 1987\t\tnull.host\t1 i\t\tnull.host\t1
iWe offer FREE and inexpensive memberships for people interested\t\tnull.host\t1
iin the UNIX system and internetworking. Personal GOPHERSPACE\t\tnull.host\t1
iis available to all users as well as hundreds of UNIX utilities,\t\tnull.host\t1
igames and networking utilities. We are a federally recognized\t\tnull.host\t1
inon-profit 501(c)7 organization and we are supported entirely\t\tnull.host\t1
iby donations and membership dues. telnet://sdf.org\t\tnull.host\t1
i\t\tnull.host\t1
1SDF Member PHLOGOSPHERE (151 directories)\t/phlogs/\tsdf.org\t70
1SDF Member GOPHERSPACE (2334 directories)\t/maps/\tsdf.org\t70
1SDF Frequently Asked Questions (FAQ)\t/sdf/faq/\tsdf.org\t70
1SDF Accredited University Courses\t/sdf/classes/\tsdf.org\t70
1Software and Documentation for various computers\t/computers\tsdf.org\t70
7GopherSpace SEARCH Engine\t/v2/vs\tgopher.floodgap.com\t70
1Floodgap’s GOPHERSPACE\t/\tgopher.floodgap.com\t70
1NetBSD Distribution Mirror\t/NetBSD/\tsdf.org\t70
i______________________________________________________________________\t\tnull
.host\t1
i Gophered by Gophernicus/1.5 on NetBSD/amd64 6.1_STABLE\t\tnull.
host\t1
.
Figure 2: Response of the Gopher server ⤴
1BASICS SDF History and UNIX Basics - START HERE\t/sdf/faq/BASICS\tsdf.org\t70
1CHAT Questions about IRC, ICQ and such.\t/sdf/faq/CHAT\tsdf.org\t70
1DIALUP SDF’s TENEX National Dialup PPP Membership\t/sdf/faq/DIALUP\tsdf.org\t
70
1EMAIL Questions about INTERNETWORKED EMAIL.\t/sdf/faq/EMAIL\tsdf.org\t70
1GAMES Single and Multiuser GAMES.\t/sdf/faq/GAMES\tsdf.org\t70
1GOPHER Gopherspace questions and answers.\t/sdf/faq/GOPHER\tsdf.org\t70
1MDNS Dynamic DNS with mdns.org \t/sdf/faq/MDNS\tsdf.org\t70
1MEMBERS SDF Membership Information and Responsibilities\t/sdf/faq/MEMBERS\tsdf
.org\t70
1MISC Miscellaneous, Odd and Very Interesting Questions \t/sdf/faq/MISC\tsd
f.org\t70
1MOTD Coding, Journals, Forums and Galleries for UNIX Hackers\t/sdf/faq/MOTD
\tsdf.org\t70
1MYSQL SDF’s MySQL database server\t/sdf/faq/MYSQL\tsdf.org\t70
1TEACH Using SDF to teach UNIX and NET concepts.\t/sdf/faq/TEACH\tsdf.org\t70
1TECHIES Advanced UNIX Topics, UUCP and programming.\t/sdf/faq/TECHIES\tsdf.org
\t70
1TWENEX SDF’s Project TENEX Free Software Community\t/sdf/faq/TWENEX\tsdf.org\
t70
1UNIX Questions about UNIX Shells.\t/sdf/faq/UNIX\tsdf.org\t70
1USENET Newsgroup Questions and News READERS\t/sdf/faq/USENET\tsdf.org\t70
1VHOST Virtual Hosting and Domain Name Service.\t/sdf/faq/VHOST\tsdf.org\t70
1WEB Webserver questions and answers.\t/sdf/faq/WEB\tsdf.org\t70
i______________________________________________________________________\t\tnull
.host\t1
i Gophered by Gophernicus/1.5 on NetBSD/amd64 6.1_STABLE\t\tnull.
host\t1
.
-
https://en.wikipedia.org/wiki/Veronica_(search_engine) ↩︎
-
gopher://gopher.floodgap.com/ ↩︎