Merge branch 'master' of github.com:AFNetworking/AFNetworking
This commit is contained in:
commit
13cb42e00d
1 changed files with 6 additions and 6 deletions
|
|
@ -550,13 +550,13 @@ didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge
|
||||||
if ([challenge previousFailureCount] == 0) {
|
if ([challenge previousFailureCount] == 0) {
|
||||||
NSURLCredential *credential = nil;
|
NSURLCredential *credential = nil;
|
||||||
|
|
||||||
NSString *username = (__bridge_transfer NSString *)CFURLCopyUserName((__bridge CFURLRef)[self.request URL]);
|
NSString *user = [[self.request URL] user];
|
||||||
NSString *password = (__bridge_transfer NSString *)CFURLCopyPassword((__bridge CFURLRef)[self.request URL]);
|
NSString *password = [[self.request URL] password];
|
||||||
|
|
||||||
if (username && password) {
|
if (user && password) {
|
||||||
credential = [NSURLCredential credentialWithUser:username password:password persistence:NSURLCredentialPersistenceNone];
|
credential = [NSURLCredential credentialWithUser:user password:password persistence:NSURLCredentialPersistenceNone];
|
||||||
} else if (username) {
|
} else if (user) {
|
||||||
credential = [[[NSURLCredentialStorage sharedCredentialStorage] credentialsForProtectionSpace:[challenge protectionSpace]] objectForKey:username];
|
credential = [[[NSURLCredentialStorage sharedCredentialStorage] credentialsForProtectionSpace:[challenge protectionSpace]] objectForKey:user];
|
||||||
} else {
|
} else {
|
||||||
credential = [[NSURLCredentialStorage sharedCredentialStorage] defaultCredentialForProtectionSpace:[challenge protectionSpace]];
|
credential = [[NSURLCredentialStorage sharedCredentialStorage] defaultCredentialForProtectionSpace:[challenge protectionSpace]];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue