ssl_ctx_set_session_cache_mode.pod
来自「With OpenSSL 0.9.6, a new component has 」· POD 代码 · 共 109 行
POD
109 行
=pod=head1 NAMESSL_CTX_set_session_cache_mode, SSL_CTX_get_session_cache_mode - enable/disable session caching=head1 SYNOPSIS #include <openssl/ssl.h> long SSL_CTX_set_session_cache_mode(SSL_CTX ctx, long mode); long SSL_CTX_get_session_cache_mode(SSL_CTX ctx);=head1 DESCRIPTIONSSL_CTX_set_session_cache_mode() enables/disables session cachingby setting the operational mode for B<ctx> to <mode>.SSL_CTX_get_session_cache_mode() returns the currently used cache mode.=head1 NOTESThe OpenSSL library can store/retrieve SSL/TLS sessions for later reuse.The sessions can be held in memory for each B<ctx>, if more than oneSSL_CTX object is being maintained, the sessions are unique for each SSL_CTXobject.In order to reuse a session, a client must send the session's id to theserver. It can only send exactly one id. The server then decides whether itagrees in reusing the session or starts the handshake for a new session.A server will lookup up the session in its internal session storage. Ifthe session is not found in internal storage or internal storage isdeactivated, the server will try the external storage if available.Since a client may try to reuse a session intended for use in a differentcontext, the session id context must be set by the server (seeL<SSL_CTX_set_session_id_context(3)|SSL_CTX_set_session_id_context(3)>).The following session cache modes and modifiers are available:=over 4=item SSL_SESS_CACHE_OFFNo session caching for client or server takes place.=item SSL_SESS_CACHE_CLIENTClient sessions are added to the session cache. As there is no reliable wayfor the OpenSSL library to know whether a session should be reused or whichsession to choose (due to the abstract BIO layer the SSL engine does nothave details about the connection), the application must select the sessionto be reused by using the L<SSL_set_session(3)|SSL_set_session(3)>function. This option is not activated by default.=item SSL_SESS_CACHE_SERVERServer sessions are added to the session cache. When a client proposes asession to be reused, the session is looked up in the internal session cache.If the session is found, the server will try to reuse the session.This is the default.=item SSL_SESS_CACHE_BOTHEnable both SSL_SESS_CACHE_CLIENT and SSL_SESS_CACHE_SERVER at the same time.=item SSL_SESS_CACHE_NO_AUTO_CLEARNormally the session cache is checked for expired sessions every255 connections using theL<SSL_CTX_flush_sessions(3)|SSL_CTX_flush_sessions(3)> function. Sincethis may lead to a delay which cannot be controlled, the automaticflushing may be disabled andL<SSL_CTX_flush_sessions(3)|SSL_CTX_flush_sessions(3)> can be calledexplicitly by the application.=item SSL_SESS_CACHE_NO_INTERNAL_LOOKUPBy setting this flag sessions are cached in the internal storage butthey are not looked up automatically. If an external session cacheis enabled, sessions are looked up in the external cache. As automaticlookup only applies for SSL/TLS servers, the flag has no effect onclients.=backThe default mode is SSL_SESS_CACHE_SERVER.=head1 RETURN VALUESSSL_CTX_set_session_cache_mode() returns the previously set cache mode.SSL_CTX_get_session_cache_mode() returns the currently set cache mode.=head1 SEE ALSOL<ssl(3)|ssl(3)>, L<SSL_set_session(3)|SSL_set_session(3)>,L<SSL_session_reused(3)|SSL_session_reused(3)>,L<SSL_CTX_sess_number(3)|SSL_CTX_sess_number(3)>,L<SSL_CTX_sess_set_cache_size(3)|SSL_CTX_sess_set_cache_size(3)>,L<SSL_CTX_sess_set_get_cb(3)|SSL_CTX_sess_set_get_cb(3)>,L<SSL_CTX_set_session_id_context(3)|SSL_CTX_set_session_id_context(3)>,L<SSL_CTX_set_timeout(3)|SSL_CTX_set_timeout(3)>,L<SSL_CTX_flush_sessions(3)|SSL_CTX_flush_sessions(3)>=cut
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?