websockify: better multi-python version support.

Pull from websockify: 008a5118e728.

Should address issue https://github.com/kanaka/noVNC/issues/107

- Also add ability to force use of web-socket-js using
  window.WEB_SOCKET_FORCE_FLASH

- in websock.js, for rQshift*, assume length is the full length if not
  specified.
This commit is contained in:
Joel Martin
2011-12-15 15:26:16 -06:00
parent b688a909b0
commit f2d856767d
2 changed files with 47 additions and 38 deletions
+4 -2
View File
@@ -17,9 +17,9 @@
// Load Flash WebSocket emulator if needed
if (window.WebSocket) {
if (window.WebSocket && !window.WEB_SOCKET_FORCE_FLASH) {
Websock_native = true;
} else if (window.MozWebSocket) {
} else if (window.MozWebSocket && !window.WEB_SOCKET_FORCE_FLASH) {
Websock_native = true;
window.WebSocket = window.MozWebSocket;
} else {
@@ -119,6 +119,7 @@ function rQshift32() {
(rQ[rQi++] );
}
function rQshiftStr(len) {
if (typeof(len) === 'undefined') { len = rQlen(); }
var arr = rQ.slice(rQi, rQi + len);
rQi += len;
return arr.map(function (num) {
@@ -126,6 +127,7 @@ function rQshiftStr(len) {
}
function rQshiftBytes(len) {
if (typeof(len) === 'undefined') { len = rQlen(); }
rQi += len;
return rQ.slice(rQi-len, rQi);
}