mirror of
https://gitee.com/acl-dev/acl.git
synced 2024-12-02 03:47:53 +08:00
Add get_ssl_ctxes() in openssl_conf
This commit is contained in:
parent
540650660e
commit
1656fecf3c
@ -81,6 +81,12 @@ public:
|
||||
*/
|
||||
SSL_CTX* get_ssl_ctx(void) const;
|
||||
|
||||
/**
|
||||
* 获得所有的已经初始完成的 SSL_CTX 对象
|
||||
* @param out {std::vector<SSL_CTX*>&}
|
||||
*/
|
||||
void get_ssl_ctxes(std::vector<SSL_CTX*>& out);
|
||||
|
||||
/**
|
||||
* 服务模式下,创建 SSL_CTX 对象,内部自动设置 SNI 回调过程,虽然内部也是
|
||||
* 通过调用 SSL_CTX_new() API 创建 SSL_CTX 对象,但内部会自动区分动态
|
||||
|
@ -557,6 +557,23 @@ SSL_CTX* openssl_conf::get_ssl_ctx(void) const
|
||||
return ssl_ctx_;
|
||||
}
|
||||
|
||||
void openssl_conf::get_ssl_ctxes(std::vector<SSL_CTX*>& out)
|
||||
{
|
||||
#ifdef HAS_OPENSSL
|
||||
if (ssl_ctx_table_) {
|
||||
const token_node* node = ssl_ctx_table_->first_node();
|
||||
while (node) {
|
||||
SSL_CTX* ctx = (SSL_CTX*) node->get_ctx();
|
||||
if (ctx) {
|
||||
out.push_back(ctx);
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
(void) out;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef HAS_OPENSSL
|
||||
/* convert an ASN.1 string to a UTF-8 string (escaping control characters) */
|
||||
static char *asn1_string_to_utf8(ASN1_STRING *asn1str)
|
||||
@ -796,11 +813,11 @@ openssl_conf::~openssl_conf(void)
|
||||
}
|
||||
node = ssl_ctx_table_->next_node();
|
||||
}
|
||||
delete ssl_ctx_table_;
|
||||
} else if (ssl_ctx_) {
|
||||
__ssl_ctx_free(ssl_ctx_);
|
||||
}
|
||||
#endif
|
||||
delete ssl_ctx_table_;
|
||||
}
|
||||
|
||||
bool openssl_conf::load_ca(const char* ca_file, const char* /* ca_path */)
|
||||
|
Loading…
Reference in New Issue
Block a user