cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agri...@apache.org
Subject ios commit: [CB-861] Header support for FileTransfer download
Date Thu, 28 Feb 2013 18:09:27 GMT
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 <tommy@devgeeks.org>
Authored: Sun Feb 24 14:52:43 2013 +1100
Committer: Andrew Grieve <agrieve@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;


Mime
View raw message