mirror of
https://github.com/Hopiu/linkchecker.git
synced 2026-04-23 07:34:44 +00:00
win DNS config fixes
git-svn-id: https://linkchecker.svn.sourceforge.net/svnroot/linkchecker/trunk/linkchecker@304 e7d03fd6-7b0d-0410-9947-9c21f3af8025
This commit is contained in:
parent
317a5587cc
commit
8021f6d725
3 changed files with 37 additions and 27 deletions
48
DNS/Base.py
48
DNS/Base.py
|
|
@ -73,7 +73,7 @@ def init_dns_resolver_nt():
|
|||
if key:
|
||||
for server in winreg.stringdisplay(key["NameServer"]):
|
||||
if server:
|
||||
defaults['nameserver'].append(server)
|
||||
defaults['server'].append(server)
|
||||
for item in winreg.stringdisplay(key["SearchList"]):
|
||||
if item:
|
||||
defaults['search_domains'].append(item)
|
||||
|
|
@ -88,7 +88,7 @@ def init_dns_resolver_nt():
|
|||
values, valuestype = subkey['DNSServerAddresses']
|
||||
for server in winreg.binipdisplay(values):
|
||||
if server:
|
||||
defaults['nameserver'].append(server)
|
||||
defaults['server'].append(server)
|
||||
except EnvironmentError:
|
||||
pass
|
||||
|
||||
|
|
@ -98,7 +98,7 @@ def init_dns_resolver_nt():
|
|||
for subkey in key.subkeys():
|
||||
for server in winreg.stringdisplay(subkey.get('NameServer', '')):
|
||||
if server:
|
||||
defaults['nameserver'].append(server)
|
||||
defaults['server'].append(server)
|
||||
except EnvironmentError:
|
||||
pass
|
||||
|
||||
|
|
@ -155,37 +155,37 @@ class DnsRequest:
|
|||
return self.processReply()
|
||||
|
||||
def processReply(self):
|
||||
import time
|
||||
#import time
|
||||
self.args['elapsed']=(self.time_finish-self.time_start)*1000
|
||||
u = DNS.Lib.Munpacker(self.reply)
|
||||
r=DNS.Lib.DnsResult(u,self.args)
|
||||
r = DNS.Lib.DnsResult(u,self.args)
|
||||
r.args=self.args
|
||||
#self.args=None # mark this DnsRequest object as used.
|
||||
return r
|
||||
#### TODO TODO TODO ####
|
||||
if protocol == 'tcp' and qtype == DNS.Type.AXFR:
|
||||
while 1:
|
||||
header = f.read(2)
|
||||
if len(header) < 2:
|
||||
print '========== EOF =========='
|
||||
break
|
||||
count = DNS.Lib.unpack16bit(header)
|
||||
if not count:
|
||||
print '========== ZERO COUNT =========='
|
||||
break
|
||||
print '========== NEXT =========='
|
||||
reply = f.read(count)
|
||||
if len(reply) != count:
|
||||
print '*** Incomplete reply ***'
|
||||
break
|
||||
u = DNS.Lib.Munpacker(reply)
|
||||
DNS.Lib.dumpM(u)
|
||||
#if protocol == 'tcp' and qtype == DNS.Type.AXFR:
|
||||
# while 1:
|
||||
# header = f.read(2)
|
||||
# if len(header) < 2:
|
||||
# print '========== EOF =========='
|
||||
# break
|
||||
# count = DNS.Lib.unpack16bit(header)
|
||||
# if not count:
|
||||
# print '========== ZERO COUNT =========='
|
||||
# break
|
||||
# print '========== NEXT =========='
|
||||
# reply = f.read(count)
|
||||
# if len(reply) != count:
|
||||
# print '*** Incomplete reply ***'
|
||||
# break
|
||||
# u = DNS.Lib.Munpacker(reply)
|
||||
# DNS.Lib.dumpM(u)
|
||||
|
||||
def conn(self):
|
||||
self.s.connect((self.ns,self.port))
|
||||
|
||||
def req(self,*name,**args):
|
||||
import time,sys
|
||||
import time
|
||||
self.argparse(name,args)
|
||||
#if not self.args:
|
||||
# raise DNS.Error,'reinitialize request before reuse'
|
||||
|
|
@ -251,6 +251,8 @@ class DnsRequest:
|
|||
if not self.async:
|
||||
return self.response
|
||||
|
||||
import asyncore
|
||||
|
||||
#class DnsAsyncRequest(DnsRequest,asyncore.dispatcher_with_send):
|
||||
class DnsAsyncRequest(DnsRequest):
|
||||
def __init__(self,*name,**args):
|
||||
|
|
|
|||
|
|
@ -49,6 +49,9 @@ def bin2addr(n):
|
|||
|
||||
# Packing class
|
||||
|
||||
class PackError(Exception):
|
||||
pass
|
||||
|
||||
class Packer:
|
||||
def __init__(self):
|
||||
self.buf = ''
|
||||
|
|
@ -138,7 +141,8 @@ class Packer:
|
|||
|
||||
# Unpacking class
|
||||
|
||||
UnpackError = 'DNS.Lib.UnpackError' # Exception
|
||||
class UnpackError(Exception):
|
||||
pass
|
||||
|
||||
class Unpacker:
|
||||
def __init__(self, buf):
|
||||
|
|
|
|||
10
linkchecker
10
linkchecker
|
|
@ -21,9 +21,10 @@ import sys
|
|||
if sys.version[:5] < "2.0":
|
||||
raise SystemExit, "This program requires Python 2.0 or later."
|
||||
|
||||
from linkcheck import timeoutsocket
|
||||
import getopt, re, os, urlparse, linkcheck
|
||||
from linkcheck import _,StringUtil,timeoutsocket
|
||||
from linkcheck import _,StringUtil
|
||||
if os.name!='nt':
|
||||
from linkcheck import timeoutsocket
|
||||
|
||||
Usage = _("""USAGE\tlinkchecker [options] file-or-url...
|
||||
|
||||
|
|
@ -275,7 +276,10 @@ for opt,arg in options:
|
|||
config.disableThreading()
|
||||
|
||||
elif opt=="--timeout":
|
||||
timeoutsocket.setDefaultSocketTimeout(int(arg))
|
||||
if os.name!='nt':
|
||||
timeoutsocket.setDefaultSocketTimeout(int(arg))
|
||||
else:
|
||||
print >> sys.stderr, _("warning: timeoutsocket not support on this platform")
|
||||
|
||||
elif opt=="-u" or opt=="--user":
|
||||
_user = arg
|
||||
|
|
|
|||
Loading…
Reference in a new issue