Browse Source

fix host_list type

dev
BreakWa11 9 years ago
parent
commit
82df4524d1
  1. 27
      shadowsocks/tcprelay.py

27
shadowsocks/tcprelay.py

@ -354,19 +354,20 @@ class TCPRelayHandler(object):
host_port = [] host_port = []
match_port = False match_port = False
if type(host_list) == list: if type(host_list) != list:
for host in host_list: host_list = [host_list]
items = common.to_str(host).rsplit(':', 1) for host in host_list:
if len(items) > 1: items = common.to_str(host).rsplit(':', 1)
try: if len(items) > 1:
port = int(items[1]) try:
if port == self._server._listen_port: port = int(items[1])
match_port = True if port == self._server._listen_port:
host_port.append((items[0], port)) match_port = True
except: host_port.append((items[0], port))
pass except:
else: pass
host_port.append((host, 80)) else:
host_port.append((host, 80))
if match_port: if match_port:
last_host_port = host_port last_host_port = host_port

Loading…
Cancel
Save