diff options
author | Casey Deccio <casey@deccio.net> | 2016-08-08 17:58:59 +0300 |
---|---|---|
committer | Casey Deccio <casey@deccio.net> | 2016-08-08 17:58:59 +0300 |
commit | 63994f1a279a625c38941c8209f3b7563adc8756 (patch) | |
tree | 305a22601d44aef0e3ae2c609913fd7ddb2d7013 /contrib | |
parent | 96d99852bf0df88bdf0db94d786eaace385fa59f (diff) |
Check for string for python3 compatibility
Diffstat (limited to 'contrib')
-rwxr-xr-x | contrib/dnsviz-lg.cgi | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/contrib/dnsviz-lg.cgi b/contrib/dnsviz-lg.cgi index e4b7d35..e9984c7 100755 --- a/contrib/dnsviz-lg.cgi +++ b/contrib/dnsviz-lg.cgi @@ -76,7 +76,12 @@ def get_qname(msg): # no label if index >= len(msg): raise InvalidName() - l = struct.unpack('!B', msg[index])[0] + + # python3/python2 dual compatibility + if isinstance(msg, str): + l = struct.unpack('!B', msg[index])[0] + else: + l = msg[index] # no compression allowed in question if l & 0xc0: |