BIO_F_READBUFFER(3SSL)

πŸ’– BIO_F_READBUFFER(3SSL) β€” the read-only buffering BIO that finally gets BIO_tell() and BIO_seek() ✨

okay bestie, welcome to the OpenSSL manual, BIO_f_readbuffer edition πŸŽ€ this one lives in the OpenSSL family and it's lowkey a hero, so let's get into it.


🌸 NAME 🌸

BIO_f_readbuffer β€” a read only buffering BIO that supports BIO_tell() and BIO_seek() πŸ‘‘

like. it's a BIO that buffers. it reads. and it gives you BIO_tell() and BIO_seek() when the thing underneath refuses to. iconic behavior tbh πŸ’…


✨ SYNOPSIS ✨

#include <openssl/bio.h>

const BIO_METHOD *BIO_f_readbuffer(void);

πŸ¦‹ DESCRIPTION πŸ¦‹

BIO_f_readbuffer() hands you back the read buffering BIO method. that's the whole vibe. πŸ’–

this BIO filter can be inserted on top of BIO's that do not support BIO_tell() or BIO_seek() β€” for example, a file BIO that uses stdin. so when your BIO is out here with no tell and no seek, you just layer this queen on top and suddenly, functionality. main character energy fr fr.

data read from a read buffering BIO comes from an internal buffer, and that internal buffer gets filled from the next BIO in the chain. so: BIO feeds buffer, buffer feeds you. πŸ“

BIO_gets() is supported for read buffering BIOs. yay! πŸ™Œ

writing data to a read buffering BIO is not supported. it's read only, bestie, that's the whole point. don't try to write to it. it will not be the moment you think it is. πŸ’€

calling BIO_reset() on a read buffering BIO does not clear any buffered data. so like. the buffer stays. it does not forget. πŸ™ˆ


πŸ‘‘ NOTES πŸ‘‘

Read buffering BIOs implement BIO_read_ex() by using BIO_read_ex() operations on the next BIO (e.g. a file BIO) in the chain, and storing the result in an internal buffer, from which bytes are given back to the caller as appropriate for the call.

BIO_read_ex() is guaranteed to give the caller the number of bytes it asks for, unless there's an error or end of communication is reached in the next BIO. πŸ’―

the internal buffer can grow to cache the entire contents of the next BIO in the chain. yes, the whole thing. it's growing. let it. 🌈

BIO_seek() uses the internal buffer, so that it can only seek into data that is already read. so it can go backwards through what's been buffered β€” but not forward into stuff it hasn't touched yet. iykyk. 🧚


πŸ’œ RETURN VALUES πŸ’œ

BIO_f_readbuffer() returns the read buffering BIO method. that's it, that's the return value, slay. ⭐


πŸŽ€ SEE ALSO πŸŽ€


Copyright 2021 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at <https://www.openssl.org/source/license.html>.


no cap, that's the entire page. go forth and buffer. 🫢

and that's a wrap bestie β€” this was OpenSSL version 4.0.3, dated 2026-09-29, and the manual page's name is BIO_F_READBUFFER(3SSL). periodt. πŸ’…βœ¨

πŸ“¦ where this page comes from