Ignore:
Timestamp:
Jan 12, 2013, 4:40:38 PM (9 years ago)
Author:
Ralph Meijer <ralphm@…>
Branch:
default
Message:

Properly encode IDN domain names for SRV lookups.

Before Twisted 12.3.0, the SRV lookup done for outgoing
connections succeeded if passed a unicode string with all-ASCII
code points. A recent change made the DNS code more strict, and
only byte string are accepted as domain name. See
http://twistedmatrix.com/trac/ticket/6245 for details.

This change makes sure domain names are encoded to their ASCII
Compatible Equivalent (ACE) version before passing the resulting
byte string to twisted.names.srvconnect.SRVConnector, as per
RFC 3490.

Note that while connecting to servers with an IDN domain name
now works properly, authentication using MD5-Digest SASL mechanism
will fail until http://twistedmatrix.com/trac/ticket/5066 has been
resolved.

Fixes: #77.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wokkel/test/test_client.py

    r165 r178  
    4141        xs.dispatch(xs, xmlstream.STREAM_AUTHD_EVENT)
    4242        self.assertEquals(JID('user@example.org/test'), self.client.jid)
     43
     44
     45    def test_domain(self):
     46        """
     47        The domain to connect to is a byte string derived from the JID host.
     48        """
     49        self.assertIsInstance(self.client.domain, bytes)
     50        self.assertEqual(b'example.org', self.client.domain)
    4351
    4452
     
    143151        def cb(connector):
    144152            self.assertEqual('xmpp-client', connector.service)
    145             self.assertEqual('example.org', connector.domain)
     153            self.assertIsInstance(connector.domain, bytes)
     154            self.assertEqual(b'example.org', connector.domain)
    146155            self.assertEqual(factory, connector.factory)
    147156
Note: See TracChangeset for help on using the changeset viewer.