Inject NSAppTransportSecurity key and value into [NSBundle mainBundle]'s infoDictionary in order to make App Transport Security happy on 10.11

This commit is contained in:
Greg Neagle
2015-07-29 08:09:39 -07:00
parent 441e649288
commit 1dd8329d66

View File

@@ -31,6 +31,7 @@ from objc import super
# PyLint cannot properly find names inside Cocoa libraries, so issues bogus
# No name 'Foo' in module 'Bar' warnings. Disable them.
# pylint: disable=E0611
from Foundation import NSBundle
from Foundation import NSRunLoop, NSDate
from Foundation import NSObject, NSURL, NSURLConnection
from Foundation import NSMutableURLRequest
@@ -46,6 +47,14 @@ from Foundation import NSPropertyListXMLFormat_v1_0
# Disable PyLint complaining about 'invalid' names
# pylint: disable=C0103
# disturbing hack warning!
# this works around an issue with App Transport Security on 10.11
bundle = NSBundle.mainBundle()
info = bundle.localizedInfoDictionary() or bundle.infoDictionary()
info['NSAppTransportSecurity'] = {'NSAllowsArbitraryLoads': True}
ssl_error_codes = {
-9800: u'SSL protocol error',
-9801: u'Cipher Suite negotiation failure',