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

Commits:
78ebaefa by Philipp Hörist at 2018-06-23T20:15:00+02:00
Dont punycode encode all domain names

RFC7622 3.2.1

... This implies that the string MUST NOT include A-labels ...

Fixes #9211

- - - - -


1 changed file:

- gajim/common/helpers.py


Changes:

=====================================
gajim/common/helpers.py
=====================================
--- a/gajim/common/helpers.py
+++ b/gajim/common/helpers.py
@@ -61,12 +61,6 @@ try:
 except ImportError:
     HAS_PRECIS_I18N = False
 
-try:
-    import idna
-    HAS_IDNA = True
-except ImportError:
-    HAS_IDNA = False
-
 HAS_SOUND = True
 if sys.platform == 'win32':
     try:
@@ -291,16 +285,13 @@ def prep(user, server, resource):
 
     if not ip_address:
         if server is not None:
-            if server.endswith('.'): # RFC7622, 3.2
+            if server.endswith('.'):  # RFC7622, 3.2
                 server = server[:-1]
             if len(server) < 1 or len(server.encode('utf-8')) > 1023:
                 raise InvalidFormat(_('Server must be between 1 and 1023 
bytes'))
             try:
-                if HAS_IDNA:
-                    server = idna.encode(server).decode('utf-8')
-                else:
-                    from nbxmpp.stringprepare import nameprep
-                    server = nameprep.prepare(server)
+                from nbxmpp.stringprepare import nameprep
+                server = nameprep.prepare(server)
             except UnicodeError:
                 raise InvalidFormat(_('Invalid character in hostname.'))
         else:



View it on GitLab: 
https://dev.gajim.org/gajim/gajim/commit/78ebaefaec66e987cf43c6af936530ad25cb28ad

---
View it on GitLab: 
https://dev.gajim.org/gajim/gajim/commit/78ebaefaec66e987cf43c6af936530ad25cb28ad
You're receiving this email because of your account on dev.gajim.org.
_______________________________________________
Commits mailing list
Commits@gajim.org
https://lists.gajim.org/cgi-bin/listinfo/commits

Reply via email to