Fix Windows 8 HTMLAnchorElement return host:80 which force Basic Auth Header to replace options Auth Header

This commit is contained in:
Maxime LUCE
2013-09-18 03:33:13 +02:00
parent 8cfb8a2568
commit 714bff1ec2
+8
View File
@@ -73,6 +73,7 @@ module.exports = {
download:function(win, error, options) {
var source = options[0];
var target = options[1];
var headers = options[4] || {};
if (target === null || typeof target === undefined) {
@@ -96,6 +97,13 @@ module.exports = {
storageFolder.createFileAsync(fileName, Windows.Storage.CreationCollisionOption.generateUniqueName).then(function (storageFile) {
var uri = Windows.Foundation.Uri(source);
var downloader = new Windows.Networking.BackgroundTransfer.BackgroundDownloader();
if (headers) {
for (var header in headers) {
downloader.setRequestHeader(header, headers[header]);
}
}
download = downloader.createDownload(uri, storageFile);
download.startAsync().then(function () {
win(new FileEntry(storageFile.name, storageFile.path));