[spec] ☿️ gemini — a minimalist gemini protocol

1. Petite Abeille (petite.abeille (a) gmail.com)

All details are similar to gemini itself, ? some minor adjustments.

????????????

??://??

By default, a ?? gemini service runs over plain TCP, at port 1961.

A ?? gemini:// request is one-line ?4,096 bytes long at most, UTF-8 
encoded? containing a fully qualified, normalized Internationalized 
Resource Identifier (IRI):

gemini://host.xyz:1961/

An IRI is an UTF-8 version of an Uniform Resource Identifier (URI). 
An URI can be either an Uniform Resource Locator (URL), or Uniform Resource Name (URN).

????????????

An example of a ?? gemini request, followed by a ?? text/gemini response:

# echo -e 'gemini://gemini.xyz:1961/\r\n' | nc 127.0.0.1 1961
20 text/gemini;charset=utf-8;
Hello ?? Gemini!

=> gemini://host.xyz:1961/license CC0-1.0 
<end of connection> 

A successful ?? gemini response is a one-line with status 20?optionally 
followed by a content type, plus associated attributes, such as encoding:  

20 text/gemini;charset=utf-8;

The content type is optional ? defaulting to ?? text/gemini, UTF-8 encoded.

The content itself follow the  20 status line ? terminated by the service 
dropping the network connection.

????????????

There are 3 status codes:

20 SUCCESS ? one-line, with optional content type, plus attributes, 4,096 
bytes long at most, UTF-8 encoded
20 text/gemini;charset=utf-8;

30 REDIRECT ? one-line IRI, fully qualified, and normalized, 4,096 bytes 
long at most, UTF-8 encoded
30 gemini://host.xyz:1961/

40 ERROR ? one-line, 4,096 bytes long at most, UTF-8 encoded, with optional description 
40 ??????

????????????

A ?? text/gemini consists of two line types: text, and link. 

A link is denoted as one-line, starting with the arrow symbol (=>), 
followed by a space, followed by a fully qualified, and normalized IRI ? 
optionally followed by a space separated description:

=> gemini://host.xyz/license CC0-1.0

All other lines are regular text lines.

????????????

That's all folks.

?0?

Link to individual message.

---

Previous Thread: [spec] gemini capabilities

Next Thread: ☿️ gemini — esthetics