ASIHttpRequest ignores setValidatesSecureCertifica

2019-06-27 11:36发布

问题:

Can ASIHTTPRequest ignore 'setValidatesSecureCertificate' parameter under certain conditions ?

If i do this:

NSURL *url = [NSURL URLWithString:@"https://someselfsignedurl"];

ASIHTTPRequest *r = [[[ASIHTTPRequest alloc] initWithURL:url] autorelease];
[r setValidatesSecureCertificate:YES];
[r startSynchronous]; 

// Should not work:
NSLog(@"Result: %@", [r error] ? [[r error] description] : [r responseString]);

i've got the expected behaviour, i.e. a NSError telling the certificate is self-signed and a null response.

However, in some other part of my source, the exactly same code seems to ignore validation and actually gets result instead of returning a SSL error.

Could any "global" configuration done, in a third-party library or instance, interact with SSL validation in anyway ?

回答1:

Ok, it is a bug, apparently from CFNetwork.

Fixed it, see here on GitHub: https://github.com/pokeb/asi-http-request/issues/263