Minor refactoring / renaming / copy edits
This commit is contained in:
parent
8ea42866b8
commit
174bc47c84
2 changed files with 9 additions and 9 deletions
|
|
@ -128,9 +128,11 @@ NSCoding, NSCopying>
|
|||
@property (readonly, nonatomic, strong) NSError *error;
|
||||
|
||||
/**
|
||||
The flag to determine if the connection 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 the connection 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 allowInvalidSSLCertificate;
|
||||
|
||||
///----------------------------
|
||||
/// @name Getting Response Data
|
||||
|
|
|
|||
|
|
@ -258,7 +258,7 @@ static inline BOOL AFStateTransitionIsValid(AFOperationState fromState, AFOperat
|
|||
|
||||
self.state = AFOperationReadyState;
|
||||
|
||||
//This ifdef has been added for backwards compatibility purposes
|
||||
// #ifdef included for backwards-compatibility
|
||||
#ifdef _AFNETWORKING_ALLOW_INVALID_SSL_CERTIFICATES_
|
||||
self.allowInvalidSSLCertificate = YES;
|
||||
#endif
|
||||
|
|
@ -611,11 +611,10 @@ willSendRequestForAuthenticationChallenge:(NSURLAuthenticationChallenge *)challe
|
|||
break;
|
||||
}
|
||||
case AFSSLPinningModeNone: {
|
||||
if(self.allowInvalidSSLCertificate == YES){
|
||||
if (self.allowInvalidSSLCertificate){
|
||||
NSURLCredential *credential = [NSURLCredential credentialForTrust:serverTrust];
|
||||
[[challenge sender] useCredential:credential forAuthenticationChallenge:challenge];
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
SecTrustResultType result = 0;
|
||||
OSStatus status = SecTrustEvaluate(serverTrust, &result);
|
||||
NSAssert(status == errSecSuccess, @"SecTrustEvaluate error: %ld", (long int)status);
|
||||
|
|
@ -656,13 +655,12 @@ canAuthenticateAgainstProtectionSpace:(NSURLProtectionSpace *)protectionSpace
|
|||
didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge
|
||||
{
|
||||
|
||||
if(self.allowInvalidSSLCertificate == YES
|
||||
if (self.allowInvalidSSLCertificate
|
||||
&& [challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust]) {
|
||||
[challenge.sender useCredential:[NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust] forAuthenticationChallenge:challenge];
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (self.authenticationChallenge) {
|
||||
self.authenticationChallenge(connection, challenge);
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue