Skip to main content

Extensible Gemini/Titan server

Project description

GmCapsule is an extensible server for Gemini and Titan.

See the User manual for configuration and usage instructions.


Install "gmcapsule" via pip:

pip install gmcapsule

Then run the server daemon:


Running via systemd

Create the following service file and save it as ~/.config/systemd/user/gmcapsule.service:

Description=GmCapsule: extensible Gemini/Titan server

ExecReload=/bin/kill -HUP $MAINPID


Replace <YOUR-INSTALL-PATH> with the actual path of gmcapsuled. pip will install it in a directory on your PATH.

Then you can do the usual:

systemctl --user daemon-reload
systemctl --user enable gmcapsule
systemctl --user start gmcapsule

The log can be viewed via journalctl (or syslog):

journalctl -xe --user-unit=gmcapsule

Change log


  • Added stream to the [cgi.*] section to enable streaming output mode where the output of the CGI child process is immediately sent to the client without any buffering. Streaming is not supported if the server is using multiple processes.
  • Markdown: Fixed handling of alt text in preformatted blocks (patch by Mike Cifelli).


  • Added processes to the [server] section to configure how many request handler processes are started.
  • Extension modules can register new protocols in addition to the built-in Gemini and Titan.
  • SIGHUP causes the configuration file to be reloaded and workers to be restarted. The listening socket remains open, so the socket and TLS parameters cannot be changed.
  • API change: Extension modules get initialized separately in each worker thread. Instead of a Capsule, the extension module init method is passed a Context. Capsule is no longer available as global state.
  • API change: Identity no longer contains OpenSSL objects for the certificate and public key. Instead, they are provided as serialized in DER format.


  • Identity class is available when importing the gmcapsule module.


  • Fixed error in the "rewrite" module (Codeberg PR #1).


  • Enable address reuse on the server socket for unimpeded restarting (Codeberg PR #3).


  • Added built-in module "rewrite" that matches regular expressions against the request path and can rewrite the path or return a custom status for redirection, "Gone" messages, or other exceptional situations.
  • Extension module load order is determined after locating all modules from all directories. Previously, the order was local to each directory.
  • Added a new configuration section [priority] for overriding default module priorities determined from file names. This is useful for changing the priority of the built-in modules.


  • Rewrite: Request query string can be included in a status using the ${QUERY_STRING} variable.


  • Added a shutdown event for custom background workers.
  • Request.query is None if there is no query string present. Previously, the query string was an empty string in this case. This allows making a distinction between empty and absent query strings.


  • CGI: Fixed handling of a missing query string.


  • GitView: Fixed processing of Git commit history when a message contains backslashes.


  • Added [cgi] bin_root configuration option for automatically and dynamically mapping all executables in a directory tree to URL entry points.
  • Minor documentation updates.
  • Published on PyPi as "gmcapsule".


  • Fixed error handling. Exceptions are now caught and the error message is printed.


  • Reduced required Python version to 3.6 (f-strings).
  • Added systemd instructions.


  • Requests exceeding 1024 bytes should result in an error code and not just be ignored.
  • Respond with an error code to malformed UTF-8 in the request.
  • Verify that the port number in the request URI matches the server's port.


  • Fixed an error in the Markdown parser.


  • Fixed handling of exceptions from request handler, and print a traceback.
  • Fixed importlib error with Python 3.11.


  • Initial public release.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gmcapsule-0.6.1.tar.gz (28.8 kB view hashes)

Uploaded Source

Built Distribution

gmcapsule-0.6.1-py3-none-any.whl (32.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page