Skip to content
This repository has been archived by the owner on Jun 2, 2018. It is now read-only.

NSURLConnection+BlocksKit problem with HTTPS on iOS 5 #48

Closed
bwhiteley opened this issue Dec 15, 2011 · 2 comments
Closed

NSURLConnection+BlocksKit problem with HTTPS on iOS 5 #48

bwhiteley opened this issue Dec 15, 2011 · 2 comments

Comments

@bwhiteley
Copy link

When starting several HTTPS connections simultaneously, the first two or three will succeed, and the rest will fail with connection timeout errors.

This only happens with HTTPS and iOS 5. The problem does not happen with HTTPS on iOS 4, or with HTTP on iOS 5.

The behavior is the same whether I use the iOS simulator and connect to a server on the local LAN, or if I use a device and connect to a server across the Internet.

@zwaldowski
Copy link
Collaborator

I expected this would happen. iOS 5 now has a formal protocol for
NSURLConnection, and implements new methods as well. Make sure you're
implementing all the new authentication methods in iOS 5. It may still
be a BlocksKit problem, but make sure
first.

@bwhiteley
Copy link
Author

I did have the new authentication delegate method implemented, but it had a problem.

Here is a patch to restore the default behavior if a delegate doesn't implement the new method:

--- NSURLConnection+BlocksKit.m.orig 2011-12-15 14:12:26.000000000 -0700
+++ NSURLConnection+BlocksKit.m 2011-12-15 13:57:12.000000000 -0700
@@ -42,6 +42,8 @@
 - (void)connection:(NSURLConnection *)connection willSendRequestForAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge {
     if (connection.delegate && [connection.delegate respondsToSelector:@selector(connection:willSendRequestForAuthenticationChallenge:)])
         [connection.delegate connection:connection willSendRequestForAuthenticationChallenge:challenge];
+    else 
+        [challenge.sender performDefaultHandlingForAuthenticationChallenge:challenge]; 
 }

zwaldowski added a commit that referenced this issue Dec 16, 2011
…r to fix HTTPS on iOS 5. Fixes issue #48. Huge thanks to bwhitely!

Signed-off-by: zwaldowski@gmail.com <zwaldowski@gmail.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants