- From: Ville Skytta <ville@dev.w3.org>
- Date: Tue, 01 Jun 2004 22:26:51 +0000
- To: www-validator-cvs@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 UTC