Ticket #704: deluge-1.1.0-rc3-url-hostname-none.patch

File deluge-1.1.0-rc3-url-hostname-none.patch, 1.0 KB (added by mtasaka, 15 years ago)

proposed patch for this issue

  • deluge/core/torrent.py

    old new  
    521521                host = (url.hostname or 'DHT') 
    522522                # Check if hostname is an IP address and just return it if that's the case 
    523523                import socket 
    524                 try: 
    525                     socket.inet_aton(url.hostname) 
    526                 except socket.error: 
    527                     pass 
    528                 else: 
    529                     # This is an IP address because an exception wasn't raised 
    530                     return url.hostname 
     524                if url.hostname != None : 
     525                    try: 
     526                        socket.inet_aton(url.hostname) 
     527                    except socket.error: 
     528                        pass 
     529                    else: 
     530                        # This is an IP address because an exception wasn't raised 
     531                        return url.hostname 
    531532 
    532533                parts = host.split(".") 
    533534                if len(parts) > 2: