- From: Ville Skytta <ville@dev.w3.org>
- Date: Sun, 11 Jul 2004 19:14:48 +0000
- To: www-validator-cvs@w3.org
Update of /sources/public/perl/modules/W3C/LinkChecker/bin In directory hutz:/tmp/cvs-serv20114/bin Modified Files: checklink Log Message: Fix bug in recursion logic: when parsing a document in recursive mode, we are interested in links in it if it's in recursion scope, even if the document retrieval is "only" caused by an anchor in a referring document. http://lists.w3.org/Archives/Public/www-validator/2004Jun/0181.html Index: checklink =================================================================== RCS file: /sources/public/perl/modules/W3C/LinkChecker/bin/checklink,v retrieving revision 4.1 retrieving revision 4.2 diff -u -d -r4.1 -r4.2 --- checklink 11 Jul 2004 16:45:13 -0000 4.1 +++ checklink 11 Jul 2004 19:14:46 -0000 4.2 @@ -739,7 +739,9 @@ &hprintf("Checking link %s\n", $u) unless $Opts{Summary_Only}; # Check that a link is valid - &check_validity($uri, $u, \%links, \%redirects); + &check_validity($uri, $u, + ($depth != 0 && &in_recursion_scope($u)), + \%links, \%redirects); &hprintf("\tReturn code: %s\n", $results{$u}{location}{code}) if ($Opts{Verbose}); if ($results{$u}{location}{success}) { @@ -834,7 +836,7 @@ my ($method, $uri, $in_recursion, $redirects) = @_; # $method contains the HTTP method the use (GET or HEAD) # $uri contains the identifier of the resource - # $in_recursion equals 1 if we are in recursion mode (i.e. it is at least + # $in_recursion is > 0 if we are in recursion mode (i.e. it is at least # the second resource checked) # $redirects is a pointer to the hash containing the map of the redirects @@ -1089,7 +1091,7 @@ # Parse a document # #################### -sub parse_document ($$$$;$) +sub parse_document ($$$$$) { my ($uri, $location, $document, $links, $rec_needs_links) = @_; @@ -1301,11 +1303,12 @@ # Check the validity of a link # ################################ -sub check_validity ($$\%\%) +sub check_validity ($$$\%\%) { - my ($testing, $uri, $links, $redirects) = @_; + my ($testing, $uri, $in_recursion, $links, $redirects) = @_; # $testing is the URI of the document checked # $uri is the URI of the target that we are verifying + # $in_recursion is > 0 if we're in recursive mode # $links is a hash of the links in the documents checked # $redirects is a map of the redirects encountered @@ -1357,7 +1360,7 @@ } # Do it then $p = &parse_document($uri, $response->base(), - $response->as_string(), 0); + $response->as_string(), 0, $in_recursion); } else { # We already had the information $p->{Anchors} = $results{$uri}{parsing}{Anchors};
Received on Sunday, 11 July 2004 15:14:48 UTC