W3C home > Mailing lists > Public > www-validator-cvs@w3.org > August 2010

link-checker commit: Prevent (some) infinite loops.

From: Mercurial notifier <nobody@w3.org>
Date: Thu, 05 Aug 2010 14:47:15 +0000
To: link-checker updates <www-validator-cvs@w3.org>
Message-Id: <E1Oh1j1-00065J-IV@blinky.w3.org>
changeset:   246:7c2634a62b2f
user:        mernst
date:        Fri Oct 17 04:33:59 2008 +0000
files:       bin/checklink
description:
Prevent (some) infinite loops.


diff -r 2eff729e3580 -r 7c2634a62b2f bin/checklink
--- a/bin/checklink	Mon Sep 22 19:33:31 2008 +0000
+++ b/bin/checklink	Fri Oct 17 04:33:59 2008 +0000
@@ -5,7 +5,7 @@
 # (c) 1999-2008 World Wide Web Consortium
 # based on Renaud Bruyeron's checklink.pl
 #
-# $Id: checklink,v 4.116 2008-09-22 19:33:31 ville Exp $
+# $Id: checklink,v 4.117 2008-10-17 04:33:59 mernst Exp $
 #
 # This program is licensed under the W3C(r) Software License:
 #       http://www.w3.org/Consortium/Legal/copyright-software
@@ -259,7 +259,7 @@
   $PROGRAM     = 'W3C-checklink';
   $VERSION     = '4.3';
   $REVISION    = sprintf('version %s (c) 1999-2008 W3C', $VERSION);
-  my ($cvsver) = q$Revision: 4.116 $ =~ /(\d+[\d\.]*\.\d+)/;
+  my ($cvsver) = q$Revision: 4.117 $ =~ /(\d+[\d\.]*\.\d+)/;
   $AGENT       = sprintf('%s/%s [%s] %s',
                          $PROGRAM, $VERSION, $cvsver,
                          (W3C::UserAgent::USE_ROBOT_UA
@@ -1552,6 +1552,9 @@
 {
   my ($self, $uri, $base, $line) = @_;
   if (defined($uri)) {
+    # Remove repeated slashes after the . or .. in relative links, to avoid
+    # duplicated checking or infinite recursion.
+    $uri =~ s|^(\.\.?/)/+|$1|o;
     $uri = URI->new_abs($uri, $base) if defined($base);
     $self->{Links}{$uri}{$line}++;
   }
Received on Thursday, 5 August 2010 14:47:33 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 15:17:43 UTC