| 1 |
.\" -*- mode: troff; coding: utf-8 -*- |
| 2 |
.\" Automatically generated by Pod::Man 5.0102 (Pod::Simple 3.45) |
| 3 |
.\" |
| 4 |
.\" Standard preamble: |
| 5 |
.\" ======================================================================== |
| 6 |
.de Sp \" Vertical space (when we can't use .PP) |
| 7 |
.if t .sp .5v |
| 8 |
.if n .sp |
| 9 |
.. |
| 10 |
.de Vb \" Begin verbatim text |
| 11 |
.ft CW |
| 12 |
.nf |
| 13 |
.ne \\$1 |
| 14 |
.. |
| 15 |
.de Ve \" End verbatim text |
| 16 |
.ft R |
| 17 |
.fi |
| 18 |
.. |
| 19 |
.\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. |
| 20 |
.ie n \{\ |
| 21 |
. ds C` "" |
| 22 |
. ds C' "" |
| 23 |
'br\} |
| 24 |
.el\{\ |
| 25 |
. ds C` |
| 26 |
. ds C' |
| 27 |
'br\} |
| 28 |
.\" |
| 29 |
.\" Escape single quotes in literal strings from groff's Unicode transform. |
| 30 |
.ie \n(.g .ds Aq \(aq |
| 31 |
.el .ds Aq ' |
| 32 |
.\" |
| 33 |
.\" If the F register is >0, we'll generate index entries on stderr for |
| 34 |
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index |
| 35 |
.\" entries marked with X<> in POD. Of course, you'll have to process the |
| 36 |
.\" output yourself in some meaningful fashion. |
| 37 |
.\" |
| 38 |
.\" Avoid warning from groff about undefined register 'F'. |
| 39 |
.de IX |
| 40 |
.. |
| 41 |
.nr rF 0 |
| 42 |
.if \n(.g .if rF .nr rF 1 |
| 43 |
.if (\n(rF:(\n(.g==0)) \{\ |
| 44 |
. if \nF \{\ |
| 45 |
. de IX |
| 46 |
. tm Index:\\$1\t\\n%\t"\\$2" |
| 47 |
.. |
| 48 |
. if !\nF==2 \{\ |
| 49 |
. nr % 0 |
| 50 |
. nr F 2 |
| 51 |
. \} |
| 52 |
. \} |
| 53 |
.\} |
| 54 |
.rr rF |
| 55 |
.\" ======================================================================== |
| 56 |
.\" |
| 57 |
.IX Title "SSL_CTX_SET_READ_AHEAD 3SSL" |
| 58 |
.TH SSL_CTX_SET_READ_AHEAD 3SSL 2026-04-07 3.6.2 OpenSSL |
| 59 |
.\" For nroff, turn off justification. Always turn off hyphenation; it makes |
| 60 |
.\" way too many mistakes in technical documents. |
| 61 |
.if n .ad l |
| 62 |
.nh |
| 63 |
.SH NAME |
| 64 |
SSL_CTX_set_read_ahead, SSL_CTX_get_read_ahead, |
| 65 |
SSL_set_read_ahead, SSL_get_read_ahead, |
| 66 |
SSL_CTX_get_default_read_ahead |
| 67 |
\&\- manage whether to read as many input bytes as possible |
| 68 |
.SH SYNOPSIS |
| 69 |
.IX Header "SYNOPSIS" |
| 70 |
.Vb 1 |
| 71 |
\& #include <openssl/ssl.h> |
| 72 |
\& |
| 73 |
\& void SSL_set_read_ahead(SSL *s, int yes); |
| 74 |
\& int SSL_get_read_ahead(const SSL *s); |
| 75 |
\& |
| 76 |
\& SSL_CTX_set_read_ahead(SSL_CTX *ctx, int yes); |
| 77 |
\& long SSL_CTX_get_read_ahead(SSL_CTX *ctx); |
| 78 |
\& long SSL_CTX_get_default_read_ahead(SSL_CTX *ctx); |
| 79 |
.Ve |
| 80 |
.SH DESCRIPTION |
| 81 |
.IX Header "DESCRIPTION" |
| 82 |
\&\fBSSL_CTX_set_read_ahead()\fR and \fBSSL_set_read_ahead()\fR set whether we should read as |
| 83 |
many input bytes as possible (for nonblocking reads) or not. For example if |
| 84 |
\&\fBx\fR bytes are currently required by OpenSSL, but \fBy\fR bytes are available from |
| 85 |
the underlying BIO (where \fBy\fR > \fBx\fR), then OpenSSL will read all \fBy\fR bytes |
| 86 |
into its buffer (providing that the buffer is large enough) if reading ahead is |
| 87 |
on, or \fBx\fR bytes otherwise. |
| 88 |
Setting the parameter \fByes\fR to 0 turns reading ahead is off, other values turn |
| 89 |
it on. |
| 90 |
\&\fBSSL_CTX_set_default_read_ahead()\fR is identical to \fBSSL_CTX_set_read_ahead()\fR. |
| 91 |
.PP |
| 92 |
\&\fBSSL_CTX_get_read_ahead()\fR and \fBSSL_get_read_ahead()\fR indicate whether reading |
| 93 |
ahead has been set or not. |
| 94 |
\&\fBSSL_CTX_get_default_read_ahead()\fR is identical to \fBSSL_CTX_get_read_ahead()\fR. |
| 95 |
.PP |
| 96 |
These functions cannot be used with QUIC SSL objects. \fBSSL_set_read_ahead()\fR |
| 97 |
has no effect if called on a QUIC SSL object. |
| 98 |
.SH NOTES |
| 99 |
.IX Header "NOTES" |
| 100 |
These functions have no impact when used with DTLS. The return values for |
| 101 |
\&\fBSSL_CTX_get_read_head()\fR and \fBSSL_get_read_ahead()\fR are undefined for DTLS. Setting |
| 102 |
\&\fBread_ahead\fR can impact the behaviour of the \fBSSL_pending()\fR function |
| 103 |
(see \fBSSL_pending\fR\|(3)). |
| 104 |
.PP |
| 105 |
Since \fBSSL_read()\fR can return \fBSSL_ERROR_WANT_READ\fR for non-application data |
| 106 |
records, and \fBSSL_has_pending()\fR can't tell the difference between processed and |
| 107 |
unprocessed data, it's recommended that if read ahead is turned on that |
| 108 |
\&\fBSSL_MODE_AUTO_RETRY\fR is not turned off using \fBSSL_CTX_clear_mode()\fR. |
| 109 |
That will prevent getting \fBSSL_ERROR_WANT_READ\fR when there is still a complete |
| 110 |
record available that hasn't been processed. |
| 111 |
.PP |
| 112 |
If the application wants to continue to use the underlying transport (e.g. TCP |
| 113 |
connection) after the SSL connection is finished using \fBSSL_shutdown()\fR reading |
| 114 |
ahead should be turned off. |
| 115 |
Otherwise the SSL structure might read data that it shouldn't. |
| 116 |
.SH "RETURN VALUES" |
| 117 |
.IX Header "RETURN VALUES" |
| 118 |
\&\fBSSL_get_read_ahead()\fR and \fBSSL_CTX_get_read_ahead()\fR return 0 if reading ahead is off, |
| 119 |
and non zero otherwise. |
| 120 |
.SH "SEE ALSO" |
| 121 |
.IX Header "SEE ALSO" |
| 122 |
\&\fBssl\fR\|(7), \fBSSL_pending\fR\|(3) |
| 123 |
.SH COPYRIGHT |
| 124 |
.IX Header "COPYRIGHT" |
| 125 |
Copyright 2015\-2023 The OpenSSL Project Authors. All Rights Reserved. |
| 126 |
.PP |
| 127 |
Licensed under the Apache License 2.0 (the "License"). You may not use |
| 128 |
this file except in compliance with the License. You can obtain a copy |
| 129 |
in the file LICENSE in the source distribution or at |
| 130 |
<https://www.openssl.org/source/license.html>. |