LC19 - A UCSPI gemini server LC19 is a gemini server application following the UCSPI model (http://cr.yp.to/proto/ucspi.txt). LC19 therefore does not handle TCP connections and TLS encryption. These should be handled by the UCSPI tool. LC19 simply takes a request on stdin and prints the response to stdout. LC19 can serve static data from a directory. It has a defined root data directory which contains one subdirectory for every domain that is served by the server. Each domain directory contains one directory named by the port the data is served on. The file system hierarchy below a port's directory is addressable by the path of the URL. LC19 does not serve hidden files or files located in hidden directories. The only exception are paths starting with /.well-known/. For now only serving of static files is supported. MIME TYPES The MIME type of a served file is determined by: 1. A .mime file. If for a resource a/b a file a/.b.mime exists, the first line of the file is used as the resources MIME type. 2. The MIME type database. The requested resource's filename extension is used to determine the file's MIME type. 3. The .gmi and .gemini filename extension. If the served resource has the filename extension .gmi or .gemini, the MIME type "text/gemini" is used. The parameters of a MIME type can be modified via .mimeparam files. A single file specifies the parameters for a single MIME type. The name has the form .MIMETYPE.mimeparam, where MIMETYPE is the name of the MIME type, but with all characters that are not alphanumeric, '.', '+' or '-' replaced by '.'. Each line of a .mimeparam file must define one MIME parameter. When a resource is served, every directory in the resource's file system path is searched for a .mimeparam file, going from the bottom directory in the hierarchy to the root directory. Every parameter defined in a .mimeparam file of the resource's MIME type that does not already exist in the resource's MIME type, is append to the resource's MIME type. REDIRECTS Redirects are defined via redirect files. For a path /a/b a redirect file a/.b.redirect may exist. If it does, lc19 responds with a redirect, using the first line of the file as path the user is being redirected to. If the file starts with "p ", ie. the letter p followed by a whitespace, a permanent redirect (status code 31) is used instead of a temporary redirect. DIRECTORY INDEXES If a path pointing to a directory is requested, LC19 may serve some arbitrary file or it may serve a directory listing. If a .index file is present, a directory listing is served. If the .index file is a symbolic link, the file referenced by the link is served. Installation ------------ You can build LC19 by running make or install it by running make install The following variables can be overwritten by setting the proper -D options in CFLAGS. - DATA_DIR Defaults to "/var/gemini". This is the root directory which contains the data of the gemini capsules served by the server. This can also be set at runtime via --data-dir. - FILE_CHUNK_SIZE Defaults to "4096" (4KB). The maximum number of bytes LC19 reads from a file, before writing the data to stdout. - MIMEDB_FILE Defaults to "/etc/mime.types". The path to the MIME type database file. The default installation location is $(DESTDIR)$(PREFIX)/bin and PREFIX defaults to /usr. Runtime options --------------- - --data-dir Set the root directory of the gemini capsule's content served by the server. - --loglevel Set the loglevel of the process. All log output is written to stderr. Available levels are: - error: Only log errors lc19 encounters. These are possibly errors in your data directory setup. This is the default. - info: Log informational stuff like all incoming requests. - debug: The most verbose loglevel. License ------- This software is licensed under GPL-3.0-or-later. See COPYING.