[Issue #942] [Issue #943] Don't attempt to use URL-encoded credentials in connection:didReceiveAuthenticationChallenge:, since any included credentials would have to be invalid to have an authentication challenge be issued
Signed-off-by: Mattt Thompson <m@mattt.me>
This commit is contained in:
parent
df51831c15
commit
6f6c888055
1 changed files with 2 additions and 19 deletions
|
|
@ -668,25 +668,8 @@ didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge
|
|||
self.authenticationChallenge(connection, challenge);
|
||||
} else {
|
||||
if ([challenge previousFailureCount] == 0) {
|
||||
NSURLCredential *credential = nil;
|
||||
|
||||
NSString *user = [[self.request URL] user];
|
||||
NSString *password = [[self.request URL] password];
|
||||
|
||||
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]];
|
||||
}
|
||||
|
||||
if (!credential) {
|
||||
credential = self.credential;
|
||||
}
|
||||
|
||||
if (credential) {
|
||||
[[challenge sender] useCredential:credential forAuthenticationChallenge:challenge];
|
||||
if (self.credential) {
|
||||
[[challenge sender] useCredential:self.credential forAuthenticationChallenge:challenge];
|
||||
} else {
|
||||
[[challenge sender] continueWithoutCredentialForAuthenticationChallenge:challenge];
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue