SSL_CTX_SET_READ_AHEAD(3)
hii bestie π this is the SSL_CTX_SET_READ_AHEAD(3) page from the Library Functions Manual, and itβs all about managing whether to read as many input bytes as possible. no cap, weβre keeping every function and every tiny detail. β¨
πΈ NAME πΈ
SSL_CTX_set_read_ahead,SSL_CTX_get_read_ahead,SSL_set_read_ahead,SSL_get_read_ahead,SSL_CTX_get_default_read_aheadβ manage whether to read as many input bytes as possible π
β¨ SYNOPSIS β¨
library βlibsslβ libcrypto #include <openssl/ssl.h>
void
SSL_CTX_set_read_ahead(SSL_CTX *ctx, int yes);
long
SSL_CTX_get_read_ahead(SSL_CTX *ctx);
void
SSL_set_read_ahead(SSL *s, int yes);
long
SSL_get_read_ahead(const SSL *s);
long
SSL_CTX_get_default_read_ahead(SSL_CTX *ctx);
π¦ DESCRIPTION π¦
okay so SSL_CTX_set_read_ahead() and SSL_set_read_ahead() set whether as many input bytes as possible are read for non-blocking reads. the vibe is: if x bytes are currently required by OpenSSL, but y bytes are available from the underlying BIO (where y > x), then OpenSSL will read all y bytes into its buffer (provided that the buffer is large enough) if reading ahead is on, or x bytes otherwise. the parameter yes should be 0 to ensure reading ahead is off, or non zero otherwise. π«Ά
SSL_CTX_get_read_ahead() and SSL_get_read_ahead() indicate whether reading ahead is set or not. like, theyβre the vibe check π.
the way that SSL_CTX_get_default_read_ahead() is identical to SSL_CTX_get_read_ahead() is sending me π β itβs literally a duplicate. not me being obsessed with that π
.
these functions are implemented as macros. yep, macros. iconic.
these functions have no effect when used with DTLS. that part is important, bestie β no effect with DTLS, periodt. π
π RETURN VALUES π
SSL_CTX_get_read_ahead() and SSL_get_read_ahead() return 0 if reading ahead is off or non-zero otherwise, except that the return values are undefined for DTLS π. so pls donβt go relying on a DTLS return value, because itβs literally undefined.
π SEE ALSO π
π HISTORY π
SSL_set_read_ahead() and SSL_get_read_ahead() appeared in SSLeay 0.4 or earlier and have been available since OpenBSD 2.4. history really said βweβve been here a minuteβ β³.
SSL_CTX_set_read_ahead(), SSL_CTX_get_read_ahead(), and SSL_CTX_get_default_read_ahead() first appeared in OpenSSL 0.9.2b and have been available since OpenBSD 2.6. slay for continuity π«.
β οΈ CAVEATS β οΈ
Switching read ahead on can impact the behaviour of the SSL_pending(3) function. π
thatβs the caveat, bestie β keep it in mind. π«Ά
mwah π thatβs the whole page β this one is from Debian, dated June 8, 2025, and the manual page is SSL_CTX_SET_READ_AHEAD(3). bye bestie π«Ά
π¦ where this page comes from
- alpine 3.24: libressl-doc 4.3.1-r0 Β· custom
- arch rolling: libressl 4.4.0-1 Β· ISC AND custom:OpenSSL
- Copyright (c) 2015, 2016 The OpenSSL Project. All rights reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms