就我而言,在将 AjaxPro 与 https、TLS 1.2、ECDHE_RSA 与 P-256 密钥交换和 AES_256_GCM 密码(IE11+、Chrome51+、Firefox49+)一起使用时,我遇到了同样的错误。请在此处查看)。它可以使用带有 HMAC-SHA1 密码的过时 AES_256_CBC 运行。
问题是服务器响应后XMLHttpRequest.statusText属性为空(我真的不知道为什么)并且AjaxPro.Request.prototype.doStateChange方法(ajaxpro/core.ashx 文件)期望“OK”将响应视为有效:
var res = this.getEmptyRes();
if(this.xmlHttp.status == 200 && this.xmlHttp.statusText == "OK") {
res = this.createResponse(res);
} else {
res = this.createResponse(res, true);
res.error = {Message:this.xmlHttp.statusText,Type:"ConnectFailure",Status:this.xmlHttp.status};
}
我最终决定重写AjaxPro.Request.prototype.doStateChange方法并在this.xmlHttp.statusText中允许一个空值。
我将此脚本添加到受影响的页面中:
$(function() {
if (typeof AjaxPro != 'undefined' && AjaxPro && AjaxPro.Request && AjaxPro.Request.prototype) {
AjaxPro.Request.prototype.doStateChange = function () {
this.onStateChanged(this.xmlHttp.readyState, this);
if (this.xmlHttp.readyState != 4 || !this.isRunning) {
return;
}
this.duration = new Date().getTime() - this.__start;
if (this.timeoutTimer != null) {
clearTimeout(this.timeoutTimer);
}
var res = this.getEmptyRes();
if (this.xmlHttp.status == 200 && (this.xmlHttp.statusText == "OK" || !this.xmlHttp.statusText)) {
res = this.createResponse(res);
} else {
res = this.createResponse(res, true);
res.error = { Message: this.xmlHttp.statusText, Type: "ConnectFailure", Status: this.xmlHttp.status };
}
this.endRequest(res);
};
}
});