validator/httpd/cgi-bin check,1.767,1.768

Update of /sources/public/validator/httpd/cgi-bin
In directory hutz:/tmp/cvs-serv3242/httpd/cgi-bin

Modified Files:
	check 
Log Message:
Drop support for HTML-(Head)Parser < 3.60.

Index: check
===================================================================
RCS file: /sources/public/validator/httpd/cgi-bin/check,v
retrieving revision 1.767
retrieving revision 1.768
diff -u -d -r1.767 -r1.768
--- check	2 Mar 2010 19:28:35 -0000	1.767
+++ check	3 Mar 2010 19:13:29 -0000	1.768
@@ -50,17 +50,18 @@
                                   # e.g gb18030
 use File::Spec::Functions qw(catfile rel2abs tmpdir);
 use HTML::Encoding 0.52 qw();
-use HTML::Parser 3.24 qw();       # Need 3.24 for $p->parse($code_ref)
-use HTML::Template 2.6 qw();      # Need 2.6 for path param, other things.
+use HTML::HeadParser 3.60 qw();    # Needed for HTML5 meta charset workaround
+use HTML::Parser 3.24 qw();        # Need 3.24 for $p->parse($code_ref)
+use HTML::Template 2.6 qw();       # Need 2.6 for path param, other things.
 use HTTP::Headers::Util qw();
-use HTTP::Message 1.52 qw();      # Need 1.52 for decoded_content()
+use HTTP::Message 1.52 qw();       # Need 1.52 for decoded_content()
 use HTTP::Request qw();
-use HTTP::Headers::Auth qw();     # Needs to be imported after other HTTP::*.
+use HTTP::Headers::Auth qw();      # Needs to be imported after other HTTP::*.
 use JSON 2.00 qw();
 use SGML::Parser::OpenSP 0.991 qw();
 use URI qw();
 use URI::Escape qw(uri_escape);
-use XML::LibXML 1.56 qw();        # Need 1.56 for line_numbers()
+use XML::LibXML 1.56 qw();         # Need 1.56 for line_numbers()
 
 ###############################################################################
 #### Constant definitions. ####################################################
@@ -3124,35 +3125,27 @@
         # HTML::Encoding doesn't support HTML5 <meta charset> as of 0.60,
         # check it ourselves.  HTML::HeadParser >= 3.60 is required for this.
 
-        if (eval {
-                local $SIG{__DIE__} = undef;
-                require HTML::HeadParser;
-                HTML::HeadParser->VERSION(3.60);
-            }
-            )
-        {
-            my $hp           = HTML::HeadParser->new();
-            my $seen_doctype = FALSE;
-            my $is_html5     = FALSE;
-            $hp->handler(
-                declaration => sub {
-                    my ($tag, $text) = @_;
-                    return if ($seen_doctype || uc($tag) ne '!DOCTYPE');
-                    $seen_doctype = TRUE;
-                    $is_html5     = TRUE
-                        if (
-                        $text =~ /<!DOCTYPE\s+html
+        my $hp           = HTML::HeadParser->new();
+        my $seen_doctype = FALSE;
+        my $is_html5     = FALSE;
+        $hp->handler(
+            declaration => sub {
+                my ($tag, $text) = @_;
+                return if ($seen_doctype || uc($tag) ne '!DOCTYPE');
+                $seen_doctype = TRUE;
+                $is_html5     = TRUE
+                    if (
+                    $text =~ /<!DOCTYPE\s+html
                                     (\s+SYSTEM\s+(['"])about:legacy-compat\2)?
                                     \s*>/six
-                        );
-                },
-                'tag,text'
-            );
-            $hp->parse($File->{Bytes});
-            if ($is_html5) {
-                my $cs = $hp->header('X-Meta-Charset');
-                $metah{lc($cs)}++ if (defined($cs) && length($cs));
-            }
+                    );
+            },
+            'tag,text'
+        );
+        $hp->parse($File->{Bytes});
+        if ($is_html5) {
+            my $cs = $hp->header('X-Meta-Charset');
+            $metah{lc($cs)}++ if (defined($cs) && length($cs));
         }
     }
 

Received on Wednesday, 3 March 2010 19:13:33 UTC