validator/httpd/cgi-bin check,1.748,1.749

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

Modified Files:
	check 
Log Message:
Send direct input content that looks like XHTML5 to the HTML5 validator as
application/xhtml+xml.


Index: check
===================================================================
RCS file: /sources/public/validator/httpd/cgi-bin/check,v
retrieving revision 1.748
retrieving revision 1.749
diff -u -d -r1.748 -r1.749
--- check	12 Dec 2009 11:15:13 -0000	1.748
+++ check	12 Dec 2009 11:36:27 -0000	1.749
@@ -1167,6 +1167,7 @@
     $url->query_form(out => "xml");
 
     my $req = HTTP::Request->new(POST => $url);
+    my $ct = &is_xml($File) ? "application/xhtml+xml" : "text/html";
 
     if ($File->{Opt}->{DOCTYPE} || $File->{Charset}->{Override}) {
 
@@ -1177,8 +1178,11 @@
         # charset info in XML declaration, meta http-equiv/charset and/or BOM
         # (any others?).
 
-        my $ct = $File->{'Direct Input'} ? "text/html" : $File->{ContentType};
-        $req->content_type("$ct; charset=UTF-8");
+        $ct = $File->{ContentType} unless $File->{'Direct Input'};
+        my @ct = ($ct => undef, charset => "UTF-8");
+        $ct = HTTP::Headers::Util::join_header_words(@ct);
+
+        $req->content_type($ct);
         $req->content(Encode::encode_utf8(join("\n", @{$File->{Content}})));
     }
     else {
@@ -1189,14 +1193,16 @@
         # chars used in the document).
 
         if ($File->{'Direct Input'}) {
-            $req->content_type("text/html; charset=UTF-8");
+            $ct .= "; charset=UTF-8";
         }
         else {
             my @ct = ($File->{ContentType} => undef);
             push(@ct, charset => $File->{Charset}->{HTTP})
                 if $File->{Charset}->{HTTP};
-            $req->content_type(HTTP::Headers::Util::join_header_words(@ct));
+            $ct = HTTP::Headers::Util::join_header_words(@ct);
         }
+
+        $req->content_type($ct);
         $req->content_ref(\$File->{Bytes});
     }
 

Received on Saturday, 12 December 2009 11:36:31 UTC