Merge pull request #1084 from stanhu/sh-improve-ssl-docs
Improve example for SSL initialization in README.md
This commit is contained in:
commit
dd7979ac10
@ -604,7 +604,7 @@ redisSSLContext *ssl_context;
|
|||||||
/* An error variable to indicate what went wrong, if the context fails to
|
/* An error variable to indicate what went wrong, if the context fails to
|
||||||
* initialize.
|
* initialize.
|
||||||
*/
|
*/
|
||||||
redisSSLContextError ssl_error;
|
redisSSLContextError ssl_error = REDIS_SSL_CTX_NONE;
|
||||||
|
|
||||||
/* Initialize global OpenSSL state.
|
/* Initialize global OpenSSL state.
|
||||||
*
|
*
|
||||||
@ -622,11 +622,11 @@ ssl_context = redisCreateSSLContext(
|
|||||||
"redis.mydomain.com", /* Server name to request (SNI), optional */
|
"redis.mydomain.com", /* Server name to request (SNI), optional */
|
||||||
&ssl_error);
|
&ssl_error);
|
||||||
|
|
||||||
if(ssl_context == NULL || ssl_error != 0) {
|
if(ssl_context == NULL || ssl_error != REDIS_SSL_CTX_NONE) {
|
||||||
/* Handle error and abort... */
|
/* Handle error and abort... */
|
||||||
/* e.g.
|
/* e.g.
|
||||||
printf("SSL error: %s\n",
|
printf("SSL error: %s\n",
|
||||||
(ssl_error != 0) ?
|
(ssl_error != REDIS_SSL_CTX_NONE) ?
|
||||||
redisSSLContextGetError(ssl_error) : "Unknown error");
|
redisSSLContextGetError(ssl_error) : "Unknown error");
|
||||||
// Abort
|
// Abort
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user