Patched novnc code to handle port 443 and 80

We were able to run novnc if it were on a port other than 443/80,
otherwise it would hang with "loading" text.  This bug was corrected
upstream, a few days ago.  We are likely not to see this fix get
into opentstack repos for quite some time (if ever in folsom).

https://github.com/kanaka/noVNC/pull/245
This commit is contained in:
John Dewey 2013-04-29 10:26:00 -07:00
parent c2780ed3d8
commit b0df8170c2
2 changed files with 26 additions and 3 deletions

View File

@ -20,7 +20,7 @@ keyboardVisible: false,
// Render default UI and initialize settings menu
load: function() {
var html = '', i, sheet, sheets, llevels;
var html = '', i, sheet, sheets, llevels, port;
// Stylesheet selection dropdown
sheet = WebUtil.selectStylesheet();
@ -44,9 +44,21 @@ load: function() {
// call twice to get around webkit bug
WebUtil.selectStylesheet(UI.getSetting('stylesheet'));
// if port == 80 (or 443) then it won't be present and should be
// set manually
port = window.location.port;
if (!port) {
if (window.location.protocol.substring(0,5) == 'https') {
port = 443;
}
else if (window.location.protocol.substring(0,4) == 'http') {
port = 80;
}
}
/* Populate the controls if defaults are provided in the URL */
UI.initSetting('host', window.location.hostname);
UI.initSetting('port', window.location.port);
//UI.initSetting('port', window.location.port);
UI.initSetting('port', port);
UI.initSetting('password', '');
UI.initSetting('encrypt', (window.location.protocol === "https:"));

View File

@ -93,7 +93,18 @@
document.title = unescape(WebUtil.getQueryVar('title', 'noVNC'));
// By default, use the host and port of server that served this file
host = WebUtil.getQueryVar('host', window.location.hostname);
port = WebUtil.getQueryVar('port', window.location.port);
//port = WebUtil.getQueryVar('port', window.location.port);
// if port == 80 (or 443) then it won't be present and should be
// set manually
if (!port) {
if (window.location.protocol.substring(0,5) == 'https') {
port = 443;
}
else if (window.location.protocol.substring(0,4) == 'http') {
port = 80;
}
}
// If a token variable is passed in, set the parameter in a cookie.
// This is used by nova-novncproxy.