Skip to content

Commit

Permalink
Support TLS protocol
Browse files Browse the repository at this point in the history
  • Loading branch information
pupitooo committed Jul 19, 2024
1 parent 1a2412b commit e1330fd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/Kdyby/Redis/DI/RedisExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,8 @@ protected function loadNativeSessionHandler(array $session): void
$savePath = $session['host'];

} else {
$savePath = \sprintf('tcp://%s:%d', $session['host'], $session['port']);
$protocol = \strpos($session['host'], '://') === false ? 'tcp://' : '';
$savePath = \sprintf('%s%s:%d', $protocol, $session['host'], $session['port']);
}

if (!$params['persistent']) {
Expand Down
4 changes: 3 additions & 1 deletion src/Kdyby/Redis/RedisClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,9 @@ private function formatServerAddress(): string
return $this->host;
}

return \sprintf('tcp://%s:%s', $this->host, $this->port ?: self::DEFAULT_PORT);
$protocol = (\stripos($this->host, '://') === false) ? 'tcp://' : '';

return \sprintf('%s%s:%s', $protocol, $this->host, $this->port ?: self::DEFAULT_PORT);
}

/************************ syntax sugar ************************/
Expand Down

0 comments on commit e1330fd

Please sign in to comment.