In this first episode, we implement the transport layer of a gopher server.
If you have no idea how to download a torrent, just check transmission.
If you live in a dystopian world and cannot use BitTorrent, you can check out this episode on youtube.
The configuration is explicitly passed a bit everywhere in this episode. We could have prevented that by enclosing the whole server in a monad transformer stack containing a reader monad in which we would have stored our configuration. I decided not doing that as I thought it could be unnecessarily confusing.
I was wrong about the gopher response termination sequence: it’s not \r\n.\r\n but \r\n. . We’ve been lucky: lynx is able to ignore the last unnecessary crlf.
We probably should catch the asynchronous exceptions in the listening thread: we don’t want the server to crash altogether when a client screw things up.
See you next week :)