From 86fc8ec6525a9155dbd9761da4300212885996ba Mon Sep 17 00:00:00 2001 From: calvin Date: Mon, 19 Jun 2000 08:43:18 +0000 Subject: [PATCH] bla git-svn-id: https://linkchecker.svn.sourceforge.net/svnroot/linkchecker/trunk/linkchecker@122 e7d03fd6-7b0d-0410-9947-9c21f3af8025 --- linkcheck/Config.py | 5 +++-- linkcheck/FtpUrlData.py | 2 ++ linkcheck/HttpUrlData.py | 4 ++-- linkcheck/UrlData.py | 1 + 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/linkcheck/Config.py b/linkcheck/Config.py index 148cc602..3d337ce4 100644 --- a/linkcheck/Config.py +++ b/linkcheck/Config.py @@ -96,7 +96,9 @@ class Configuration(UserDict.UserDict): self.data["externlinks"] = [] self.data["internlinks"] = [] self.data["allowdeny"] = 0 - self.data["authentication"] = [] + self.data["authentication"] = [(re.compile(r'^.+$'), + 'anonymous', + 'joe@')] self.data["proxy"] = 0 self.data["proxyport"] = 8080 self.data["recursionlevel"] = 1 @@ -475,7 +477,6 @@ class Configuration(UserDict.UserDict): self.data["authentication"].append(tuple) i = i + 1 except ConfigParser.Error: pass - self.data["authentication"].append((re.compile(".*"), "anonymous", "guest@")) section = "filtering" try: diff --git a/linkcheck/FtpUrlData.py b/linkcheck/FtpUrlData.py index 43dd98d2..d74e16d2 100644 --- a/linkcheck/FtpUrlData.py +++ b/linkcheck/FtpUrlData.py @@ -33,6 +33,8 @@ class FtpUrlData(UrlData): def checkConnection(self, config): _user, _password = self._getUserPassword(config) + if _user is None or _password is None: + raise linkcheck.error, _("No user or password found") self.urlConnection = ftplib.FTP(self.urlTuple[1], _user, _password) info = self.urlConnection.getwelcome() if not info: diff --git a/linkcheck/HttpUrlData.py b/linkcheck/HttpUrlData.py index 473a00f5..ae0516b8 100644 --- a/linkcheck/HttpUrlData.py +++ b/linkcheck/HttpUrlData.py @@ -97,11 +97,11 @@ class HttpUrlData(UrlData): import base64,string _user, _password = self._getUserPassword(config) self.auth = "Basic "+\ - string.strip(base64.encodestring(_user+":"+_password)) + base64.encodestring("%s:%s" % (_user, _password)) status, statusText, self.mime = self._getHttpRequest() Config.debug("DEBUG: Authentication "+_user+"/"+_password+"\n") - # Netscape Enterprise Server returns errors with HEAD + # Netscape Enterprise Server 3 returns errors with HEAD # request, but valid urls with GET request. Bummer! elif status>=400 and self.mime: server = self.mime.getheader("Server") diff --git a/linkcheck/UrlData.py b/linkcheck/UrlData.py index a8bc8e70..96ec39d5 100644 --- a/linkcheck/UrlData.py +++ b/linkcheck/UrlData.py @@ -353,6 +353,7 @@ class UrlData: for rx, user, password in config["authentication"]: if rx.match(self.url): return user, password + return None,None from FileUrlData import FileUrlData