From 8338231ce5f4badb52fe463c8698e9707235bef1 Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Wed, 17 Jun 2015 22:09:05 +0100 Subject: [PATCH] Drop blank port from comms ws path --- editor/js/comms.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/editor/js/comms.js b/editor/js/comms.js index b6aba53db..8af17ced6 100644 --- a/editor/js/comms.js +++ b/editor/js/comms.js @@ -1,5 +1,5 @@ /** - * Copyright 2014 IBM Corp. + * Copyright 2014, 2015 IBM Corp. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,9 +24,15 @@ RED.comms = (function() { var pendingAuth = false; function connectWS() { - var path = location.hostname+":"+location.port+document.location.pathname; + var path = location.hostname; + var port = location.port; + if (port.length !== 0) { + path = path+":"+port; + } + path = path+document.location.pathname; path = path+(path.slice(-1) == "/"?"":"/")+"comms"; path = "ws"+(document.location.protocol=="https:"?"s":"")+"://"+path; + var auth_tokens = RED.settings.get("auth-tokens"); pendingAuth = (auth_tokens!=null);