Fixed for IE11 in amt-redir-ws.js

This commit is contained in:
Ylian Saint-Hilaire 2019-07-05 14:17:05 -07:00
parent 35102c4296
commit 48d652e768
2 changed files with 2 additions and 2 deletions

View File

@ -54,7 +54,7 @@ p.PerformAjaxEx(a[0],a[1],a[2],a[3],a[4]);p.PerformNextAjax()}};p.PerformAjaxEx=
p.PendingAjax.shift();b[1](null,a,b[2])}null!=p.websocket&&(p.websocket.close(),p.websocket=null,p.socketState=0)};return p},CreateAmtRedirect=function(b){var c={};c.m=b;b.parent=c;c.State=0;c.socket=null;c.host=null;c.port=0;c.user=null;c.pass=null;c.authuri="/RedirectionService";c.tlsv1only=0;c.connectstate=0;c.protocol=b.protocol;c.amtaccumulator="";c.amtsequence=1;c.amtkeepalivetimer=null;c.digestRealmMatch=null;c.onStateChanged=null;c.Start=function(a,b,d,n,e){c.host=a;c.port=b;c.user=d;c.pass=
n;c.connectstate=0;c.socket=new WebSocket(window.location.protocol.replace("http","ws")+"//"+window.location.host+window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/"))+"/webrelay.ashx?p=2&host="+a+"&port="+b+"&tls="+e+("*"==d?"&serverauth=1":"")+("undefined"===typeof n?"&serverauth=1&user="+d:"")+"&tls1only="+c.tlsv1only);c.socket.onopen=c.xxOnSocketConnected;c.socket.onmessage=c.xxOnMessage;c.socket.onclose=c.xxOnSocketClosed;c.xxStateChange(1)};c.xxOnSocketConnected=function(){urlvars&&
urlvars.redirtrace&&console.log("REDIR-CONNECT");c.xxStateChange(2);1==c.protocol&&c.xxSend(c.RedirectStartSol);2==c.protocol&&c.xxSend(c.RedirectStartKvm);3==c.protocol&&c.xxSend(c.RedirectStartIder)};var a=new FileReader,d=!1,e=[];a.readAsBinaryString?a.onload=function(b){c.xxOnSocketData(b.target.result);0==e.length?d=!1:a.readAsBinaryString(new Blob([e.shift()]))}:a.readAsArrayBuffer&&(a.onloadend=function(b){c.xxOnSocketData(b.target.result);0==e.length?d=!1:a.readAsArrayBuffer(e.shift())});
c.xxOnMessage=function(b){c.inDataCount++;if("object"==typeof b.data)if(1==d)e.push(b.data);else if(a.readAsBinaryString)d=!0,a.readAsBinaryString(new Blob([b.data]));else if(f.readAsArrayBuffer)d=!0,a.readAsArrayBuffer(b.data);else{var l="";b=new Uint8Array(b.data);for(var u=b.byteLength,n=0;n<u;n++)l+=String.fromCharCode(b[n]);c.xxOnSocketData(l)}else c.xxOnSocketData(b.data)};c.xxOnSocketData=function(a){if(a&&-1!=c.connectstate){if("object"===typeof a){var b="",d=new Uint8Array(a),n=d.byteLength;
c.xxOnMessage=function(b){c.inDataCount++;if("object"==typeof b.data)if(1==d)e.push(b.data);else if(a.readAsBinaryString)d=!0,a.readAsBinaryString(new Blob([b.data]));else if(a.readAsArrayBuffer)d=!0,a.readAsArrayBuffer(b.data);else{var l="";b=new Uint8Array(b.data);for(var u=b.byteLength,n=0;n<u;n++)l+=String.fromCharCode(b[n]);c.xxOnSocketData(l)}else c.xxOnSocketData(b.data)};c.xxOnSocketData=function(a){if(a&&-1!=c.connectstate){if("object"===typeof a){var b="",d=new Uint8Array(a),n=d.byteLength;
for(a=0;a<n;a++)b+=String.fromCharCode(d[a]);a=b}else if("string"!==typeof a)return;if((2==c.protocol||3==c.protocol)&&1==c.connectstate)return c.m.ProcessData(a);c.amtaccumulator+=a;for(urlvars&&urlvars.redirtrace&&console.log("REDIR-RECV("+c.amtaccumulator.length+"): "+rstr2hex(c.amtaccumulator));1<=c.amtaccumulator.length;){a=0;switch(c.amtaccumulator.charCodeAt(0)){case 17:if(4>c.amtaccumulator.length)return;switch(c.amtaccumulator.charCodeAt(1)){case 0:if(13>c.amtaccumulator.length)return;b=
c.amtaccumulator.charCodeAt(12);if(c.amtaccumulator.length<13+b)return;c.xxSend(String.fromCharCode(19,0,0,0,0,0,0,0,0));a=13+b;break;default:c.Stop()}break;case 20:if(9>c.amtaccumulator.length)return;var e=ReadIntX(c.amtaccumulator,5);if(c.amtaccumulator.length<9+e)return;var n=c.amtaccumulator.charCodeAt(1),b=c.amtaccumulator.charCodeAt(4),x=[];for(a=0;a<e;a++)x.push(c.amtaccumulator.charCodeAt(9+a));d=c.amtaccumulator.substring(9,9+e);a=9+e;if(0==b)0<=x.indexOf(4)?c.xxSend(String.fromCharCode(19,
0,0,0,4)+IntToStrX(c.user.length+c.authuri.length+8)+String.fromCharCode(c.user.length)+c.user+String.fromCharCode(0,0)+String.fromCharCode(c.authuri.length)+c.authuri+String.fromCharCode(0,0,0,0)):0<=x.indexOf(3)?c.xxSend(String.fromCharCode(19,0,0,0,3)+IntToStrX(c.user.length+c.authuri.length+7)+String.fromCharCode(c.user.length)+c.user+String.fromCharCode(0,0)+String.fromCharCode(c.authuri.length)+c.authuri+String.fromCharCode(0,0,0)):0<=x.indexOf(1)?c.xxSend(String.fromCharCode(19,0,0,0,1)+IntToStrX(c.user.length+

View File

@ -79,7 +79,7 @@ var CreateAmtRedirect = function (module, authCookie) {
// Chrome & Firefox (Draft)
fileReaderInuse = true;
fileReader.readAsBinaryString(new Blob([e.data]));
} else if (f.readAsArrayBuffer) {
} else if (fileReader.readAsArrayBuffer) {
// Chrome & Firefox (Spec)
fileReaderInuse = true;
fileReader.readAsArrayBuffer(e.data);