From 74346addea29b0ed1a35dc5657858660df565e74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ce=CC=81dric=20Luthi?= Date: Fri, 18 Jan 2013 15:06:14 +0100 Subject: [PATCH 1/2] Use NSURL methods instead of CFURL functions * Replace CFURLCopyUserName with -[NSURL user] * Replace CFURLCopyPassword with -[NSURL password] --- AFNetworking/AFURLConnectionOperation.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/AFNetworking/AFURLConnectionOperation.m b/AFNetworking/AFURLConnectionOperation.m index 17c98c9..fa4b488 100644 --- a/AFNetworking/AFURLConnectionOperation.m +++ b/AFNetworking/AFURLConnectionOperation.m @@ -550,8 +550,8 @@ didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge if ([challenge previousFailureCount] == 0) { NSURLCredential *credential = nil; - NSString *username = (__bridge_transfer NSString *)CFURLCopyUserName((__bridge CFURLRef)[self.request URL]); - NSString *password = (__bridge_transfer NSString *)CFURLCopyPassword((__bridge CFURLRef)[self.request URL]); + NSString *username = [[self.request URL] user]; + NSString *password = [[self.request URL] password]; if (username && password) { credential = [NSURLCredential credentialWithUser:username password:password persistence:NSURLCredentialPersistenceNone]; From 7abc97881e66b7846d1262877efa523ccdb740eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ce=CC=81dric=20Luthi?= Date: Fri, 18 Jan 2013 15:08:29 +0100 Subject: [PATCH 2/2] Rename the `username` variable to `user` --- AFNetworking/AFURLConnectionOperation.m | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/AFNetworking/AFURLConnectionOperation.m b/AFNetworking/AFURLConnectionOperation.m index fa4b488..8c4edf2 100644 --- a/AFNetworking/AFURLConnectionOperation.m +++ b/AFNetworking/AFURLConnectionOperation.m @@ -550,13 +550,13 @@ didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge if ([challenge previousFailureCount] == 0) { NSURLCredential *credential = nil; - NSString *username = [[self.request URL] user]; + NSString *user = [[self.request URL] user]; NSString *password = [[self.request URL] password]; - if (username && password) { - credential = [NSURLCredential credentialWithUser:username password:password persistence:NSURLCredentialPersistenceNone]; - } else if (username) { - credential = [[[NSURLCredentialStorage sharedCredentialStorage] credentialsForProtectionSpace:[challenge protectionSpace]] objectForKey:username]; + if (user && password) { + credential = [NSURLCredential credentialWithUser:user password:password persistence:NSURLCredentialPersistenceNone]; + } else if (user) { + credential = [[[NSURLCredentialStorage sharedCredentialStorage] credentialsForProtectionSpace:[challenge protectionSpace]] objectForKey:user]; } else { credential = [[NSURLCredentialStorage sharedCredentialStorage] defaultCredentialForProtectionSpace:[challenge protectionSpace]]; }