From 82df4524d18ae04b46fe695cf657d3f960d9f037 Mon Sep 17 00:00:00 2001 From: BreakWa11 Date: Thu, 28 Jul 2016 23:18:18 +0800 Subject: [PATCH] fix host_list type --- shadowsocks/tcprelay.py | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/shadowsocks/tcprelay.py b/shadowsocks/tcprelay.py index 34a0eaf..ef9a1c1 100644 --- a/shadowsocks/tcprelay.py +++ b/shadowsocks/tcprelay.py @@ -354,19 +354,20 @@ class TCPRelayHandler(object): host_port = [] match_port = False - if type(host_list) == list: - for host in host_list: - items = common.to_str(host).rsplit(':', 1) - if len(items) > 1: - try: - port = int(items[1]) - if port == self._server._listen_port: - match_port = True - host_port.append((items[0], port)) - except: - pass - else: - host_port.append((host, 80)) + if type(host_list) != list: + host_list = [host_list] + for host in host_list: + items = common.to_str(host).rsplit(':', 1) + if len(items) > 1: + try: + port = int(items[1]) + if port == self._server._listen_port: + match_port = True + host_port.append((items[0], port)) + except: + pass + else: + host_port.append((host, 80)) if match_port: last_host_port = host_port