Use certifi on MacOS
Python 3.6 does not use the MacOS cert store anymore
This commit is contained in:
parent
5e712768cf
commit
395d24bee6
|
@ -33,6 +33,7 @@
|
|||
##
|
||||
|
||||
import os
|
||||
import sys
|
||||
import random
|
||||
import socket
|
||||
import operator
|
||||
|
@ -49,7 +50,7 @@ from string import Template
|
|||
from urllib.request import urlopen
|
||||
from urllib.error import URLError
|
||||
|
||||
if os.name == 'nt':
|
||||
if sys.platform in ('win32', 'darwin'):
|
||||
import certifi
|
||||
import OpenSSL.crypto
|
||||
import nbxmpp
|
||||
|
@ -1175,7 +1176,7 @@ class Connection(CommonConnection, ConnectionHandlers):
|
|||
port = self._current_host['port']
|
||||
|
||||
cacerts = ''
|
||||
if os.name == 'nt':
|
||||
if sys.platform in ('win32', 'darwin'):
|
||||
cacerts = certifi.where()
|
||||
mycerts = common.configpaths.get('MY_CACERTS')
|
||||
tls_version = app.config.get_per('accounts', self.name, 'tls_version')
|
||||
|
@ -1374,7 +1375,7 @@ class Connection(CommonConnection, ConnectionHandlers):
|
|||
url = 'https://%s/.well-known/posh/xmpp-client.json' % hostname
|
||||
|
||||
cafile = None
|
||||
if os.name == 'nt':
|
||||
if sys.platform in ('win32', 'darwin'):
|
||||
cafile = certifi.where()
|
||||
|
||||
log.info('Request POSH from %s', url)
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
# along with Gajim. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import os
|
||||
import sys
|
||||
import threading
|
||||
import ssl
|
||||
import urllib
|
||||
|
@ -35,7 +36,7 @@ from gajim.common.connection_handlers_events import HTTPUploadProgressEvent
|
|||
from gajim.common.connection_handlers_events import MessageOutgoingEvent
|
||||
from gajim.common.connection_handlers_events import GcMessageOutgoingEvent
|
||||
|
||||
if os.name == 'nt':
|
||||
if sys.platform in ('win32', 'darwin'):
|
||||
import certifi
|
||||
|
||||
log = logging.getLogger('gajim.c.httpupload')
|
||||
|
@ -300,7 +301,7 @@ class ConnectionHTTPUpload:
|
|||
log.warning('CERT Verification disabled')
|
||||
transfer = urlopen(request, timeout=30, context=context)
|
||||
else:
|
||||
if os.name == 'nt':
|
||||
if sys.platform in ('win32', 'darwin'):
|
||||
transfer = urlopen(
|
||||
request, cafile=certifi.where(), timeout=30)
|
||||
else:
|
||||
|
|
Loading…
Reference in New Issue