W3C home > Mailing lists > Public > www-validator-cvs@w3.org > November 2009

perl/modules/W3C/LinkChecker/bin checklink.pod,1.26,1.27 checklink,4.167,4.168

From: Michael Ernst via cvs-syncmail <cvsmail@w3.org>
Date: Wed, 04 Nov 2009 18:44:19 +0000
To: www-validator-cvs@w3.org
Message-Id: <E1N5kqB-0001Qr-OE@lionel-hutz.w3.org>
Update of /sources/public/perl/modules/W3C/LinkChecker/bin
In directory hutz:/tmp/cvs-serv5407/bin

Modified Files:
	checklink.pod checklink 
Log Message:
Permit spaces to delimit the parts of the arguments for --suppress-redirect,
--suppress-redirect-prefix, and --suppress-broken.
Add --suppress-temp-redirects to suppress warnings about temporary redirects.


Index: checklink
===================================================================
RCS file: /sources/public/perl/modules/W3C/LinkChecker/bin/checklink,v
retrieving revision 4.167
retrieving revision 4.168
diff -u -d -r4.167 -r4.168
--- checklink	5 Oct 2009 15:07:54 -0000	4.167
+++ checklink	4 Nov 2009 18:44:17 -0000	4.168
@@ -409,6 +409,7 @@
     Suppress_Redirect => [],
     Suppress_Redirect_Prefix => [],
     Suppress_Redirect_Regexp => [],
+    Suppress_Temp_Redirects => 1,
     Suppress_Broken   => [],
     Suppress_Fragment => [],
     Masquerade        => 0,
@@ -649,6 +650,7 @@
              'exclude-docs=s@' => \@{$Opts{Exclude_Docs}},
              'suppress-redirect=s@' => \@{$Opts{Suppress_Redirect}},
              'suppress-redirect-prefix=s@' => \@{$Opts{Suppress_Redirect_Prefix}},
+             'suppress-temp-redirects' => \$Opts{Suppress_Temp_Redirects},
              'suppress-broken=s@' => \@{$Opts{Suppress_Broken}},
              'suppress-fragment=s@' => \@{$Opts{Suppress_Fragment}},
              'u|user=s'        => \$Opts{User},
@@ -709,21 +711,27 @@
   }
 
   # Sanity-check error-suppression arguments
-  for my $sr_arg (@{$Opts{Suppress_Redirect}}) {
+  for my $i (0..$#{$Opts{Suppress_Redirect}}) {
+    ${$Opts{Suppress_Redirect}}[$i] =~ s/ /->/;
+    my $sr_arg = ${$Opts{Suppress_Redirect}}[$i];
     if ($sr_arg !~ /.->./) {
       &usage(1, "Bad suppress-redirect argument, should contain \"->\": $sr_arg");
     }
   }
-  for my $srp_arg (@{$Opts{Suppress_Redirect_Prefix}}) {
+  for my $i (0..$#{$Opts{Suppress_Redirect_Prefix}}) {
+    my $srp_arg = ${$Opts{Suppress_Redirect_Prefix}}[$i];
+    $srp_arg =~ s/ /->/;
     if ($srp_arg !~ /^(.*)->(.*)$/) {
       &usage(1, "Bad suppress-redirect-prefix argument, should contain \"->\": $srp_arg");
     }
     # Turn prefixes into a regexp.
-    push @{$Opts{Suppress_Redirect_Regexp}}, qr/^\Q$1\E(.*)->\Q$2\E\1$/ism;
+    ${$Opts{Suppress_Redirect_Prefix}}[$i] = qr/^\Q$1\E(.*)->\Q$2\E\1$/ism;
   }
-  for my $sb_arg (@{$Opts{Suppress_Broken}}) {
+  for my $i (0..$#{$Opts{Suppress_Broken}}) {
+    ${$Opts{Suppress_Broken}}[$i] =~ s/ /:/;
+    my $sb_arg = ${$Opts{Suppress_Broken}}[$i];
     if ($sb_arg !~ /^(-1|[0-9]+):./) {
-      &usage(1, "Bad suppress-broken argument: $sb_arg");
+      &usage(1, "Bad suppress-broken argument, should be prefixed by a numeric response code: $sb_arg");
     }
   }
   for my $sf_arg (@{$Opts{Suppress_Fragment}}) {
@@ -780,6 +788,7 @@
  --suppress-redirect-prefix URI->URI  Do not report a redirect from a child of
                             the first URI to the same child of the second URI.
                             This option may be specified multiple times.
+ --suppress-temp-redirects  Suppress warnings about temporary redirects.
  --suppress-broken CODE:URI  Do not report a broken link with the given CODE.
                             CODE is HTTP response, or -1 for robots exclusion.
                             This option may be specified multiple times.
@@ -1962,10 +1971,15 @@
     # print STDERR "Result $match of redirect checking $from_to\n";
     if ($match) { next; }
 
-    $match = grep { $from_to =~ /$_/ } @{$Opts{Suppress_Redirect_Regexp}};
+    $match = grep { $from_to =~ /$_/ } @{$Opts{Suppress_Redirect_Prefix}};
     # print STDERR "Result $match of regexp checking $from_to\n";
     if ($match) { next; }
 
+    my $c = $prev->code();
+    if ($Opts{Suppress_Temp_Redirects} && (($c eq 307) || ($c eq 302))) {
+      next;
+    }
+
     $redirects->{$prev->request()->url()} = $response->request()->url();
   }
   return;

Index: checklink.pod
===================================================================
RCS file: /sources/public/perl/modules/W3C/LinkChecker/bin/checklink.pod,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- checklink.pod	29 Jun 2009 20:14:38 -0000	1.26
+++ checklink.pod	4 Nov 2009 18:44:17 -0000	1.27
@@ -82,19 +82,26 @@
 =item B<--suppress-redirect> I<URI-E<gt>URI>
 
 Do not report a redirect from the first to the second URI.  The "-E<gt>" is
-literal text.  This option may be specified multiple times.
+literal text.  This option may be specified multiple times.  Whitespace may
+be used instead of "-E<gt>" to separate the URIs.
 
 =item B<--suppress-redirect-prefix I<URI-E<gt>URI>
 
 Do not report a redirect from a child of the first URI to the same child of
 the second URI.  The \"->\" is literal text.  This option may be specified
-multiple times.
+multiple times.  Whitespace may be used instead of "-E<gt>" to separate the
+URIs.
+
+=item B<--suppress-temp-redirects>
+
+Do not report warnings about temporary redirects.
 
 =item B<--suppress-broken> I<CODE:URI>
 
 Do not report a broken link with the given CODE.  CODE is the HTTP
 response, or -1 for robots exclusion.  The ":" is literal text.  This
-option may be specified multiple times.
+option may be specified multiple times.  Whitespace may be used instead of
+":" to separate the CODE and the URI.
 
 =item B<--suppress-fragment> I<URI>
 
Received on Wednesday, 4 November 2009 18:44:21 UTC

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