đŸ’Ÿ Archived View for tilde.pink â€ș ~ssb22 â€ș gopher.gmi captured on 2021-12-03 at 14:04:38. Gemini links have been rewritten to link to archived content

View Raw

More Information

âžĄïž Next capture (2023-01-29)

-=-=-=-=-=-=-

Gopher protocol considered inferior

As a partially-sighted computer scientist, I’m sometimes asked for an opinion on little-known technologies that might seem to make things easier for blind or partially-sighted people. Gopher was an early-1990s alternative to the then-emerging World Wide Web, and some enthusiasts think it must be better because it is text-based. Although Gopher can deliver graphics and other files, it’s usually used for plain-text files and separate lists of links. But there are problems:

1. Gopher is less likely to properly display non-English languages that are not written in ASCII;

2. Gopher pages seem more likely to use “ASCII art”, which confuses screen readers and cannot even be skipped like HTML images can;

3. Gopher pages are typically not designed to be reflowed to less than 70 columns for giant-print and small-device situations, nor to be displayed in a proportional font (the size-changing versions of my low-vision stylesheets tell Firefox’s “OverbiteFF” Gopher plug-in to use a proportional font, which helps on many Gopher pages but does break some).

After I wrote the above, some Gopher enthusiasts developed a new protocol called Gemini which largely addresses these things. Gemini is UTF-8 compatible and wraps text to the window width. It can also set language tags to help speech synthesisers select the correct pronunciation, although all languages used on the page are listed in the protocol header rather than in the markup, so the synthesiser still has to work out where the use of each language begins and ends (unless they start using Unicode 3.1’s deprecated U+E0001 ‘language tag’ for this). Gemini’s ‘preformatted’ regions can still contain ASCII art, but clients like Ariane/Seren can collapse these regions by default. 

Enthusiasts of the *original* Gopher protocol sometimes point to its being more ‘lightweight’ than Gemini and the Web’s HTTP, because Gopher is “headerless” whereas Gemini carries uncompressed TLS overhead and HTTP adds headers to each transaction. The rest of this page discusses Gopher’s claim of being lightweight. 

HTTP headers actually save traffic

It may be surprising that adding *more* headers can *save* traffic, but it can. Consider, HTTP/1.0 and HTTP/1.1 has:

So the actual traffic-saving advantage of headerless protocols exists only for a *one-off* access to a *single* and *very small* file. 

Headerless responses do not require Gopher

If you do need one-off access to a single very small file and would genuinely benefit from a headerless response, this can also be obtained using:

1. the original “HTTP/0.9”, which pre-dates Gopher and costs just 4 extra bytes—less if Gopher’s oft-omitted terminating full-stop line is counted against it

2. Dedicated TCP ports that return small responses, like daytime (port 13) and qotd (port 17), often run from inetd or similar. These can require *no request at all*, which means:

If you’re typing into a Telnet client by hand on a mobile phone that charges you for every byte, then it’s likely that each keystroke will end up in a separate TCP packet (not to mention the echo), in which case you’d probably be better off either using an off-the-shelf HTTP browser to send the request all at once, or else using a custom port that doesn’t require a request at all (if you don’t mind the information also being available to anyone who runs a port probe, and you don’t need to make *too* many different types of information available in this way). 

Example custom inetd entries for small responses

A “what is my IP address?” service on port 2 (the Python script has to be written without spaces if you want to inline it into /etc/inetd.conf):

2 stream tcp nowait nobody /usr/bin/python2 python2 -c i=__import__;a=i('sys');b=i('socket');s=b.fromfd(a.stdin.fileno(),b.AF_INET,b.SOCK_STREAM);s.sendall(s.getpeername()[0]+'\n')

Report uptime and system load on port 3:

3 stream tcp nowait nobody /usr/bin/uptime uptime

Serve a small text file on port 4:

4 stream tcp nowait nobody /bin/cat cat /weather.txt

Conclusion

I won’t go into silly nationalistic squabbles about the Web being invented by a Brit working in Europe whereas Gopher was American—if anyone feels tempted to use Gopher’s general inability to display non-English languages as an anti-American joke, please remember that quite a few Americans were involved in designing Unicode and other multilingual standards, so they’re not *all* ignorant. There are also potential political points about Gopher having had stricter licensing in its early years, but America isn’t the only place with plenty of lawyers and they did *eventually* GPL it. But it does seem that the Gopher protocol would fall on technical points alone, and that its enthusiasts would be better off promoting low-bandwidth and “text-friendly” websites, or perhaps using Gemini if they want the thrill of building something simpler than the Web.

Legal

All material © Silas S. Brown unless otherwise stated. Firefox is a registered trademark of The Mozilla Foundation. Python is a trademark of the Python Software Foundation. Unicode is a registered trademark of Unicode, Inc. in the United States and other countries. Any other trademarks I mentioned without realising are trademarks of their respective holders.