]> jfr.im git - irc/rizon/acid.git/commitdiff
Allow numeric vhosts that are not IP-lookalike (without expanding them) 33/head
authorlinostar <redacted>
Sun, 19 Jun 2016 21:11:58 +0000 (21:11 +0000)
committerlinostar <redacted>
Sun, 19 Jun 2016 21:24:09 +0000 (21:24 +0000)
pyva/pyva/src/main/python/moo/requests.py

index 650bd4d3841db374d002f3306437c7d14492d116..65e3623b2037f2576ff9629ea4998434360a01bd 100644 (file)
@@ -344,6 +344,9 @@ class RequestManager(object):
                is_blacklisted, reason, int = self.__is_blacklisted(vhost)
                if is_blacklisted:
                        return (False, reason, int)
+
+               if vhost.replace(".", "").isdigit() and not self.__is_numeric_ip(vhost):
+                       return (True, '@c9Acceptable@c', None)
                
                is_resolvable, resolved, host = self.__is_resolvable(vhost)
                (txt_record_exists, resolving_error) = self.check_nick_in_TXT_records(vhost, nick)
@@ -370,7 +373,14 @@ class RequestManager(object):
                        return (True, '@c9Acceptable@c', 'TXT record')
                else:
                        return (True, '@c9Acceptable@c', None)
-       
+
+       def __is_numeric_ip(self, host):
+               try:
+                       parts = host.split(".")
+                       return len(parts) == len([x for x in parts if 0 <= int(x) <= 255]) == 4
+               except:
+                       return False
+
        def __is_resolvable(self, host):
                try:
                        res = getaddrinfo(host, 80)