Commit d7ac92dd authored by Romain Courteaud's avatar Romain Courteaud Committed by Vincent Pelletier

Add IPv6 support to MySQL connector.

parent cfe1aaf3
...@@ -225,7 +225,11 @@ class ThreadedDB: ...@@ -225,7 +225,11 @@ class ThreadedDB:
if '@' in db_host: if '@' in db_host:
db, host = split(db_host,'@',1) db, host = split(db_host,'@',1)
kwargs['db'] = db kwargs['db'] = db
if ':' in host: if host.startswith('['):
host, port = split(host[1:], ']', 1)
if port.startswith(':'):
kwargs['port'] = int(port[1:])
elif ':' in host:
host, port = split(host,':',1) host, port = split(host,':',1)
kwargs['port'] = int(port) kwargs['port'] = int(port)
kwargs['host'] = host kwargs['host'] = host
......
...@@ -222,7 +222,11 @@ class ThreadedDeferredDB: ...@@ -222,7 +222,11 @@ class ThreadedDeferredDB:
if '@' in db_host: if '@' in db_host:
db, host = split(db_host,'@',1) db, host = split(db_host,'@',1)
kwargs['db'] = db kwargs['db'] = db
if ':' in host: if host.startswith('['):
host, port = split(host[1:], ']', 1)
if port.startswith(':'):
kwargs['port'] = int(port[1:])
elif ':' in host:
host, port = split(host,':',1) host, port = split(host,':',1)
kwargs['port'] = int(port) kwargs['port'] = int(port)
kwargs['host'] = host kwargs['host'] = host
......
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