duplicity-ipv6.patch 1.09 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
=== modified file 'src/urlparse_2_5.py'
--- src/urlparse_2_5.py	2011-03-06 15:12:33 +0000
+++ src/urlparse_2_5.py	2011-08-31 14:21:06 +0000
@@ -109,18 +109,19 @@
     password = property(get_password)
 
     def get_hostname(self):
-        netloc = self.netloc
-        if "@" in netloc:
-            netloc = _rsplit(netloc, "@", 1)[1]
-        if ":" in netloc:
-            netloc = netloc.split(":", 1)[0]
-        return netloc.lower() or None
+        netloc = self.netloc.split('@')[-1]
+        if '[' in netloc and ']' in netloc:
+            return netloc.split(']')[0][1:].lower()
+        elif ':' in netloc:
+            return netloc.split(':')[0].lower()
+        elif netloc == '':
+            return None
+        else:
+            return netloc.lower()
     hostname = property(get_hostname)
 
     def get_port(self):
-        netloc = self.netloc
-        if "@" in netloc:
-            netloc = _rsplit(netloc, "@", 1)[1]
+        netloc = self.netloc.split('@')[-1].split(']')[-1]
         if ":" in netloc:
             port = netloc.split(":", 1)[1]
             return int(port, 10)