Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/dnsviz/dnsviz.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCasey Deccio <casey@deccio.net>2016-08-08 17:58:59 +0300
committerCasey Deccio <casey@deccio.net>2016-08-08 17:58:59 +0300
commit63994f1a279a625c38941c8209f3b7563adc8756 (patch)
tree305a22601d44aef0e3ae2c609913fd7ddb2d7013 /contrib
parent96d99852bf0df88bdf0db94d786eaace385fa59f (diff)
Check for string for python3 compatibility
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/dnsviz-lg.cgi7
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: