fix issue #165. Sometimes apache don't specify the port ipv6 address are

in the form of  aaaa:aaaa:... . Thanks to zauberpony for first
implementation of the patch.
This commit is contained in:
benoitc 2011-02-25 08:23:56 +01:00
parent 75fec00896
commit 43dfb8f0f7

View File

@ -81,13 +81,13 @@ def create(req, sock, client, server, cfg):
# find host and port on ipv6 address # find host and port on ipv6 address
if '[' in forward and ']' in forward: if '[' in forward and ']' in forward:
host = forward.split(']')[0][1:].lower() host = forward.split(']')[0][1:].lower()
elif ":" in forward: elif ":" in forward and forward.count(":") == 1:
host = forward.split(":")[0].lower() host = forward.split(":")[0].lower()
else: else:
host = forward host = forward
forward = forward.split(']')[-1] forward = forward.split(']')[-1]
if ":" in forward: if ":" in forward and forward.count(":") == 1:
port = forward.split(':', 1)[1] port = forward.split(':', 1)[1]
else: else:
port = 80 port = 80