robotparser2

git-svn-id: https://linkchecker.svn.sourceforge.net/svnroot/linkchecker/trunk/linkchecker@217 e7d03fd6-7b0d-0410-9947-9c21f3af8025
This commit is contained in:
calvin 2001-01-04 23:26:53 +00:00
parent 3254f921ee
commit 29921eb3ef

View file

@ -50,13 +50,12 @@ class RobotFileParser:
import httplib
tries = 0
while tries<5:
_debug(self.host)
_debug(self.path)
_debug(self.host+self.path)
connection = httplib.HTTP(self.host)
connection.putrequest("GET", self.path)
connection.endheaders()
status, text, mime = connection.getreply()
if status in [301,302]:
if status in [301,302] and mime:
tries = tries + 1
newurl = mime.get("Location", mime.get("Uri", ""))
newurl = urlparse.urljoin(self.url, newurl)