SSL_PENDING(3ossl)
π SSL_PENDING π
okay so this is the SSL_PENDING(3ossl) page from the OpenSSL manual, bestie β it's all about SSL_pending and SSL_has_pending, aka the "is there anything to read in here rn??" girlies. let's get into it π
β¨ NAME β¨
SSL_pending, SSL_has_pending β check for readable bytes buffered in an SSL object. that's it. that's the whole vibe check. π
πΈ SYNOPSIS πΈ
#include <openssl/ssl.h>
int SSL_pending(const SSL *ssl);
int SSL_has_pending(const SSL *s);
look at them. two little int-returning icons. π
π¦ DESCRIPTION π¦
so here's the tea, and it's honestly kind of important: data gets received in whole blocks called records from the peer. a whole record gets processed (decrypted, like, actually handled) in one go, and then OpenSSL buffers it until your application actually reads it via a call to SSL_read_ex(3) or SSL_read(3). no cap. π«Ά
SSL_pending() returns the number of bytes which have been processed, buffered, and are available inside ssl for immediate read. processed = ready. simple as that. β¨
now, if the SSL object's read_ahead flag is set (peep SSL_CTX_set_read_ahead(3)), then additional protocol bytes β like, bytes beyond the current record β may have been read, containing more TLS/SSL records. and this also applies to DTLS and pipelining (see SSL_CTX_set_split_send_fragment(3), iykyk). these additional bytes will be buffered by OpenSSL but they stay unprocessed until they're actually needed. π΄
and because those bytes are still in an unprocessed state, SSL_pending() will straight up ignore them. so here's the chaotic consequence, and it's giving main character energy tbh: it's possible for no more bytes to be readable from the underlying BIO (because OpenSSL already read them, greedy little thing) and for SSL_pending() to return 0 β even though readable application data bytes are available, because the data is sitting in unprocessed buffered records. the audacity. π
SSL_has_pending() returns 1 if s has buffered data (whether processed or unprocessed) and 0 otherwise. note that it's possible for SSL_has_pending() to return 1, and then a subsequent call to SSL_read_ex() or SSL_read() to return no data β because the unprocessed buffered data, once processed, yielded no application data (for example, this can happen during renegotiation π).
it's also possible in this scenario for SSL_has_pending() to keep returning 1 even after an SSL_read_ex() or SSL_read() call, because the buffered and unprocessed data is not yet processable (e.g. because OpenSSL has only received a partial record so far). partial record = no thoughts, head empty, still pending. π
π§ RETURN VALUES π§
SSL_pending()β returns the number of buffered and processed application data bytes that are pending and are available for immediate read. πSSL_has_pending()β returns1if there is buffered record data in the SSL object, and0otherwise. π
π SEE ALSO π
SSL_read_ex(3), SSL_read(3), SSL_CTX_set_read_ahead(3), SSL_CTX_set_split_send_fragment(3), ssl(7)
go read those too, they're literally the friends of this page. π«Ά
β HISTORY β
the SSL_has_pending() function was added in OpenSSL 1.1.0. a legend was born. π
π COPYRIGHT π
Copyright 2000-2020 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>.
bestie please actually read the license, it's not optional, it's giving legally binding π
okay that's the whole page, mwah! this was 3.5.6, dated 2026-04-07, and it's SSL_PENDING(3ossl) signing off π¦πβ¨
π¦ where this page comes from
- freebsd 15.1: base 15.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms