You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ag...@apache.org on 2013/02/28 19:09:27 UTC
ios commit: [CB-861] Header support for FileTransfer download
Updated Branches:
refs/heads/master 92146fffd -> 227452b1c
[CB-861] Header support for FileTransfer download
Added support for an optional options object as the final arg. Currently only handles the options.headers object (as per the issue).
`FileTransfer.download(source, target, successCallback, errorCallback, trustAllHosts, options)`
This is needed for using FileTransfer.download with Basic Authentication, etc. Sadly since Android 2.x doesn't support XHR2, this is needed in FileTransfer.
I have only added support to Android and iOS (see other PR's).
Project: http://git-wip-us.apache.org/repos/asf/cordova-ios/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-ios/commit/227452b1
Tree: http://git-wip-us.apache.org/repos/asf/cordova-ios/tree/227452b1
Diff: http://git-wip-us.apache.org/repos/asf/cordova-ios/diff/227452b1
Branch: refs/heads/master
Commit: 227452b1cafad6d4173e3782553e86f8c295d0d5
Parents: 92146ff
Author: Tommy-Carlos Williams <to...@devgeeks.org>
Authored: Sun Feb 24 14:52:43 2013 +1100
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Thu Feb 28 13:08:35 2013 -0500
----------------------------------------------------------------------
CordovaLib/Classes/CDVFileTransfer.m | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/227452b1/CordovaLib/Classes/CDVFileTransfer.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVFileTransfer.m b/CordovaLib/Classes/CDVFileTransfer.m
index 4ccdce6..bfa41f0 100644
--- a/CordovaLib/Classes/CDVFileTransfer.m
+++ b/CordovaLib/Classes/CDVFileTransfer.m
@@ -352,6 +352,7 @@ static CFIndex WriteDataToStream(NSData* data, CFWriteStreamRef stream)
NSString* filePath = [command.arguments objectAtIndex:1];
BOOL trustAllHosts = [[command.arguments objectAtIndex:2 withDefault:[NSNumber numberWithBool:YES]] boolValue]; // allow self-signed certs
NSString* objectId = [command.arguments objectAtIndex:3];
+ NSDictionary* headers = [command.arguments objectAtIndex:4 withDefault:nil];
// return unsupported result for assets-library URLs
if ([filePath hasPrefix:kCDVAssetsLibraryPrefix]) {
@@ -388,7 +389,7 @@ static CFIndex WriteDataToStream(NSData* data, CFWriteStreamRef stream)
}
NSMutableURLRequest* req = [NSMutableURLRequest requestWithURL:url];
- [self applyRequestHeaders:nil toRequest:req];
+ [self applyRequestHeaders:headers toRequest:req];
CDVFileTransferDelegate* delegate = [[CDVFileTransferDelegate alloc] init];
delegate.command = self;