Unverified Commit 8b497881 authored by Andreas Lind's avatar Andreas Lind Committed by GitHub
Browse files

Support redis-cli -u rediss://... (#7900)

parent 056a43e1
...@@ -388,12 +388,20 @@ static sds percentDecode(const char *pe, size_t len) { ...@@ -388,12 +388,20 @@ static sds percentDecode(const char *pe, size_t len) {
static void parseRedisUri(const char *uri) { static void parseRedisUri(const char *uri) {
const char *scheme = "redis://"; const char *scheme = "redis://";
const char *tlsscheme = "rediss://";
const char *curr = uri; const char *curr = uri;
const char *end = uri + strlen(uri); const char *end = uri + strlen(uri);
const char *userinfo, *username, *port, *host, *path; const char *userinfo, *username, *port, *host, *path;
/* URI must start with a valid scheme. */ /* URI must start with a valid scheme. */
if (strncasecmp(scheme, curr, strlen(scheme))) { if (!strncasecmp(tlsscheme, curr, strlen(tlsscheme))) {
#ifdef USE_OPENSSL
config.tls = 1;
#else
fprintf(stderr,"rediss:// is only supported when redis-cli is compiled with OpenSSL\n");
exit(1);
#endif
} else if (strncasecmp(scheme, curr, strlen(scheme))) {
fprintf(stderr,"Invalid URI scheme\n"); fprintf(stderr,"Invalid URI scheme\n");
exit(1); exit(1);
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment