-- Leo's gemini proxy

-- Connecting to sunshinegardens.org:1965...

-- Connected

-- Sending request

-- Meta line: 20 text/gemini; lang=en

bencoding


Bencoding is a way to specify and organize data in a terse format. It supports the following types: byte strings, integers, lists, and dictionaries.


byte strings


Byte strings are encoded as follows: `<string length encoded in base ten ASCII>:<string data>`.


> NOTE: there is no constant beginning delimiter, and no ending delimiter.


4:spam = "spam"
0: = ""

integers


Integers are encoded as follows: `i<integer encoded in base ten ASCII>e`


The initial `i` and trailing `e` are beginning and ending delimiters.


i3e = 3
i-3e = -3

`i-0e` is invalid. All encodings with a leading zero, such as `i03e`, are invalid, other than `i0e`, which of course corresponds to the integer `"0"`.


> NOTE: The maximum number of bit of this integer is unspecified, but to handle it as a signed 64bit integer is mandatory to handle "large files" aka .torrent for more that 4Gbyte.


lists


Lists are encoded as follows: `l<bencoded values>e`.


The initial `l` and trailing `e` are beginning and ending delimiters. Lists may contain any bencoded type, including integers, strings, dictionaries, and even lists within other lists.


l4:spam4:eggse = "spam"‿"eggs"
le = ⟨⟩

dictionaries


Dictionaries are encoded as follows: `d<bencoded string><bencoded element>e`


The initial `d` and trailing `e` are the beginning and ending delimiters.


> NOTE: the keys must be bencoded strings. The values may be any bencoded type, including integers, strings, lists, and other dictionaries. Keys must be strings and appear in sorted order (sorted as raw strings, not alphanumerics). The strings should be compared using a binary comparison, not a culture-specific "natural" comparison.


d3:cow3:moo4:spam4:eggse =  { "cow": "moo", "spam": "eggs" }
d4:spaml1:a1:bee = { "spam": [ "a", "b" ] }
de = {}

-- Response ended

-- Page fetched on Fri May 17 12:10:40 2024