1SSL_CTX_SET_READ_AHEAD(3) OpenSSL SSL_CTX_SET_READ_AHEAD(3)
2
3
4
6 SSL_CTX_set_read_ahead, SSL_CTX_get_read_ahead, SSL_set_read_ahead,
7 SSL_get_read_ahead, SSL_CTX_get_default_read_ahead - manage whether to
8 read as many input bytes as possible
9
11 #include <openssl/ssl.h>
12
13 void SSL_set_read_ahead(SSL *s, int yes);
14 int SSL_get_read_ahead(const SSL *s);
15
16 SSL_CTX_set_read_ahead(SSL_CTX *ctx, int yes);
17 long SSL_CTX_get_read_ahead(SSL_CTX *ctx);
18 long SSL_CTX_get_default_read_ahead(SSL_CTX *ctx);
19
21 SSL_CTX_set_read_ahead() and SSL_set_read_ahead() set whether we should
22 read as many input bytes as possible (for non-blocking reads) or not.
23 For example if x bytes are currently required by OpenSSL, but y bytes
24 are available from the underlying BIO (where y > x), then OpenSSL will
25 read all y bytes into its buffer (providing that the buffer is large
26 enough) if reading ahead is on, or x bytes otherwise. Setting the
27 parameter yes to 0 turns reading ahead is off, other values turn it on.
28 SSL_CTX_set_default_read_ahead() is identical to
29 SSL_CTX_set_read_ahead().
30
31 SSL_CTX_get_read_ahead() and SSL_get_read_ahead() indicate whether
32 reading ahead has been set or not. SSL_CTX_get_default_read_ahead() is
33 identical to SSL_CTX_get_read_ahead().
34
36 These functions have no impact when used with DTLS. The return values
37 for SSL_CTX_get_read_head() and SSL_get_read_ahead() are undefined for
38 DTLS. Setting read_ahead can impact the behaviour of the SSL_pending()
39 function (see SSL_pending(3)).
40
41 Since SSL_read() can return SSL_ERROR_WANT_READ for non-application
42 data records, and SSL_has_pending() can't tell the difference between
43 processed and unprocessed data, it's recommended that if read ahead is
44 turned on that SSL_MODE_AUTO_RETRY is not turned off using
45 SSL_CTX_clear_mode(). That will prevent getting SSL_ERROR_WANT_READ
46 when there is still a complete record availale that hasn't been
47 processed.
48
49 If the application wants to continue to use the underlying transport
50 (e.g. TCP connection) after the SSL connection is finished using
51 SSL_shutdown() reading ahead should be turned off. Otherwise the SSL
52 structure might read data that it shouldn't.
53
55 SSL_get_read_ahead() and SSL_CTX_get_read_ahead() return 0 if reading
56 ahead is off, and non zero otherwise.
57
59 ssl(7), SSL_pending(3)
60
62 Copyright 2015-2018 The OpenSSL Project Authors. All Rights Reserved.
63
64 Licensed under the OpenSSL license (the "License"). You may not use
65 this file except in compliance with the License. You can obtain a copy
66 in the file LICENSE in the source distribution or at
67 <https://www.openssl.org/source/license.html>.
68
69
70
711.1.1 2018-09-11 SSL_CTX_SET_READ_AHEAD(3)