Re: NSURLConnection and https
Re: NSURLConnection and https
- Subject: Re: NSURLConnection and https
- From: Dominik Pich <email@hidden>
- Date: Mon, 22 Jan 2007 18:23:07 +0100
Hack NSUrlConnection
//ugly hack to allow ANY certificate for upload
@implementation NSURLRequest(NSHTTPURLRequest)
+ (BOOL)allowsAnyHTTPSCertificateForHost:(NSString *)host
{
return YES; // Or whatever logic
}
@end
------
You could display some dialog there...
Regards,
Dominik
Am Jan 22, 2007 um 12:48 PM schrieb Julio Cesar Silva dos Santos:
The documentation says that after receiving this message, there
will be no further messages from the connection but take a look at
NSURLAuthenticationChallenge. My guess is that it can handle this
type of situation, although I have never played with it.
Julio Cesar Silva dos Santos
email@hidden
email@hidden
Blogjective-C
http://www.jcs.santos.nom.br/wp
FetchYourLyrics
http://www.jcs.santos.nom.br/fyl/fyl.html
On 22/01/2007, at 09:31, Lesin, Vladislav wrote:
Thanks. But what should I do if user does want to continue loading?
-----Original Message-----
From: cocoa-dev-bounces+vlesin=email@hidden
[mailto:cocoa-dev-bounces+vlesin=email@hidden] On
Behalf
Of Julio Cesar Silva dos Santos
Sent: Monday, January 22, 2007 2:16 PM
To: Cocoa-Dev
Subject: Re: NSURLConnection and https
If your main class is the delegate of NSURLConnection, simply
implement connection:didFailWithError: to override the default
behaviour and present a custom dialog box.
Julio Cesar Silva dos Santos
email@hidden
email@hidden
Blogjective-C
http://www.jcs.santos.nom.br/wp
FetchYourLyrics
http://www.jcs.santos.nom.br/fyl/fyl.html
On 22/01/2007, at 08:56, Lesin, Vladislav wrote:
Hi all
I am loading links with NSURLConnection. I do this by setting
up an
instance of NSURLRequest.
The problem I have occurs under the following situation:
1) The NSURL in question is "https://" (secure)
2) The cert can't be validated
What is occurring is that the NSURLConnection promptly calls its
delegate function:
connection:didFailWithError:
The NSError is filled with
Error = "bad server certificate"
Domain = NSURLErrorDomain
Code = -1203
UserInfo =
NSErrorFailingURLKey = <url>
NSErrorFailingURLStringKey = <url>
NSLocalizedDescription = "bad server certificate"
Now, what I want is a chance to present the user with "Certificate
can't be validated, do you wish to proceed?" But I have no idea
how to
recover from this or intercept the cert or anything.
How to use NSURLConnection to get data from HTTPS server with a
self-signed/unknown certificate?
Thanks!
Best regards
Vlad
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden