W3C home > Mailing lists > Public > www-validator-cvs@w3.org > June 2004

perl/modules/W3C/LinkChecker/bin checklink,3.49,3.50

From: Ville Skytta <ville@dev.w3.org>
Date: Tue, 01 Jun 2004 22:26:51 +0000
To: www-validator-cvs@w3.org
Message-Id: <20040601222651.63C9A4A850@hutz.w3.org>

Update of /sources/public/perl/modules/W3C/LinkChecker/bin
In directory hutz:/tmp/cvs-serv7267

Modified Files:
	checklink 
Log Message:
Avoid error log warning when no Content-Type is received, improve markup.

Index: checklink
===================================================================
RCS file: /sources/public/perl/modules/W3C/LinkChecker/bin/checklink,v
retrieving revision 3.49
retrieving revision 3.50
diff -u -d -r3.49 -r3.50
--- checklink	1 Jun 2004 21:55:53 -0000	3.49
+++ checklink	1 Jun 2004 22:26:49 -0000	3.50
@@ -865,18 +865,24 @@
 
   # Can we parse the document?
   my $failed_reason;
-  if ((my $ct = $response->header('Content-Type')) !~ $ContentTypes) {
-    $failed_reason = "Content-Type for '$request_uri' is '$ct'";
-  } elsif ($response->header('Content-Encoding') &&
-           ((my $ce = $response->header('Content-Encoding')) ne 'identity')) {
+  my $ct = $response->header('Content-Type');
+  my $ce = $response->header('Content-Encoding');
+  if (!$ct || $ct !~ $ContentTypes) {
+    $failed_reason = "Content-Type for <$request_uri> is " .
+      (defined($ct) ? "'$ct'" : 'undefined');
+  } elsif (defined($ce) && $ce ne 'identity') {
     # @@@ We could maybe handle gzip...
-    $failed_reason = "Content-Encoding for '$request_uri' is '$ce'";
+    $failed_reason = "Content-Encoding for <$request_uri> is '$ce'";
   }
   if ($failed_reason) {
     # No, there is a problem...
     if (! $in_recursion) {
-      &html_header($uri) if $Opts{HTML};
+      if ($Opts{HTML}) {
+        &html_header($uri);
+        print "<p>\n";
+      }
       &hprintf("Can't check links: %s.\n", $failed_reason);
+      print "</p>\n" if $Opts{HTML};
     }
     $response->{Stop} = 1;
   }
Received on Tuesday, 1 June 2004 18:43:33 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 26 April 2012 12:54:45 GMT