From cb7936bf719499d6007136de27d800e93fae7b66 Mon Sep 17 00:00:00 2001 From: Boris Gulay Date: Sun, 31 May 2020 15:43:39 +0300 Subject: [PATCH] Handle hosts with protocol correctly. Closes #68 --- ident_switch.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ident_switch.php b/ident_switch.php index a44f2ff..3c0c51a 100644 --- a/ident_switch.php +++ b/ident_switch.php @@ -718,8 +718,9 @@ class ident_switch extends rcube_plugin $port = $r['imap_port'] ? $r['imap_port'] : $def_port; $host = $r['imap_host'] ? $r['imap_host'] : 'localhost'; // Default IMAP host here! - if ($ssl) - $host = "{$ssl}://{$host}"; + $hostProtocol = "{$ssl}://"; + if ($ssl && strncasecmp($host, $hostProtocol, strlen($hostProtocol)) !== 0) + $host = $hostProtocol . $host; $delimiter = $r['imap_delimiter'] ? $r['imap_delimiter'] : '.'; // Default delimiter here