💾 Archived View for gem.benscraft.info › gemcaps › gsgi.gmi captured on 2021-12-17 at 13:26:06. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2021-11-30)
-=-=-=-=-=-=-
The gsgi is a custom gateway interface that I have designed to act as a way to reverse proxy gemini servers.
The protocol is still not final, and I know that there are several problems with it. Because of this, I do not recommend building software for it until it becomes more stable.
Gsgi servers will be initialized as separate processes to the parent server. This allows for easier compatibility with server software.
Information about the parent server will be passed through environment variables, such as:
Because gsgi servers run as separate processes from the parent server, transfer of requests and responses will be done through pipes.
The pipes that are used to communicate are given to the child process. The pipe file descriptors can be found from the environment variables:
It may be argued that transferring transaction information over pipes is insecure. I don't know much of the security for pipes and other processes on a machine, but I believe that it should not be a problem as this communcation is all within the server machine. If there are possibilities of unwanted software spying on server transactions from within the server machine; There are bigger problems on your hands.
To allow for multiple transactions to be processed concurrently, each request will be given a unique id. When the child responds, it will supply the same id to let the parent know who to send the response to. These responses are allowed to be out of order, so it is very important that all responses ids match their request ids.
The gemini protocol does not support metadata, but there is data that the server needs to know that is sent with a tls connection, such as the client certificate. After the id is sent, the metadata for the connection is sent.
Metadata will be formatted in the same way http metadata is sent:
name: value
The valid metadata options are as follows:
A request will look something like this:
id: 1 ip: 123.456.7.89 request: gemini://my.capsule/foo/bar
The end of a request is makred by two consequetive newlines.
Because data is sent through a pipe that will never be closed, the size of the body must be sent as well as the id.
id: 1 code: 20 meta: text/gemini length: 13 hello world!
To prevent piping errors, all data after the length of the body will be read until two consequetive newlines are read.