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