From 94cb1aaaa3615afee569a0ba1fd2b1a3bd5a4ed6 Mon Sep 17 00:00:00 2001 From: Akkariiin Date: Mon, 7 Aug 2017 13:38:14 +0800 Subject: [PATCH] fix black_hostname_list work error issue when config black_hostname_list is empty --- shadowsocks/asyncdns.py | 2 +- shadowsocks/shell.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/shadowsocks/asyncdns.py b/shadowsocks/asyncdns.py index 04e547d..04444da 100644 --- a/shadowsocks/asyncdns.py +++ b/shadowsocks/asyncdns.py @@ -276,7 +276,7 @@ class DNSResolver(object): self._hostname_to_cb = {} self._cb_to_hostname = {} self._cache = lru_cache.LRUCache(timeout=300) - # TODO read black_hostname_list from config + # read black_hostname_list from config if type(black_hostname_list) != list: self._black_hostname_list = [] else: diff --git a/shadowsocks/shell.py b/shadowsocks/shell.py index 78ba333..a1547d0 100755 --- a/shadowsocks/shell.py +++ b/shadowsocks/shell.py @@ -262,6 +262,8 @@ def get_config(is_local): else: config['server'] = to_str(config.get('server', '0.0.0.0')) config['black_hostname_list'] = to_str(config.get('black_hostname_list', '')).split(',') + if len(config['black_hostname_list']) == 1 and config['black_hostname_list'][0] == '': + config['black_hostname_list'] = [] try: config['forbidden_ip'] = \ IPNetwork(config.get('forbidden_ip', '127.0.0.0/8,::1/128'))