💾 Archived View for rawtext.club › ~sloum › geminilist › 002364.gmi captured on 2020-09-24 at 03:10:15. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2020-09-24)

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

<-- back to the mailing list

Reopening: Stream status code

Philip Linde linde.philip at gmail.com

Fri Jul 31 12:18:58 BST 2020

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

On Fri, 31 Jul 2020 07:01:10 -0400Paul Boyd <boyd.paul2 at gmail.com> wrote:

Please don't. That would complicate generated responses. The server would
have to hold the response until the whole thing was rendered just to count
the number of bytes. It's a lot simpler to write the data as it's ready,
which also avoids (potentially large) temporary memory allocations.

That is true. There are approaches to dynamically generated responsesthat avoid the need for preallocation, but they are indeed quitecomplex compared to having e.g. a CGI script simply dump some data onits standard output.

Usually, when I need to determine a buffer size in advance, I implementa "dry run" of whatever fills the buffer that instead of writinganything simply tallies up the number of bytes that *would* be writtenand run that to determine the size of the buffer before a "real" run. Asimilar approach can be used to determine content length for CGIscripts.

It's a good point nonetheless.

--Philip-------------- next part --------------A non-text attachment was scrubbed...Name: not availableType: application/pgp-signatureSize: 488 bytesDesc: not availableURL: <https://lists.orbitalfox.eu/archives/gemini/attachments/20200731/7856c218/attachment.sig>