Browse Source

Merge branch 'dev'

auth
clowwindy 11 years ago
parent
commit
d97e351b88
  1. 4
      CHANGES
  2. 11
      README.rst
  3. 2
      setup.py
  4. 32
      shadowsocks/utils.py

4
CHANGES

@ -1,3 +1,7 @@
2.0.9 2014-07-06
- Fix EWOULDBLOCK on Windows
- Fix Unicode config problem on some platforms
2.0.8 2014-06-23 2.0.8 2014-06-23
- Use multiple DNS to query hostnames - Use multiple DNS to query hostnames

11
README.rst

@ -143,13 +143,10 @@ MIT
Bugs and Issues Bugs and Issues
--------------- ---------------
Please visit `Issue - `Troubleshooting <https://github.com/clowwindy/shadowsocks/wiki/Troubleshooting>`__
Tracker <https://github.com/clowwindy/shadowsocks/issues?state=open>`__ - `Issue
Tracker <https://github.com/clowwindy/shadowsocks/issues?state=open>`__
Mailing list: http://groups.google.com/group/shadowsocks - `Mailing list <http://groups.google.com/group/shadowsocks>`__
Also see
`Troubleshooting <https://github.com/clowwindy/shadowsocks/wiki/Troubleshooting>`__
.. |PyPI version| image:: https://img.shields.io/pypi/v/shadowsocks.svg?style=flat .. |PyPI version| image:: https://img.shields.io/pypi/v/shadowsocks.svg?style=flat
:target: https://pypi.python.org/pypi/shadowsocks :target: https://pypi.python.org/pypi/shadowsocks

2
setup.py

@ -6,7 +6,7 @@ with open('README.rst') as f:
setup( setup(
name="shadowsocks", name="shadowsocks",
version="2.0.8", version="2.0.9",
license='MIT', license='MIT',
description="A fast tunnel proxy that help you get through firewalls", description="A fast tunnel proxy that help you get through firewalls",
author='clowwindy', author='clowwindy',

32
shadowsocks/utils.py

@ -100,7 +100,7 @@ def get_config(is_local):
logging.info('loading config from %s' % config_path) logging.info('loading config from %s' % config_path)
with open(config_path, 'rb') as f: with open(config_path, 'rb') as f:
try: try:
config = json.load(f) config = json.load(f, object_hook=_decode_dict)
except ValueError as e: except ValueError as e:
logging.error('found an error in config.json: %s', logging.error('found an error in config.json: %s',
e.message) e.message)
@ -210,4 +210,32 @@ optional arguments:
-v verbose mode -v verbose mode
Online help: <https://github.com/clowwindy/shadowsocks> Online help: <https://github.com/clowwindy/shadowsocks>
''' '''
def _decode_list(data):
rv = []
for item in data:
if isinstance(item, unicode):
item = item.encode('utf-8')
elif isinstance(item, list):
item = _decode_list(item)
elif isinstance(item, dict):
item = _decode_dict(item)
rv.append(item)
return rv
def _decode_dict(data):
rv = {}
for key, value in data.iteritems():
if isinstance(key, unicode):
key = key.encode('utf-8')
if isinstance(value, unicode):
value = value.encode('utf-8')
elif isinstance(value, list):
value = _decode_list(value)
elif isinstance(value, dict):
value = _decode_dict(value)
rv[key] = value
return rv
Loading…
Cancel
Save