Merge branch 'master' into remove-unused-imports

This commit is contained in:
Erik Sundell
2020-10-01 12:07:37 +02:00
90 changed files with 2005 additions and 1110 deletions

View File

@@ -66,7 +66,7 @@ def can_connect(ip, port):
Return True if we can connect, False otherwise.
"""
if ip in {'', '0.0.0.0'}:
if ip in {'', '0.0.0.0', '::'}:
ip = '127.0.0.1'
try:
socket.create_connection((ip, port)).close()
@@ -85,6 +85,7 @@ def make_ssl_context(keyfile, certfile, cafile=None, verify=True, check_hostname
return None
purpose = ssl.Purpose.SERVER_AUTH if verify else ssl.Purpose.CLIENT_AUTH
ssl_context = ssl.create_default_context(purpose, cafile=cafile)
ssl_context.load_default_certs()
ssl_context.load_cert_chain(certfile, keyfile)
ssl_context.check_hostname = check_hostname
return ssl_context
@@ -179,7 +180,7 @@ async def exponential_backoff(
async def wait_for_server(ip, port, timeout=10):
"""Wait for any server to show up at ip:port."""
if ip in {'', '0.0.0.0'}:
if ip in {'', '0.0.0.0', '::'}:
ip = '127.0.0.1'
await exponential_backoff(
lambda: can_connect(ip, port),
@@ -579,7 +580,7 @@ def utcnow():
def _parse_accept_header(accept):
"""
Parse the Accept header *accept*
Return a list with 3-tuples of
[(str(media_type), dict(params), float(q_value)),] ordered by q values.
If the accept header includes vendor-specific types like::