Skip to content

Commit 1bc3917

Browse files
authored
client support ssl_ciphers config (#4432)
1 parent 372fdb8 commit 1bc3917

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

ext-src/swoole_client.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,10 @@ void php_swoole_client_check_ssl_setting(Client *cli, zval *zset) {
324324
zend_long v = zval_get_long(ztmp);
325325
cli->ssl_context->verify_depth = SW_MAX(0, SW_MIN(v, UINT8_MAX));
326326
}
327+
if (php_swoole_array_get_value(vht, "ssl_ciphers", ztmp)) {
328+
zend::String str_v(ztmp);
329+
cli->ssl_context->ciphers = str_v.to_std_string();
330+
}
327331
if (!cli->ssl_context->cert_file.empty() && cli->ssl_context->key_file.empty()) {
328332
php_swoole_fatal_error(E_ERROR, "ssl require key file");
329333
return;

ext-src/swoole_client_coro.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,9 @@ bool php_swoole_socket_set_ssl(Socket *sock, zval *zset) {
457457
zend_long v = zval_get_long(ztmp);
458458
sock->get_ssl_context()->verify_depth = SW_MAX(0, SW_MIN(v, UINT8_MAX));
459459
}
460+
if (php_swoole_array_get_value(vht, "ssl_ciphers", ztmp)) {
461+
sock->get_ssl_context()->ciphers = zend::String(ztmp).to_std_string();
462+
}
460463
if (!sock->ssl_check_context()) {
461464
ret = false;
462465
}

0 commit comments

Comments
 (0)