💾 Archived View for rawtext.club › ~sloum › geminilist › 006238.gmi captured on 2023-12-28 at 16:22:38. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2021-11-30)

-=-=-=-=-=-=-

<-- back to the mailing list

How do you buffer a Gemini connection?

Ecmel Berk Canlıer me at ecmelberk.com

Mon Mar 29 07:41:38 BST 2021

- - - - - - - - - - - - - - - - - - - 

On 3/29/21 9:22 AM, almaember wrote:

One question, what do you do if a single line is split into multiple
chunks?

https://git.ebc.li/_/moonlander/src/branch/main/gemtext/src/lib.rs

The chunked_parse (Line 160) function reads character by character, saving everything into an "incomplete line" buffer (Line 31), and when it encounters a newline it empties and processes the incomplete line buffer and returns the list of "line objects" corresponding to the markup inside the buffer.

When the connection is closed, the finalize function (Line 221) runs and parses the incomplete line buffer one last time to complete the document.