• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSURLConnection and https
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Re: NSURLConnection and https (From: Julio Cesar Silva dos Santos <email@hidden>)

  • Prev by Date: Re: adding plist file in /Library/LaunchAgents...
  • Next by Date: Re: Regarding launching an application at startup of mac.
  • Previous by thread: Re: NSURLConnection and https
  • Next by thread: __MyCompanyName__ again ...
  • Index(es):
    • Date
    • Thread