File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -694,6 +694,7 @@ redis_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
694694 size_t host_len , persistent_id_len ;
695695 double timeout = 0.0 , read_timeout = 0.0 ;
696696 redis_object * redis ;
697+ int af_unix ;
697698
698699#ifdef ZTS
699700 /* not sure how in threaded mode this works so disabled persistence at
@@ -730,8 +731,13 @@ redis_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
730731 return FAILURE ;
731732 }
732733
734+ /* Does the host look like a unix socket */
735+ af_unix = (host_len > 0 && host [0 ] == '/' ) ||
736+ (host_len > 6 && !strncasecmp (host , "unix://" , sizeof ("unix://" ) - 1 )) ||
737+ (host_len > 6 && !strncasecmp (host , "file://" , sizeof ("file://" ) - 1 ));
738+
733739 /* If it's not a unix socket, set to default */
734- if (port == -1 && host_len && host [ 0 ] != '/' ) {
740+ if (port == -1 && ! af_unix ) {
735741 port = 6379 ;
736742 }
737743
You can’t perform that action at this time.
0 commit comments