Re: SSL NSURLConnection to fake-cert server?

2012-03-20 Thread Jens Alfke

On Mar 20, 2012, at 11:16 AM, Rick Mann wrote:

> I had written a fairly elaborate wrapper around the delegate-based API so I 
> could use blocks in a way similar to what the new call provides.
> It also returned the NSURLConnection object, and allowed canceling of a 
> request. But I always felt like it was messy and possibly contained bugs; I 
> was pretty happy to see Apple add their API (even if I couldn't use it to 
> cancel a request). I just wish they'd thought it through a bit more.

Yeah, I don’t think there’s a full equivalent of the delegate API yet. And if 
you think about it, there are a number of different calls to app code that the 
connection needs to make, so a block-based equivalent would have to have 
several different blocks you could configure for different tasks. At that point 
you’ve created the moral equivalent of a class anyway, as illuminated in the 
famous koan[1], so it seems cleaner to use a real class to express it.

—Jens

[1] http://people.csail.mit.edu/gregs/ll1-discuss-archive-html/msg03277.html


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: SSL NSURLConnection to fake-cert server?

2012-03-20 Thread Rick Mann

On Mar 20, 2012, at 10:53 , Jens Alfke wrote:

> 
> On Mar 19, 2012, at 10:16 PM, Rick Mann wrote:
> 
>> What do I need to do to? I'm using
>> -sendAsynchronousRequest:queue:completionHandler:
>> So I can't set a delegate.
> 
> If you want more control over credentials and certificate trust, you’ll need 
> to use the delegate API.

I had written a fairly elaborate wrapper around the delegate-based API so I 
could use blocks in a way similar to what the new call provides.

It also returned the NSURLConnection object, and allowed canceling of a 
request. But I always felt like it was messy and possibly contained bugs; I was 
pretty happy to see Apple add their API (even if I couldn't use it to cancel a 
request). I just wish they'd thought it through a bit more.

-- 
Rick


> 
> —Jens
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/rmann%40latencyzero.com
> 
> This email sent to rm...@latencyzero.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: SSL NSURLConnection to fake-cert server?

2012-03-20 Thread Jens Alfke

On Mar 19, 2012, at 10:16 PM, Rick Mann wrote:

> What do I need to do to? I'm using
> -sendAsynchronousRequest:queue:completionHandler:
> So I can't set a delegate.

If you want more control over credentials and certificate trust, you’ll need to 
use the delegate API.

—Jens

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: SSL NSURLConnection to fake-cert server?

2012-03-20 Thread Mike Abdullah


Sent from my iPad

On 20 Mar 2012, at 05:16 AM, Rick Mann  wrote:

> I'm connecting to my dev server which has a self-signed cert. When I do this, 
> NSURLConnection complains with:
> 
> NSLocalizedDescription = "An SSL error has occurred and a secure connection 
> to the server cannot be made.";
>NSLocalizedRecoverySuggestion = "Would you like to connect to the server 
> anyway?";
>NSUnderlyingError = "Error Domain=kCFErrorDomainCFNetwork Code=-1200 \"An 
> SSL error has occurred and a secure connection to the server cannot be 
> made.\" 
> 
> My answer is, "Yes!", but I don't know how to tell it.
> 
> What do I need to do to?

This error likely has a recovery attempted associated with it. You are supposed 
to use one of the -presentError:… methods to display it and let the user choose 
what to do.

> I'm using
> 
> -sendAsynchronousRequest:queue:completionHandler:
> 
> So I can't set a delegate.

Well you can. You could switch to using the delegate-based API.
> 
> -- 
> Rick
> 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/cocoadev%40mikeabdullah.net
> 
> This email sent to cocoa...@mikeabdullah.net

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: SSL NSURLConnection to fake-cert server?

2012-03-19 Thread Conrad Shultz
There's probably a way to do this on a per-connection basis, but the easiest 
workaround is to install your signing certificate on the device. 

I usually just email my certificate to myself. Mobile Mail understands 
certificate attachments and will prompt for installation permission. 

Note that this will cause certs signed by your signing cert to be accepted 
system-wide. 

(Sent from my iPhone.)

--
Conrad Shultz

On Mar 19, 2012, at 22:16, Rick Mann  wrote:

> I'm connecting to my dev server which has a self-signed cert. When I do this, 
> NSURLConnection complains with:
> 
> NSLocalizedDescription = "An SSL error has occurred and a secure connection 
> to the server cannot be made.";
>NSLocalizedRecoverySuggestion = "Would you like to connect to the server 
> anyway?";
>NSUnderlyingError = "Error Domain=kCFErrorDomainCFNetwork Code=-1200 \"An 
> SSL error has occurred and a secure connection to the server cannot be 
> made.\" 
> 
> My answer is, "Yes!", but I don't know how to tell it.
> 
> What do I need to do to? I'm using
> 
> -sendAsynchronousRequest:queue:completionHandler:
> 
> So I can't set a delegate.
> 
> -- 
> Rick
> 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/conrad%40synthetiqsolutions.com
> 
> This email sent to con...@synthetiqsolutions.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


SSL NSURLConnection to fake-cert server?

2012-03-19 Thread Rick Mann
I'm connecting to my dev server which has a self-signed cert. When I do this, 
NSURLConnection complains with:

NSLocalizedDescription = "An SSL error has occurred and a secure connection to 
the server cannot be made.";
NSLocalizedRecoverySuggestion = "Would you like to connect to the server 
anyway?";
NSUnderlyingError = "Error Domain=kCFErrorDomainCFNetwork Code=-1200 \"An 
SSL error has occurred and a secure connection to the server cannot be made.\" 

My answer is, "Yes!", but I don't know how to tell it.

What do I need to do to? I'm using

-sendAsynchronousRequest:queue:completionHandler:

So I can't set a delegate.

-- 
Rick


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com