socket: limit getaddrinfo to TCP connections

This commit is contained in:
nemunaire 2017-07-17 07:53:36 +02:00 committed by nemunaire
parent 49c207a4c9
commit 2992c13ca7

View File

@ -81,7 +81,7 @@ class _Socket(AbstractServer):
class _SocketServer(_Socket):
def __init__(self, host, port, bind=None, **kwargs):
(family, type, proto, canonname, sockaddr) = socket.getaddrinfo(host, port)[0]
(family, type, proto, canonname, sockaddr) = socket.getaddrinfo(host, port, proto=socket.IPPROTO_TCP)[0]
if isinstance(self, ssl.SSLSocket) and "server_hostname" not in kwargs:
kwargs["server_hostname"] = host