mirror of
https://github.com/Hopiu/linkchecker.git
synced 2026-05-14 01:23:11 +00:00
Warn on permament redirections even when URL is outside of domain filter.
This commit is contained in:
parent
6fb5a91f1c
commit
3d5c114f14
2 changed files with 15 additions and 9 deletions
|
|
@ -7,10 +7,13 @@ Fixes:
|
|||
- dns: use /dev/urandom instead of /dev/random to get initial seed
|
||||
on Linux machines since the last one can block indefinitely.
|
||||
Closes: SF bug #2901667
|
||||
- checking: Retry if server closed connection and sent an empty
|
||||
- http: Retry if server closed connection and sent an empty
|
||||
status line. Fixes the "BadStatusLine" errors.
|
||||
- installer: Add commandline executable to Windows installer.
|
||||
Closes: SF bug #2903257
|
||||
- http: warn about permanent redirections even when redirected URL is
|
||||
outside of the domain filter.
|
||||
Closes: SF bug #2920182
|
||||
|
||||
5.1 "Let the right one in" (released 04.08.2009)
|
||||
|
||||
|
|
|
|||
|
|
@ -327,6 +327,7 @@ Use URL `%(newurl)s' instead for checking.""") % {
|
|||
self.set_extern(redirected)
|
||||
if self.extern[0] and self.extern[0]:
|
||||
if set_result:
|
||||
self.check301status(response)
|
||||
self.add_info(
|
||||
_("The redirected URL is outside of the domain "
|
||||
"filter, checked only syntax."))
|
||||
|
|
@ -359,14 +360,8 @@ Use URL `%(newurl)s' instead for checking.""") % {
|
|||
self.aliases.append(redirected)
|
||||
# note: urlparts has to be a list
|
||||
self.urlparts = urlparts
|
||||
if response.status == 301:
|
||||
if not self.has301status:
|
||||
if set_result:
|
||||
self.add_warning(
|
||||
_("HTTP 301 (moved permanent) encountered: you"
|
||||
" should update this link."),
|
||||
tag=WARN_HTTP_MOVED_PERMANENT)
|
||||
self.has301status = True
|
||||
if set_result:
|
||||
self.check301status(response)
|
||||
# check cache again on the changed URL
|
||||
if self.aggregate.urlqueue.checked_redirect(redirected, self):
|
||||
return -1, response
|
||||
|
|
@ -392,6 +387,14 @@ Use URL `%(newurl)s' instead for checking.""") % {
|
|||
tries += 1
|
||||
return tries, response
|
||||
|
||||
def check301status (self, response):
|
||||
"""If response page has been permanently moved add a warning."""
|
||||
if response.status == 301 and not self.has301status:
|
||||
self.add_warning(_("HTTP 301 (moved permanent) encountered: you"
|
||||
" should update this link."),
|
||||
tag=WARN_HTTP_MOVED_PERMANENT)
|
||||
self.has301status = True
|
||||
|
||||
def get_alias_cache_data (self):
|
||||
"""
|
||||
Return all data values that should be put in the cache,
|
||||
|
|
|
|||
Loading…
Reference in a new issue