Philipp Hörist pushed to branch master at gajim / gajim

Commits:

2 changed files:

Changes:

  • gajim/common/connection.py
    ... ... @@ -33,6 +33,7 @@
    33 33
     ##
    
    34 34
     
    
    35 35
     import os
    
    36
    +import sys
    
    36 37
     import random
    
    37 38
     import socket
    
    38 39
     import operator
    
    ... ... @@ -49,7 +50,7 @@ from string import Template
    49 50
     from urllib.request import urlopen
    
    50 51
     from urllib.error import URLError
    
    51 52
     
    
    52
    -if os.name == 'nt':
    
    53
    +if sys.platform in ('win32', 'darwin'):
    
    53 54
         import certifi
    
    54 55
     import OpenSSL.crypto
    
    55 56
     import nbxmpp
    
    ... ... @@ -1175,7 +1176,7 @@ class Connection(CommonConnection, ConnectionHandlers):
    1175 1176
             port = self._current_host['port']
    
    1176 1177
     
    
    1177 1178
             cacerts = ''
    
    1178
    -        if os.name == 'nt':
    
    1179
    +        if sys.platform in ('win32', 'darwin'):
    
    1179 1180
                 cacerts = certifi.where()
    
    1180 1181
             mycerts = common.configpaths.get('MY_CACERTS')
    
    1181 1182
             tls_version = app.config.get_per('accounts', self.name, 'tls_version')
    
    ... ... @@ -1374,7 +1375,7 @@ class Connection(CommonConnection, ConnectionHandlers):
    1374 1375
                 url = 'https://%s/.well-known/posh/xmpp-client.json' % hostname
    
    1375 1376
     
    
    1376 1377
             cafile = None
    
    1377
    -        if os.name == 'nt':
    
    1378
    +        if sys.platform in ('win32', 'darwin'):
    
    1378 1379
                 cafile = certifi.where()
    
    1379 1380
     
    
    1380 1381
             log.info('Request POSH from %s', url)
    

  • gajim/common/httpupload.py
    ... ... @@ -15,6 +15,7 @@
    15 15
     # along with Gajim.  If not, see <http://www.gnu.org/licenses/>.
    
    16 16
     
    
    17 17
     import os
    
    18
    +import sys
    
    18 19
     import threading
    
    19 20
     import ssl
    
    20 21
     import urllib
    
    ... ... @@ -35,7 +36,7 @@ from gajim.common.connection_handlers_events import HTTPUploadProgressEvent
    35 36
     from gajim.common.connection_handlers_events import MessageOutgoingEvent
    
    36 37
     from gajim.common.connection_handlers_events import GcMessageOutgoingEvent
    
    37 38
     
    
    38
    -if os.name == 'nt':
    
    39
    +if sys.platform in ('win32', 'darwin'):
    
    39 40
         import certifi
    
    40 41
     
    
    41 42
     log = logging.getLogger('gajim.c.httpupload')
    
    ... ... @@ -300,7 +301,7 @@ class ConnectionHTTPUpload:
    300 301
                     log.warning('CERT Verification disabled')
    
    301 302
                     transfer = urlopen(request, timeout=30, context=context)
    
    302 303
                 else:
    
    303
    -                if os.name == 'nt':
    
    304
    +                if sys.platform in ('win32', 'darwin'):
    
    304 305
                         transfer = urlopen(
    
    305 306
                             request, cafile=certifi.where(), timeout=30)
    
    306 307
                     else: