2019-06-19 A Simple Text Client

OK, this one goes together with the Simple Text Server I wrote about yesterday. The server is basically a weird Gopher/Finger server that can only serve text files. It doesn’t know anything about Gopher menus, of FTP commands, or directory listings. Everything else would be part of the client.

As @solderpunk said, one vision could be this:

  1. All connections are TLS secured
  2. Requests are a UTF-8 encoded selector and a CLRF, nothing more
  3. Responses are guaranteed UTF-8 encoded text
  4. No further structure of response is guaranteed
  5. Clients should be able to extract any URLs from anywhere in the text and construct a menu, with interface of their own choosing.

In my particular case, Nimi Mute (the server I wrote) sadly doesn’t qualify:

  1. TLS is optional. You can run it without encryption.
  2. Requests are not decoded. It’s raw bytes. These encode filenames and since I use UTF-8 encoded filenames, this might work. But it might also not work: remember that Unicode can be in NFC or in NFD, both equivalent encodings but using a different sequence of bytes. See Unicode equivalence for more.
  3. Responses are not guaranteed to be UTF-8 encoded. As I prefer using UTF-8, this usually works. However, yesterday I showed how you can download binary files from the text server. That alone shows you that arbitrary bytes are allowed.
  4. No further structure of response is guaranteed. This I support, haha!
  5. Clients should be able to extract any URLs from anywhere in the text and construct a menu, with interface of their own choosing. And that brings us to the topic of today: I need a proof-of-concept client.

My main problem is that I want a better Gopher client for my iOS phone. Since I have no idea how to write a native application, and since I don’t want to develop on my Mac, that leaves me with a web app. I can’t write a client-side web app because they all run in the browser sandbox which doesn’t have access to TCP sockets. All you have is web sockets. They are not compatible. For a while I tried to use Fennel, compile it to Lua, and use Fengari to host it. Then I thought about WebPerl, which is a Perl compiled with Emscripten to WebAssembly. But it’s all the same: no escaping from the sandbox.

So I decided to write a server-side client: Soweli Lukin. Here’s a link to yesterday’s blog post using it: check it out. Visit it using your browser. The browser access the web app I wrote, passes it a Gopher URL, which it fetches from my Gopher server, and renders as Markdown, with some additional translation. It works!

You can follow Gopher links to external sources: if they are links to text files, these URLs are accessed via Soweli Lukin. Everything else is up to your browser.

Ideally, this would be a native app on my phone, or a command line program on my laptop. But as it is, this was the simplest proof of concept I could think of.



Please make sure you contribute only your own work, or work licensed under the GNU Free Documentation License. Note: in order to facilitate peer review and fight vandalism, we will store your IP number for a number of days. See Privacy Policy for more information. See Info for text formatting rules. You can edit the comment page if you need to fix typos. You can subscribe to new comments by email without leaving a comment.

To save this page you must answer this question:

Please say HELLO.