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

link-checker commit: Avoid error log warning when no Content-Type is received, improve markup.

From: Mercurial notifier <nobody@w3.org>
Date: Thu, 05 Aug 2010 14:46:59 +0000
To: link-checker updates <www-validator-cvs@w3.org>
Message-Id: <E1Oh1il-0005dP-88@blinky.w3.org>
changeset:   79:7c44e961b2d7
user:        ville
date:        Tue Jun 01 22:26:49 2004 +0000
files:       bin/checklink
description:
Avoid error log warning when no Content-Type is received, improve markup.


diff -r 9379c4c529f0 -r 7c44e961b2d7 bin/checklink
--- a/bin/checklink	Tue Jun 01 21:55:54 2004 +0000
+++ b/bin/checklink	Tue Jun 01 22:26:49 2004 +0000
@@ -5,7 +5,7 @@
 # (c) 1999-2004 World Wide Web Consortium
 # based on Renaud Bruyeron's checklink.pl
 #
-# $Id: checklink,v 3.49 2004-06-01 21:55:53 ville Exp $
+# $Id: checklink,v 3.50 2004-06-01 22:26:49 ville Exp $
 #
 # This program is licensed under the W3C(r) Software License:
 #       http://www.w3.org/Consortium/Legal/copyright-software
@@ -112,7 +112,7 @@
   $PACKAGE       = 'W3C Link Checker';
   $PROGRAM       = 'W3C-checklink';
   $VERSION       = '3.9.3-dev';
-  my ($cvsver)   = q$Revision: 3.49 $ =~ /(\d+[\d\.]*\.\d+)/;
+  my ($cvsver)   = q$Revision: 3.50 $ =~ /(\d+[\d\.]*\.\d+)/;
   $REVISION      = sprintf('version %s [%s] (c) 1999-2004 W3C',
                            $VERSION, $cvsver);
   $AGENT         = sprintf('%s/%s [%s] %s',
@@ -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 Thursday, 5 August 2010 14:47:14 UTC

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