summaryrefslogtreecommitdiff
path: root/sslio.c
diff options
context:
space:
mode:
authorvalentino <valentino@redislabs.com>2018-12-20 16:26:24 +0200
committerMark Nunberg <mnunberg@haskalah.org>2019-02-20 09:10:10 -0500
commit58222c26f4889c3f83c453bd7ec87e387459fd0c (patch)
treecf07f0fefd55a3ea381f1d26567252c4899ada12 /sslio.c
parent389e694abe6bb9ed6e5a44674d89a866c5231422 (diff)
Support SNI
Diffstat (limited to 'sslio.c')
-rw-r--r--sslio.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/sslio.c b/sslio.c
index 8933f95..efbf06e 100644
--- a/sslio.c
+++ b/sslio.c
@@ -87,7 +87,7 @@ void redisFreeSsl(redisSsl *ssl){
}
int redisSslCreate(redisContext *c, const char *capath, const char *certpath,
- const char *keypath) {
+ const char *keypath, const char *servername) {
assert(!c->ssl);
c->ssl = calloc(1, sizeof(*c->ssl));
static int isInit = 0;
@@ -131,6 +131,12 @@ int redisSslCreate(redisContext *c, const char *capath, const char *certpath,
__redisSetError(c, REDIS_ERR, "Couldn't create new SSL instance");
return REDIS_ERR;
}
+ if (servername) {
+ if (!SSL_set_tlsext_host_name(s->ssl, servername)) {
+ __redisSetError(c, REDIS_ERR, "Couldn't set server name indication");
+ return REDIS_ERR;
+ }
+ }
SSL_set_fd(s->ssl, c->fd);
SSL_set_connect_state(s->ssl);