Updated Branches:
  refs/heads/master 994e23435 -> 70d5b149c

CB-1600 check class before casting URLResponse


Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/commit/70d5b149
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/tree/70d5b149
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/diff/70d5b149

Branch: refs/heads/master
Commit: 70d5b149c7524adbb7d163ee02e2e54c9584c59e
Parents: 994e234
Author: Patrick Mueller <pmue...@apache.org>
Authored: Tue Oct 9 19:25:49 2012 -0400
Committer: Patrick Mueller <pmue...@apache.org>
Committed: Tue Oct 9 19:26:48 2012 -0400

----------------------------------------------------------------------
 CordovaLib/Classes/CDVFileTransfer.m |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/70d5b149/CordovaLib/Classes/CDVFileTransfer.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVFileTransfer.m 
b/CordovaLib/Classes/CDVFileTransfer.m
index 5fd3fb5..15045f6 100644
--- a/CordovaLib/Classes/CDVFileTransfer.m
+++ b/CordovaLib/Classes/CDVFileTransfer.m
@@ -476,6 +476,14 @@ static CFIndex WriteDataToStream(NSData* data, 
CFWriteStreamRef stream)
 
 - (void)connection:(NSURLConnection*)connection 
didReceiveResponse:(NSURLResponse*)response
 {
+    // required for iOS 4.3, for some reason; response is
+    // a plain NSURLResponse, not the HTTP subclass
+    if (![response isKindOfClass:[NSHTTPURLResponse class]]) {
+        self.responseCode = 403;
+        self.bytesExpected = [response expectedContentLength];
+        return;
+    }
+
     NSHTTPURLResponse* httpResponse = (NSHTTPURLResponse*)response;
 
     self.responseCode = [httpResponse statusCode];

Reply via email to