logo

drewdevault.com

[mirror] blog and personal website of Drew DeVault git clone https://hacktivis.me/git/mirror/drewdevault.com.git

What-is-Gemini-anyway.md (7651B)


  1. ---
  2. title: What is this Gemini thing anyway, and why am I excited about it?
  3. date: 2020-11-01
  4. outputs: [html, gemtext]
  5. ---
  6. I've been writing about some specific topics in the realm of Gemini on my blog
  7. over the past two months or so, but I still haven't written a broader
  8. introduction to Gemini, what I'm doing with it, and why you should be excited
  9. about it, too. Let's do that today!
  10. [Gemini](https://gemini.circumlunar.space/) is a network protocol for exchanging
  11. hypertext documents — "hypertext" in the general sense of the word, not
  12. with respect to the hypertext markup language (HTML) that web browsers
  13. understand. It's a simple network protocol which allows clients to request
  14. hypertext documents (in its own document format, gemtext). It is, in some
  15. respects, an evolution of [Gopher][Gopher], but more modernized and streamlined.
  16. [Gopher]: https://en.wikipedia.org/wiki/Gopher_(protocol)
  17. Gemini is very simple. The protocol uses TLS to establish an encrypted
  18. connection (using self-signed certificates and
  19. <abbr title="trust on first use">TOFU</abbr> rather than certificate
  20. authorities), and performs a very simple exchange: the client sends the URL it
  21. wants to retrieve, terminated with CRLF. The server responds with an
  22. informative line, consisting of a numeric status code and some additional
  23. information (such as the document's mimetype), then writes the document and
  24. closes the connection. Authentication, if desired, is done with client
  25. certificates. User input, if desired, is done with a response code which conveys
  26. a prompt string and a request for user input, followed by a second request with
  27. the user's response filled into the URL's query string. And that's pretty much
  28. it!
  29. ```
  30. $ openssl s_client -quiet -crlf \
  31. -servername drewdevault.com \
  32. -connect drewdevault.com:1965 \
  33. | awk '{ print "response: " $0 }'
  34. gemini://drewdevault.com
  35. response: 20 text/gemini
  36. response: ```ASCII art of a rocket next to "Drew DeVault" in a stylized font
  37. response: /\
  38. response: || ________ ________ ____ ____ .__ __
  39. response: || \______ \_______ ______ _ __ \______ \ ___\ \ / /____ __ __| |_/ |_
  40. response: /||\ | | \_ __ \_/ __ \ \/ \/ / | | \_/ __ \ Y /\__ \ | | \ |\ __\
  41. response: /:||:\ | ` \ | \/\ ___/\ / | ` \ ___/\ / / __ \| | / |_| |
  42. response: |:||:| /_______ /__| \___ >\/\_/ /_______ /\___ >\___/ (____ /____/|____/__|
  43. response: |/||\| \/ \/ \/ \/ \/
  44. response: **
  45. response: **
  46. response: ```
  47. [...]
  48. ```
  49. So why am I excited about it?
  50. My disdain for web browsers is well documented[^1]. Web browsers are
  51. *extraordinarily* complex, and any attempt to build a new one would be a
  52. Sisyphean task. Successfully completing that implementation, if even possible,
  53. would necessarily produce a Lovecraftian mess: unmaintainable, full of security
  54. vulnerabilities, with gigabytes in RAM use and hours in compile times. And given
  55. that all of the contemporary web browsers that implement a sufficiently useful
  56. subset of web standards are ass and getting assier, what should we do?
  57. [^1]: [Exhibit A](https://drewdevault.com/2020/08/13/Web-browsers-need-to-stop.html), [Exhibit B](https://drewdevault.com/2020/03/18/Reckless-limitless-scope.html), [Exhibit C](https://cmpwn.com/@sir/104894723861368333)
  58. The problem is unsolvable. We cannot have the "web" without all of these
  59. problems. But what we can have is something different, like Gemini. Gemini does
  60. not solve all of the web's problems, but it addresses a subset of its use-cases
  61. better than the web does, and that excites me. I want to discard the parts of
  62. the web that Gemini does better, and explore other solutions for anything that's
  63. left of the web which is worth keeping (hint: much of it is not).
  64. There are some aspects of Gemini which I approve of immensely:
  65. - It's dead simple. A client or server implementation can be written from
  66. scratch by a single person in the space of an afternoon or two. A new web
  67. browser could take hundreds of engineers millions of hours to complete.
  68. - It's not extensible. Gemini is designed to be *difficult* to extend without
  69. breaking backwards compatibility, and almost all proposals for expansion on
  70. the mailing list are ultimately shot down. This is a good thing: extensibility
  71. is generally a bad idea. Extensions ultimately lead to more complexity and
  72. Gemini might suffer the same fate as the web if not for its disdain for
  73. extensions.
  74. - It's opinionated about document formatting. There are no inline links (every
  75. link goes on its own line), no formatting, and no inline images. Gemini
  76. strictly separates the responsibility of content and presentation. Providing
  77. the content is the exclusive role of the server, and providing the
  78. presentation is the exclusive role of the client. There are no stylesheets and
  79. authors have very little say in *how* their content is presented. It's still
  80. possible for authors to express themselves within these constraints &mdash;
  81. as with any other constraints &mdash; but it allows clients to be simpler and
  82. act more as *user* agents than *vendor* agents.
  83. Some people argue that what we should have is "the web, but less of it", i.e. a
  84. "sane" subset of web standards. I don't agree (for one, I don't think there *is*
  85. a "sane" subset of those standards), but I'll save that for another blog post.
  86. Gemini is a new medium, and it's different from the web. Anyone who checking it
  87. out should be prepared for that and open to working within its constraints.
  88. Limitations breed creativity!
  89. For my part, I have been working on a number of Gemini projects. For one, this
  90. blog is now available [on Gemini](gemini://drewdevault.com), and I have started
  91. writing some Gemini-exclusive content for it. I've also written some software
  92. you're welcome to use:
  93. [**libgmni**](https://sr.ht/~sircmpwn/gmni),
  94. [**gmni**](https://sr.ht/~sircmpwn/gmni),
  95. and [**gmnlm**](https://sr.ht/~sircmpwn/gmni) are my suite of Gemini client
  96. software, all written in C11 and only depending on a POSIX-like system and
  97. OpenSSL. libgmni is a general-purpose Gemini client library with [a simple
  98. interface](https://git.sr.ht/~sircmpwn/gmni/tree/master/include/gmni). gmni is a
  99. cURL-like [command line tool](https://drewdevault.com/gmni.1.html) for
  100. performing Gemini requests. Finally, gmnlm is a line-mode browser with a rich
  101. feature-set. Together these tools weigh just under 4,000 lines of code, of which
  102. about 1,600 are the URL parser from cURL vendored in.
  103. [**gmnisrv**](https://portal.drewdevault.com/gmnisrv.gmi) is a high-performance
  104. Gemini server, also written in C11 for POSIX systems with OpenSSL. It supports
  105. zero-configuration TLS, CGI scripting, auto-indexing, regex routing and URL
  106. rewrites, and I have a couple more things planned for 1.0. It clocks in at about
  107. 6,700 lines, of which the same 1,600 are vendored from cURL, and an additional
  108. 2,800 lines are vendored from Fabrice Bellard's
  109. [quickjs](https://bellard.org/quickjs/) regex implementation.
  110. [**kineto**](https://portal.drewdevault.com/kineto.gmi) is an HTTP-to-Gemini
  111. gateway, implemented as a single Go file (under 500 lines) with the assistance
  112. of ~adnano's [go-gemini](https://sr.ht/~adnano/go-gemini/) library. My Gemini
  113. blog [is available through this portal](https://portal.drewdevault.com) if you
  114. would like to browse it.
  115. So dive in and explore! Install gmnisrv on your server and set up a Gemini space
  116. for yourself. Read the feeds from
  117. [CAPCOM](gemini://gemini.circumlunar.space/capcom/). Write some software of your
  118. own!