Ticket #2850: extractRecord.patch

File extractRecord.patch, 912 bytes (added by Stephen Thorne, 10 years ago)

wangminghua's code from the ticket description transcribed into a patch

  • common.py

     
    192192    for r in answers:
    193193        if r.type == dns.NS:
    194194            from twisted.names import client
    195             r = client.Resolver(servers=[(str(r.payload.name), dns.PORT)])
     195            server = str(r.payload.name)
     196            for s in answers:
     197                if s.type == dns.A and str(s.name) == nsServerName:
     198                    server = socket.inet_ntop(socket.AF_INET, s.payload.address)
     199                    break
     200            r = client.Resolver(servers=[(server, dns.PORT)])
    196201            return r.lookupAddress(str(name)
    197202                ).addCallback(lambda (ans, auth, add): extractRecord(r, name, ans + auth + add, level - 1)
    198203                ).addBoth(lambda passthrough: (r.protocol.transport.stopListening(), passthrough)[1])