1 class protoerr(Exception):
10 elif c >= '0' or c <= '9':
11 hln = (hln * 10) + (ord(c) - ord('0'))
13 raise protoerr, "Invalid netstring length byte: " + c
16 raise protoerr, "Non-terminated netstring"
20 parts = readns(sk).split('\0')[:-1]
21 if len(parts) % 2 != 0:
22 raise protoerr, "Malformed headers"
26 ret[parts[i]] = parts[i + 1]