Commit d81c9789 authored by Taddeüs Kroes's avatar Taddeüs Kroes

Fixed bug leading to tuple unpack exception

parent dbe4eecf
...@@ -357,17 +357,22 @@ class ClientHandshake(Handshake): ...@@ -357,17 +357,22 @@ class ClientHandshake(Handshake):
password=password.encode('utf-8')) password=password.encode('utf-8'))
def split_stripped(value, delim=','): def split_stripped(value, delim=',', maxsplits=-1):
return map(str.strip, str(value).split(delim)) if value else [] return map(str.strip, str(value).split(delim, maxsplits)) if value else []
def parse_param_hdr(hdr): def parse_param_hdr(hdr):
name, paramstr = split_stripped(hdr, ';') if ';' in hdr:
name, paramstr = split_stripped(hdr, ';', 1)
else:
name = hdr
paramstr = ''
params = {} params = {}
for param in split_stripped(paramstr): for param in split_stripped(paramstr):
if '=' in param: if '=' in param:
key, value = split_stripped(param, '=') key, value = split_stripped(param, '=', 1)
if value.isdigit(): if value.isdigit():
value = int(value) value = int(value)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment