2001-03-15 01:19:35 +00:00
|
|
|
"""Base handle for links with a hostname"""
|
2001-05-23 21:20:44 +00:00
|
|
|
# Copyright (C) 2000,2001 Bastian Kleineidam
|
2001-03-15 01:19:35 +00:00
|
|
|
#
|
2001-05-23 21:20:44 +00:00
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
|
# the Free Software Foundation; either version 2 of the License, or
|
|
|
|
|
# (at your option) any later version.
|
2001-03-15 01:19:35 +00:00
|
|
|
#
|
2001-05-23 21:20:44 +00:00
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
# GNU General Public License for more details.
|
2001-03-15 01:19:35 +00:00
|
|
|
#
|
2001-05-23 21:20:44 +00:00
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
|
# along with this program; if not, write to the Free Software
|
|
|
|
|
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
2000-11-11 00:38:04 +00:00
|
|
|
|
2002-02-24 12:29:35 +00:00
|
|
|
import socket, linkcheck
|
2000-02-26 10:24:46 +00:00
|
|
|
from UrlData import UrlData
|
|
|
|
|
|
2002-05-04 13:27:02 +00:00
|
|
|
class HostCheckingUrlData (UrlData):
|
2000-02-26 10:24:46 +00:00
|
|
|
"Url link for which we have to connect to a specific host"
|
|
|
|
|
|
2002-05-04 13:27:02 +00:00
|
|
|
def __init__ (self, urlName, recursionLevel, config, parentName=None,
|
|
|
|
|
baseRef=None, line=0, name=""):
|
|
|
|
|
UrlData.__init__(self, urlName, recursionLevel, config,
|
2001-01-07 13:28:38 +00:00
|
|
|
parentName=parentName, baseRef=baseRef, line=line,
|
2002-05-04 13:27:02 +00:00
|
|
|
name=name)
|
2000-02-26 10:24:46 +00:00
|
|
|
self.host = None
|
|
|
|
|
self.url = urlName
|
|
|
|
|
|
2002-05-04 13:27:02 +00:00
|
|
|
def buildUrl (self):
|
2000-02-26 10:24:46 +00:00
|
|
|
# to avoid anchor checking
|
|
|
|
|
self.urlTuple=None
|
2001-12-10 13:51:07 +00:00
|
|
|
|
2002-05-04 13:27:02 +00:00
|
|
|
def getCacheKey (self):
|
2001-12-10 13:51:07 +00:00
|
|
|
return "%s:%s" % (self.scheme, self.host)
|
|
|
|
|
|
2002-05-04 13:27:02 +00:00
|
|
|
def checkConnection (self):
|
2000-02-26 10:24:46 +00:00
|
|
|
ip = socket.gethostbyname(self.host)
|
2002-02-24 12:29:35 +00:00
|
|
|
self.setValid(self.host+"("+ip+") "+linkcheck._("found"))
|