Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/phpredis/phpredis.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavlo Yatsukhnenko <yatsukhnenko@gmail.com>2020-05-27 17:39:33 +0300
committerPavlo Yatsukhnenko <yatsukhnenko@gmail.com>2020-06-02 17:38:12 +0300
commitb067129678264fc1c5c0f611ce1b192e05c14669 (patch)
treece58b1efd08c14d84af94453df1d40f36568cbb6 /redis.c
parentf9c7bb5788c39614c23e3bb9ec42ec8d6d5bbaa1 (diff)
Issue #1600
Ssl context options in Redis::connect
Diffstat (limited to 'redis.c')
-rw-r--r--redis.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/redis.c b/redis.c
index 585915de..46278abd 100644
--- a/redis.c
+++ b/redis.c
@@ -959,7 +959,7 @@ PHP_METHOD(Redis, pconnect)
PHP_REDIS_API int
redis_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
{
- zval *object;
+ zval *object, *ssl = NULL;
char *host = NULL, *persistent_id = NULL;
zend_long port = -1, retry_interval = 0;
size_t host_len, persistent_id_len;
@@ -973,10 +973,10 @@ redis_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
#endif
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(),
- "Os|lds!ld", &object, redis_ce, &host,
+ "Os|lds!lda", &object, redis_ce, &host,
&host_len, &port, &timeout, &persistent_id,
&persistent_id_len, &retry_interval,
- &read_timeout) == FAILURE)
+ &read_timeout, &ssl) == FAILURE)
{
return FAILURE;
}
@@ -1016,6 +1016,10 @@ redis_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
redis->sock = redis_sock_create(host, host_len, port, timeout, read_timeout, persistent,
persistent_id, retry_interval);
+ if (ssl != NULL) {
+ redis_sock_set_stream_context(redis->sock, ssl);
+ }
+
if (redis_sock_server_open(redis->sock) < 0) {
if (redis->sock->err) {
REDIS_THROW_EXCEPTION(ZSTR_VAL(redis->sock->err), 0);