[英]Cordova file transfer plugin using https not working for windows
I am currently using cordova file transfer plugin to download a file and save it locally. 我目前正在使用cordova文件传输插件下载文件并将其保存在本地。 I am using https and the server certificate is installed in the device.
我正在使用https,并且服务器证书已安装在设备中。
It works on IOS and android but it does not work on Windows. 它适用于IOS和android,但不适用于Windows。
I was able to debug up to plugin's code and it would error in this part with the error message of 'A security problem occurred' and would now return to the application with the FTErr.CONNECTION_ERR: 我能够调试插件的代码,它会在这部分出错,并显示错误消息“发生了安全问题”,现在将使用FTErr.CONNECTION_ERR返回到应用程序:
var downloadOperation = download.startAsync();
// update internal TransferOperation object with newly created promise
fileTransferOps[downloadId].promise = downloadOperation;
downloadOperation.then(function () {...}, function(error)
{
if (error.message === 'Canceled') {
resolve(new FTErr(FTErr.ABORT_ERR, source, target, null, null, error));
} else if (error && error.number === HTTP_E_STATUS_NOT_MODIFIED) {
resolve(new FTErr(FTErr.NOT_MODIFIED_ERR, source, target, 304, null, error));
} else {
// in the other way, try to get response property
var response = download.getResponseInformation();
if (!response) {
resolve(new FTErr(FTErr.CONNECTION_ERR, source, target));
}
}
}
This is my code in cordova: 这是我在科尔多瓦的代码:
fileTransfer.download(uri, fileURL, function (entry) {
console.log('file download successful');
}, function (errorMsg) {
console.log(errorMsg);
}, false, {
headers: {"Authorization": authToken},
});`
Is there anything I am missing to make this work in windows? 在Windows中使我无法正常工作吗?
Just to add, download using http was working. 只是添加,使用http下载是有效的。 Https certificate is also valid since ajax get worked.
自从ajax开始工作以来,Https证书也是有效的。
Thanks! 谢谢!
From MSDN, client certificate is not supported by the BackgroundDownloader. 从MSDN,BackgroundDownloader不支持客户端证书。 https://social.msdn.microsoft.com/Forums/en-US/c25146d2-c051-4367-9745-2b526618dc35/winjsxhr-and-httpclient-work-with-client-certificates-backgrounddownloader-doesnt?forum=winappswithhtml5
https://social.msdn.microsoft.com/Forums/en-US/c25146d2-c051-4367-9745-2b526618dc35/winjsxhr-and-httpclient-work-with-client-certificates-backgrounddownloader-doesnt?forum=winappswithhtml5
So I guess the only way for now would be to create a plugin that uses HttpClient. 因此,我想现在唯一的方法就是创建一个使用HttpClient的插件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.