When I load an url like this:
NSURL *downloadURL = [NSURL URLWithString:@"http://www.apple.com"];
NSURLRequest *request = [NSURLRequest requestWithURL:downloadURL cachePolicy:NSURLRequestReloadIgnoringLocalCacheData timeoutInterval:60];
self.task = [session dataTaskWithRequest:request completionHandler:^(NSData * data, NSURLResponse * response, NSError * error) {
// more code
}];
[self.task resume];
The value of the error argument in the callback block is always like:
Error Domain=NSURLErrorDomain Code=-1200 "An SSL error has occurred and a secure connection to the server cannot be made." UserInfo=0x7a77f6e0 {NSErrorFailingURLStringKey=https://www.apple.com/, NSLocalizedRecoverySuggestion=Would you like to connect to the server anyway?, NSErrorFailingURLKey=https://www.apple.com/, NSLocalizedDescription=An SSL error has occurred and a secure connection to the server cannot be made., _kCFStreamErrorDomainKey=3, _kCFStreamErrorCodeKey=-9824}
It seems even I requested the http resource, it always hit the https resource instead.
I did have capture the network traffic to see what is alctually going on, and I notice that every time I initiate a GET request to http://www.apple.com, it just internally do a "CONNECT www.apple.com:443" proxy request.
Has anyone ever run into this issue?