diff --git a/gajim/common/connection.py b/gajim/common/connection.py index 5884ce9a0..c8afae4b3 100644 --- a/gajim/common/connection.py +++ b/gajim/common/connection.py @@ -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) diff --git a/gajim/common/httpupload.py b/gajim/common/httpupload.py index 6ca95d7a2..369fb0d91 100644 --- a/gajim/common/httpupload.py +++ b/gajim/common/httpupload.py @@ -15,6 +15,7 @@ # along with Gajim. If not, see . 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: