SSL_PENDING(3SSL)
π SSL_PENDING(3SSL) β the OpenSSL girlies' guide to "is there anything to read??" π
okay bestie, sit down, we're talking about SSL_pending and SSL_has_pending from the OpenSSL manual, section 3SSL. it's giving "peeking into the mailbox before you commit to opening it" energy and honestly? iconic. π¦
β¨ NAME β¨
SSL_pending, SSL_has_pending β check for readable bytes buffered in an SSL object
like literally just: "hey, is there data waiting for me in here or not" π
πΈ SYNOPSIS πΈ
#include <openssl/ssl.h>
int SSL_pending(const SSL *ssl);
int SSL_has_pending(const SSL *s);
bestie notice how one takes ssl and one takes s, that's not a typo, that's just how the header is, do not @ me π
π DESCRIPTION π
okay so here's the tea β. Data does NOT arrive in cute little drips. It arrives in whole blocks called records from the peer. And the way that OpenSSL handles it is: a whole record gets processed (like, decrypted, bestie) in one go, and then it just sits there buffered by OpenSSL 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. that's it. that's the number. π₯
now. here's where it gets spicy π«£. If the SSL object's read_ahead flag is set (see SSL_CTX_set_read_ahead(3)), then additional protocol bytes β beyond the current record β may have been read, and those could contain more TLS/SSL records. this also applies to DTLS and pipelining (see SSL_CTX_set_split_send_fragment(3)). These additional bytes will be buffered by OpenSSL but will remain unprocessed until they are needed.
and because they're still in an unprocessed state, SSL_pending() will literally ignore them. rude, but fair. so, real talk: it is possible for no more bytes to be readable from the underlying BIO (because OpenSSL has already read them) and for SSL_pending() to return 0, even though readable application data bytes are available (because the data is in unprocessed buffered records). so a 0 is not always the whole story, bestie, remember that π
SSL_has_pending() returns 1 if s has buffered data (whether processed or unprocessed) and 0 otherwise. note that it is 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, when processed, yielded no application data (for example this can happen during renegotiation). and it's also possible in this scenario for SSL_has_pending() to continue to return 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). yes she's still saying "there's stuff!" and yes the stuff is not edible yet. vibe check: failed. π
π 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, iykyk π
β HISTORY β
The SSL_has_pending() function was added in OpenSSL 1.1.0. so she's a relatively recent queen π
π 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>.
k that's the whole page, bestie, you ate it up π β this was OpenSSL version 4.0.3, dated 2026-09-29, filed under SSL_PENDING(3SSL). now go forth and check those buffered bytes. periodt. π
β¨
π¦ where this page comes from
- ubuntu stonking: libssl-doc 4.0.3-1ubuntu1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms