summaryrefslogtreecommitdiff
path: root/openstack_dashboard/static
diff options
context:
space:
mode:
authorHongbin Lu <hongbin034@gmail.com>2019-10-13 02:51:53 +0000
committerHongbin Lu <hongbin034@gmail.com>2019-10-13 02:54:14 +0000
commitea2212ebe59567d8ea21778cff5128e1029be045 (patch)
treef0d68dfa77d3e970bd0d96bfd728669c265d466b /openstack_dashboard/static
parentfa5f7b8996b5a62da4942a88e469fe7e6434f9c7 (diff)
downloadhorizon-ea2212ebe59567d8ea21778cff5128e1029be045.tar.gz
Send binary frame in websocket client
Websockify 0.9.0 rejected receiving text frame: https://github.com/novnc/websockify/commit/8eb5cb0cdcd1314d6d763df8f226b587a2396aa2 We have to switch to binary frame instead. Change-Id: I2677b8879ccb27def22126811c347d5c08f5aada Closes-Bug: #1847889
Diffstat (limited to 'openstack_dashboard/static')
-rw-r--r--openstack_dashboard/static/js/angular/directives/serialConsole.js12
1 files changed, 10 insertions, 2 deletions
diff --git a/openstack_dashboard/static/js/angular/directives/serialConsole.js b/openstack_dashboard/static/js/angular/directives/serialConsole.js
index c6ded3c95..df48e6b89 100644
--- a/openstack_dashboard/static/js/angular/directives/serialConsole.js
+++ b/openstack_dashboard/static/js/angular/directives/serialConsole.js
@@ -62,7 +62,7 @@ limitations under the License.
socket.onopen = function() {
scope.$apply(scope.status);
// initialize by "hitting enter"
- socket.send(String.fromCharCode(13));
+ socket.send(str2ab(String.fromCharCode(13)));
};
socket.onclose = function() {
scope.$apply(scope.status);
@@ -111,7 +111,7 @@ limitations under the License.
resizeTerminal();
term.on('data', function(data) {
- socket.send(data);
+ socket.send(str2ab(data));
});
socket.onmessage = function(e) {
@@ -141,4 +141,12 @@ limitations under the License.
};
}
+ function str2ab(str) {
+ var buf = new ArrayBuffer(str.length); // 2 bytes for each char
+ var bufView = new Uint8Array(buf);
+ for (var i = 0, strLen = str.length; i < strLen; i++) {
+ bufView[i] = str.charCodeAt(i);
+ }
+ return buf;
+ }
}());