Skip to content

Instantly share code, notes, and snippets.

@snej
Created March 29, 2013 21:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save snej/5273827 to your computer and use it in GitHub Desktop.
Save snej/5273827 to your computer and use it in GitHub Desktop.
Patch to log credential lookup in TouchDB.
diff --git a/MYURLUtils.m b/MYURLUtils.m
index 2e3e333..db9b514 100644
--- a/MYURLUtils.m
+++ b/MYURLUtils.m
@@ -63,10 +63,14 @@
NSURLProtectionSpace* space = [self my_protectionSpaceWithRealm: realm
authenticationMethod: authenticationMethod];
NSURLCredentialStorage* storage = [NSURLCredentialStorage sharedCredentialStorage];
+ NSURLCredential* cred;
if (username)
- return [[storage credentialsForProtectionSpace: space] objectForKey: username];
+ cred = [[storage credentialsForProtectionSpace: space] objectForKey: username];
else
- return [storage defaultCredentialForProtectionSpace: space];
+ cred = [storage defaultCredentialForProtectionSpace: space];
+ Log(@"*** my_credentialForRealm: URL=<%@>, realm='%@', method=%@ --> %@",
+ self.absoluteString, realm, authenticationMethod, cred);
+ return cred;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment