The Gopher system was released in mid-1991 by Mark P. McCahill, Farhad Anklesaria, Paul Lindner, Daniel Torrey, and Bob Alberti of the University of Minnesota in the United States. Its central goals were, as stated in RFC 1436:
A file-like hierarchical arrangement that would be familiar to users. A simple syntax. A system that can be created quickly and inexpensively. Extensibility of the file system metaphor; allowing addition of searches for example.
Gopher combines document hierarchies with collections of services, including WAIS, the Archie and Veronica search engines, and gateways to other information systems such as File Transfer Protocol (FTP) and Usenet.
In February 1993, the University of Minnesota announced that it would charge licensing fees for the use of its implementation of the Gopher server. Users became concerned that fees might also be charged for independent implementations. This in part was responsible for its decline.
With the HTTP protocol a simple request might look like GET /customer/123 HTTP/1.1.
Which means GET the resource /customer/123 using HTTP 1.1
The equivalent request in Gopher would be just /customer/123
Gopher then returns a series of text lines. The first character of the line indicates it's type.
For example iWelcome To Gopher is an information line containing the text Welcome To Gopher.
As shown above, the HTTP and Gopher protocols are different, so it is not possible to use your language's existing HttpClients to connect to a Gopher server.
Instead, you will need to connect at a socket level. Unlike HTTP which typically uses port 80 (or 443), Gopher normally uses port 70.
Below shows some example code written in nodejs.
let s = require('net').Socket();
const host = 'gopher.floodgap.com';
const port = 70;
s.connect(port, host);
const selector = ''
s.write(selector);
s.on('data', function(d){
console.log(d.toString());
});
s.end();Here we connect to 'gopher.floodgap.com' on port 70 and then send an empty selector. This means return the root page.
If your language does not have easy access to sockets, you could try shelling out to curl, or binding to curlib.
Retrieve the default page from gopher.floodgap.com (or any other Gopher server of your choice) and render all the text lines to the screen.
These are the lines which start with a lowercase i. After the initial 'i' the lines consist of three tab separated elements.
You only need to display the first one.
Lines starting with a 1 are links to other gopher pages. These are tab separated lines.
The first element is the link text, the second is the selector, and the third is the host.
Display the link text on the screen and allow the user to navigate to other pages.
Lines starting with a 0 are links to text files. These have the same 3 element format as the submenus from task 2. Display the link text on the screen and allow the user to display a text file.
Lines starting with a 7 are links to search engines. The search terms need to follow a '?' (i.e. selector?searchTerm)
For example: /search?files
Now you have a choice
- Find other interesting servers on the internet
- Implement the other item types. Such as 'I' the ability to download images
- Try implementing your own server.