cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shaz...@apache.org
Subject ios commit: CB-7631 - CDVUrlProtocol - the iOS 8 NSHttpUrlResponse is not initialized with the statuscode
Date Wed, 24 Sep 2014 22:53:23 GMT
Repository: cordova-ios
Updated Branches:
  refs/heads/master b06ca8db4 -> 6329027c4


CB-7631 - CDVUrlProtocol - the iOS 8 NSHttpUrlResponse is not initialized with the statuscode


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

Branch: refs/heads/master
Commit: 6329027c4a35d18d85dcc5bcd0ee3a6d34fe2421
Parents: b06ca8d
Author: Shazron Abdullah <shazron@apache.org>
Authored: Wed Sep 24 15:53:30 2014 -0700
Committer: Shazron Abdullah <shazron@apache.org>
Committed: Wed Sep 24 15:53:30 2014 -0700

----------------------------------------------------------------------
 CordovaLib/Classes/CDVURLProtocol.m | 32 +-------------------------------
 1 file changed, 1 insertion(+), 31 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/6329027c/CordovaLib/Classes/CDVURLProtocol.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVURLProtocol.m b/CordovaLib/Classes/CDVURLProtocol.m
index 3ecb6a0..fce5783 100644
--- a/CordovaLib/Classes/CDVURLProtocol.m
+++ b/CordovaLib/Classes/CDVURLProtocol.m
@@ -26,12 +26,6 @@
 #import "CDVWhitelist.h"
 #import "CDVViewController.h"
 
-@interface CDVHTTPURLResponse : NSHTTPURLResponse
-#ifndef __IPHONE_8_0
-                                    @property (nonatomic) NSInteger statusCode;
-#endif
-@end
-
 static CDVWhitelist* gWhitelist = nil;
 // Contains a set of NSNumbers of addresses of controllers. It doesn't store
 // the actual pointer to avoid retaining.
@@ -206,22 +200,8 @@ static CDVViewController *viewControllerForRequest(NSURLRequest* request)
     if (mimeType == nil) {
         mimeType = @"text/plain";
     }
-    NSString* encodingName = [@"text/plain" isEqualToString : mimeType] ? @"UTF-8" : nil;
-
-#ifdef __IPHONE_8_0
-        NSHTTPURLResponse* response = [NSHTTPURLResponse alloc];
-#else
-        CDVHTTPURLResponse* response = [CDVHTTPURLResponse alloc];
-#endif
 
-    response = [response initWithURL:[[self request] URL]
-                            MIMEType:mimeType
-               expectedContentLength:[data length]
-                    textEncodingName:encodingName];
-
-#ifndef __IPHONE_8_0
-        response.statusCode = statusCode;
-#endif
+    NSHTTPURLResponse* response = [[NSHTTPURLResponse alloc] initWithURL:[[self request]
URL] statusCode:statusCode HTTPVersion:@"HTTP/1.1" headerFields:@{@"Content-Type" : mimeType}];
 
     [[self client] URLProtocol:self didReceiveResponse:response cacheStoragePolicy:NSURLCacheStorageNotAllowed];
     if (data != nil) {
@@ -231,13 +211,3 @@ static CDVViewController *viewControllerForRequest(NSURLRequest* request)
 }
 
 @end
-
-@implementation CDVHTTPURLResponse
-@synthesize statusCode;
-
-- (NSDictionary*)allHeaderFields
-{
-    return nil;
-}
-
-@end


Mime
View raw message