diff --git a/AFNetworking/AFHTTPClient.h b/AFNetworking/AFHTTPClient.h index 0ede582..f866ab0 100644 --- a/AFNetworking/AFHTTPClient.h +++ b/AFNetworking/AFHTTPClient.h @@ -146,9 +146,11 @@ typedef enum { #endif /** - The flag to determine if each `AFHTTPRequestOperation` that is created in `HTTPRequestOperationWithRequest` should accept an invalid SSL certificate. If `_AFNETWORKING_ALLOW_INVALID_SSL_CERTIFICATES_` is set, this property defaults to YES for backwards compatibility support. Otherwise, this property defaults to NO. + Whether each `AFHTTPRequestOperation` that is created in `HTTPRequestOperationWithRequest` should accept an invalid SSL certificate. + + If `_AFNETWORKING_ALLOW_INVALID_SSL_CERTIFICATES_` is set, this property defaults to `YES` for backwards compatibility. Otherwise, this property defaults to `NO`. */ -@property (nonatomic,assign) BOOL allowInvalidSSLCertificate; +@property (nonatomic,assign) BOOL allowsInvalidSSLCertificate; ///--------------------------------------------- /// @name Creating and Initializing HTTP Clients diff --git a/AFNetworking/AFHTTPClient.m b/AFNetworking/AFHTTPClient.m index 35cdcd7..b745847 100644 --- a/AFNetworking/AFHTTPClient.m +++ b/AFNetworking/AFHTTPClient.m @@ -263,9 +263,9 @@ NSArray * AFQueryStringPairsFromKeyAndValue(NSString *key, id value) { self.operationQueue = [[NSOperationQueue alloc] init]; [self.operationQueue setMaxConcurrentOperationCount:NSOperationQueueDefaultMaxConcurrentOperationCount]; - //This ifdef has been added for backwards compatibility purposes + // #ifdef included for backwards-compatibility #ifdef _AFNETWORKING_ALLOW_INVALID_SSL_CERTIFICATES_ - self.allowInvalidSSLCertificate = YES; + self.allowsInvalidSSLCertificate = YES; #endif return self; @@ -541,7 +541,7 @@ static void AFNetworkReachabilityReleaseCallback(const void *info) { #ifdef _AFNETWORKING_PIN_SSL_CERTIFICATES_ operation.SSLPinningMode = self.defaultSSLPinningMode; #endif - operation.allowInvalidSSLCertificate = self.allowInvalidSSLCertificate; + operation.allowsInvalidSSLCertificate = self.allowsInvalidSSLCertificate; return operation; } diff --git a/AFNetworking/AFURLConnectionOperation.h b/AFNetworking/AFURLConnectionOperation.h index 523f5e6..6898e4c 100644 --- a/AFNetworking/AFURLConnectionOperation.h +++ b/AFNetworking/AFURLConnectionOperation.h @@ -132,7 +132,7 @@ NSCoding, NSCopying> If `_AFNETWORKING_ALLOW_INVALID_SSL_CERTIFICATES_` is set, this property defaults to `YES` for backwards compatibility. Otherwise, this property defaults to `NO`. */ -@property (nonatomic, assign) BOOL allowInvalidSSLCertificate; +@property (nonatomic, assign) BOOL allowsInvalidSSLCertificate; ///---------------------------- /// @name Getting Response Data @@ -287,7 +287,7 @@ NSCoding, NSCopying> @param block A block object to be executed to determine whether the connection should be able to respond to a protection space's form of authentication. The block has a `BOOL` return type and takes two arguments: the URL connection object, and the protection space to authenticate against. - If `allowInvalidSSLCertificate` is set to YES, `connection:canAuthenticateAgainstProtectionSpace:` will accept invalid SSL certificates, returning `YES` if the protection space authentication method is `NSURLAuthenticationMethodServerTrust`. + If `allowsInvalidSSLCertificate` is set to YES, `connection:canAuthenticateAgainstProtectionSpace:` will accept invalid SSL certificates, returning `YES` if the protection space authentication method is `NSURLAuthenticationMethodServerTrust`. */ - (void)setAuthenticationAgainstProtectionSpaceBlock:(BOOL (^)(NSURLConnection *connection, NSURLProtectionSpace *protectionSpace))block; @@ -296,7 +296,7 @@ NSCoding, NSCopying> @param block A block object to be executed when the connection must authenticate a challenge in order to download its request. The block has no return type and takes two arguments: the URL connection object, and the challenge that must be authenticated. - If `allowInvalidSSLCertificate` is set to YES, `connection:didReceiveAuthenticationChallenge:` will attempt to have the challenge sender use credentials with invalid SSL certificates. + If `allowsInvalidSSLCertificate` is set to YES, `connection:didReceiveAuthenticationChallenge:` will attempt to have the challenge sender use credentials with invalid SSL certificates. */ - (void)setAuthenticationChallengeBlock:(void (^)(NSURLConnection *connection, NSURLAuthenticationChallenge *challenge))block; diff --git a/AFNetworking/AFURLConnectionOperation.m b/AFNetworking/AFURLConnectionOperation.m index 395cd1a..f3c0020 100644 --- a/AFNetworking/AFURLConnectionOperation.m +++ b/AFNetworking/AFURLConnectionOperation.m @@ -260,7 +260,7 @@ static inline BOOL AFStateTransitionIsValid(AFOperationState fromState, AFOperat // #ifdef included for backwards-compatibility #ifdef _AFNETWORKING_ALLOW_INVALID_SSL_CERTIFICATES_ - self.allowInvalidSSLCertificate = YES; + self.allowsInvalidSSLCertificate = YES; #endif return self; @@ -611,7 +611,7 @@ willSendRequestForAuthenticationChallenge:(NSURLAuthenticationChallenge *)challe break; } case AFSSLPinningModeNone: { - if (self.allowInvalidSSLCertificate){ + if (self.allowsInvalidSSLCertificate){ NSURLCredential *credential = [NSURLCredential credentialForTrust:serverTrust]; [[challenge sender] useCredential:credential forAuthenticationChallenge:challenge]; } else { @@ -637,7 +637,7 @@ willSendRequestForAuthenticationChallenge:(NSURLAuthenticationChallenge *)challe - (BOOL)connection:(NSURLConnection *)connection canAuthenticateAgainstProtectionSpace:(NSURLProtectionSpace *)protectionSpace { - if(self.allowInvalidSSLCertificate == YES && + if(self.allowsInvalidSSLCertificate == YES && [protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust]) { return YES; } @@ -655,7 +655,7 @@ canAuthenticateAgainstProtectionSpace:(NSURLProtectionSpace *)protectionSpace didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge { - if (self.allowInvalidSSLCertificate + if (self.allowsInvalidSSLCertificate && [challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust]) { [challenge.sender useCredential:[NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust] forAuthenticationChallenge:challenge]; return; @@ -808,7 +808,7 @@ didReceiveResponse:(NSURLResponse *)response self.error = [aDecoder decodeObjectForKey:@"error"]; self.responseData = [aDecoder decodeObjectForKey:@"responseData"]; self.totalBytesRead = [[aDecoder decodeObjectForKey:@"totalBytesRead"] longLongValue]; - self.allowInvalidSSLCertificate = [[aDecoder decodeObjectForKey:@"allowInvalidSSLCertificate"] boolValue]; + self.allowsInvalidSSLCertificate = [[aDecoder decodeObjectForKey:@"allowsInvalidSSLCertificate"] boolValue]; return self; } @@ -833,7 +833,7 @@ didReceiveResponse:(NSURLResponse *)response [aCoder encodeObject:self.error forKey:@"error"]; [aCoder encodeObject:self.responseData forKey:@"responseData"]; [aCoder encodeObject:[NSNumber numberWithLongLong:self.totalBytesRead] forKey:@"totalBytesRead"]; - [aCoder encodeObject:[NSNumber numberWithBool:self.allowInvalidSSLCertificate] forKey:@"allowInvalidSSLCertificate"]; + [aCoder encodeObject:[NSNumber numberWithBool:self.allowsInvalidSSLCertificate] forKey:@"allowsInvalidSSLCertificate"]; } #pragma mark - NSCopying @@ -847,7 +847,7 @@ didReceiveResponse:(NSURLResponse *)response operation.authenticationChallenge = self.authenticationChallenge; operation.cacheResponse = self.cacheResponse; operation.redirectResponse = self.redirectResponse; - operation.allowInvalidSSLCertificate = self.allowInvalidSSLCertificate; + operation.allowsInvalidSSLCertificate = self.allowsInvalidSSLCertificate; return operation; }