Commit 5493bc18 authored by Denis Bilenko's avatar Denis Bilenko

socket: fix _ip_re regex not to match a hostname accidentally

- only call dns_init when HAS_EVDNS
parent 9349813d
......@@ -43,8 +43,7 @@ from gevent.hub import getcurrent, get_hub, spawn_raw, Waiter
from gevent import core
BUFFER_SIZE = 4096
core.dns_init()
_ip_re = re.compile('^[\d\.]+$')
def _wait_helper(ev, evtype):
......@@ -640,6 +639,7 @@ def wrap_ssl000(sock, keyfile=None, certfile=None):
return ssl_sock
if core.HAS_EVDNS:
core.dns_init()
# NOTE:
# use flags=core.DNS_QUERY_NO_SEARCH to avoid search, see comments in evdns.h
# TODO:
......@@ -651,8 +651,6 @@ if core.HAS_EVDNS:
(waiter,) = args
waiter.switch((result, type, ttl, addrs))
_ip_re = re.compile('[\d\.]+')
def gethostbyname(hostname):
"""gethostbyname implemented using EvDNS.
Differs in the following ways:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment