From b8c4b1fbacd327840fb7ccbd44e0a28fdcf4e250 Mon Sep 17 00:00:00 2001 From: Anders Bergh Date: Sat, 21 Jun 2014 18:41:56 +0200 Subject: [PATCH] Wrap IPv6 literals with brackets. Fixes #323. --- js/glowingbear.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/js/glowingbear.js b/js/glowingbear.js index 7c0e067..b6e0907 100644 --- a/js/glowingbear.js +++ b/js/glowingbear.js @@ -260,6 +260,10 @@ function($rootScope, var connect = function (host, port, passwd, ssl, noCompression) { var proto = ssl ? 'wss' : 'ws'; + // If host is an IPv6 literal wrap it in brackets + if (host.indexOf(":") !== -1) { + host = "[" + host + "]"; + } var url = proto + "://" + host + ":" + port + "/weechat"; $log.debug('Connecting to URL: ', url);