fix encoding issue

This commit is contained in:
Yann Leboulanger 2013-08-01 15:54:07 +02:00
parent 97d9991a48
commit c02d122be3
1 changed files with 4 additions and 2 deletions

View File

@ -815,8 +815,10 @@ class Socks5:
Connect request by domain name, sid sha, instead of domain name (jep Connect request by domain name, sid sha, instead of domain name (jep
0096) 0096)
""" """
buff = struct.pack('!BBBBB%dsBB' % len(msg), if isinstance(msg, str):
0x05, command, 0x00, 0x03, len(msg), msg.encode('utf-8'), 0, 0) msg = msg.encode('utf-8')
buff = struct.pack('!BBBBB%dsBB' % len(msg), 0x05, command, 0x00, 0x03,
len(msg), msg, 0, 0)
return buff return buff
def _parse_request_buff(self, buff): def _parse_request_buff(self, buff):