W3C home > Mailing lists > Public > www-validator-cvs@w3.org > October 2006

perl/modules/W3C/XHTML/HTMLCompatChecker/bin appCcheck.pl,1.38,1.39

From: Olivier Thereaux via cvs-syncmail <cvsmail@w3.org>
Date: Thu, 05 Oct 2006 04:53:45 +0000
To: www-validator-cvs@w3.org
Message-Id: <E1GVLEv-0003Dk-Pc@lionel-hutz.w3.org>

Update of /sources/public/perl/modules/W3C/XHTML/HTMLCompatChecker/bin
In directory hutz:/tmp/cvs-serv9013

Modified Files:
	appCcheck.pl 
Log Message:

As explained in http://search.cpan.org/~gaas/libwww-perl-5.69/lib/HTTP/Headers.pm#DESCRIPTION
the value returned by the header() method of the HTTTP::Response class may
be a comma separated list of values, or an array - if several Content-Type headers are given.
(which may happen if e.g header and meta information is given)
Changing the code to request an array and parsing only the first value given.




Index: appCcheck.pl
===================================================================
RCS file: /sources/public/perl/modules/W3C/XHTML/HTMLCompatChecker/bin/appCcheck.pl,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -d -r1.38 -r1.39
--- appCcheck.pl	5 Oct 2006 04:35:19 -0000	1.38
+++ appCcheck.pl	5 Oct 2006 04:53:42 -0000	1.39
@@ -138,6 +138,7 @@
     if ($ct ne "text/html") {
             $IS_RELEVANT_CT = 0;
     } 
+    return $ct;
 }
 
 
@@ -476,12 +477,14 @@
      my $response = $ua->get($uri);
      my $xml = undef;
      my $ct = undef;
+     my @content_type_values = undef;
      if ($response->is_success) {
          $xml =  $response->content;
-         $ct = $response->header('Content-Type');
+         @content_type_values = $response->header('Content-Type');
+         $ct = $content_type_values[0];
     }
     if (defined $ct and length $ct) {
-        &parse_content_type($ct);
+        $ct = &parse_content_type($ct);
         $output->param(content_type => $ct);
     }
     
Received on Thursday, 5 October 2006 04:53:48 GMT

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