##// END OF EJS Templates
zeroconf: better fix for readName error...
Brendan Cully -
r10386:1ddb0ae2 default
parent child Browse files
Show More
@@ -560,7 +560,7 b' class DNSIncoming(object):'
560 #
560 #
561 #print "UNKNOWN TYPE = " + str(info[0])
561 #print "UNKNOWN TYPE = " + str(info[0])
562 #raise BadTypeInNameException
562 #raise BadTypeInNameException
563 pass
563 break
564
564
565 if rec is not None:
565 if rec is not None:
566 self.answers.append(rec)
566 self.answers.append(rec)
@@ -575,11 +575,7 b' class DNSIncoming(object):'
575
575
576 def readUTF(self, offset, len):
576 def readUTF(self, offset, len):
577 """Reads a UTF-8 string of a given length from the packet"""
577 """Reads a UTF-8 string of a given length from the packet"""
578 result = self.data[offset:offset+len]
578 return self.data[offset:offset+len].decode('utf-8')
579 try:
580 return result.decode('utf-8')
581 except UnicodeDecodeError:
582 return result.decode('utf-16')
583
579
584 def readName(self):
580 def readName(self):
585 """Reads a domain name from the packet"""
581 """Reads a domain name from the packet"""
General Comments 0
You need to be logged in to leave comments. Login now