link-checker commit: The (hopefully temporary) workaround for responses not storing the original

changeset:   133:66d3b18fb559
user:        ot
date:        Tue Oct 25 00:36:04 2005 +0000
files:       bin/checklink
description:
The (hopefully temporary) workaround for responses not storing the original
request should not be for cases of 401's, but 403 Forbidden by robots.txt
See:
http://lists.w3.org/Archives/Public/public-qa-dev/2005Sep/0002

Hopefully we should be able to get rid of this if we manage to get Dom's
patch to RobotUA accepted.

http://lists.w3.org/Archives/Public/public-qa-dev/2005Sep/0018.html


diff -r 74e428d56edd -r 66d3b18fb559 bin/checklink
--- a/bin/checklink	Wed Aug 31 09:53:00 2005 +0000
+++ b/bin/checklink	Tue Oct 25 00:36:04 2005 +0000
@@ -5,7 +5,7 @@
 # (c) 1999-2005 World Wide Web Consortium
 # based on Renaud Bruyeron's checklink.pl
 #
-# $Id: checklink,v 4.23 2005-08-31 09:53:00 ot Exp $
+# $Id: checklink,v 4.24 2005-10-25 00:36:04 ot Exp $
 #
 # This program is licensed under the W3C(r) Software License:
 #       http://www.w3.org/Consortium/Legal/copyright-software
@@ -148,7 +148,7 @@
   $PROGRAM     = 'W3C-checklink';
   $VERSION     = '4.2.1';
   $REVISION    = sprintf('version %s (c) 1999-2005 W3C', $VERSION);
-  my ($cvsver) = q$Revision: 4.23 $ =~ /(\d+[\d\.]*\.\d+)/;
+  my ($cvsver) = q$Revision: 4.24 $ =~ /(\d+[\d\.]*\.\d+)/;
   $AGENT       = sprintf('%s/%s [%s] %s',
                          $PROGRAM, $VERSION, $cvsver, LWP::Parallel::RobotUA->_agent());
 
@@ -1182,14 +1182,10 @@
   foreach (keys %$entries) {
   my $uri;
   my $response = $entries->{$_}->response;  
-  if (defined $response->request) {
-    $uri = $response->request->url();
-  }
-  else {
-  # try (for 401s or other cases, back to the previous)
-    $uri = $response->previous()->request()->url();
-  }
-  # Get the results
+  print $response->as_string;
+  next if ($response->code() == 403);
+  $uri = $response->request->url() || die "something went wrong with a request, exiting: $!";
+   # Get the results
   # Record the very first response
   if (! defined($code)) {
     ($code, $message) = delete(@$ua{qw(FirstResponse FirstMessage)});
@@ -1536,8 +1532,8 @@
 
     
 
+    
   foreach my $uri (keys %responses) {  
-  
     my $response = $responses{$uri};
     my $method = $methods{$uri};
     # Get the information back from get_uri()

Received on Thursday, 5 August 2010 14:47:20 UTC