Skip to main content

Module gemini

Module gemini 

Source
Expand description

Gemini server (gemini://, TLS, port 1965) — the model writes the capsule.

One connection carries one exchange: TLS handshake, one request line (an absolute URL and CRLF), one response header, a body only after a 2x, then close_notify and close. That shape decides the whole loop:

  1. NetGet refuses what is not a request before the model sees it. A URL over 1024 bytes, a relative or malformed one, a BOM, userinfo or a fragment get 59; another scheme gets 53 (this server is not a proxy). No model call is spent on any of them.
  2. Every response closes the connection, so there is no idle phase: the two deadlines are the handshake and the request line, and both wrap reads only — a request parked for a human under a manual rule is not closed by either.
  3. The model cannot write a header. Its actions are rendered by wire; the loop sends the first rendered response and nothing after it.
  4. Failure is a status, never silence. Backend overload → 41 (the spec’s “server unavailable due to overload”), any other backend failure → 40 (the generic temporary failure), a model that produced no response → 40. Meta texts are fixed literals.

Re-exports§

pub use wire::MAX_REQUEST_BYTES;
pub use wire::MAX_URL_BYTES;

Modules§

actions
Gemini protocol actions: what the model is told, and how its answers become responses.
wire
Gemini wire format: request validation, the response header, and gemtext rendering.

Structs§

Deadlines
The two read deadlines, resolved from startup parameters.
GeminiServer