W3C home > Mailing lists > Public > www-validator-cvs@w3.org > September 2009

validator/httpd/cgi-bin check,1.691,1.692

From: Ville Skytta via cvs-syncmail <cvsmail@w3.org>
Date: Tue, 15 Sep 2009 19:05:57 +0000
To: www-validator-cvs@w3.org
Message-Id: <E1MndLh-0001IU-EA@lionel-hutz.w3.org>
Update of /sources/public/validator/httpd/cgi-bin
In directory hutz:/tmp/cvs-serv4966

Modified Files:
	check 
Log Message:
Fix setting Content-Type for validator.nu POSTs in non-overridden direct input mode (#6747).

Index: check
===================================================================
RCS file: /sources/public/validator/httpd/cgi-bin/check,v
retrieving revision 1.691
retrieving revision 1.692
diff -u -d -r1.691 -r1.692
--- check	15 Sep 2009 19:01:06 -0000	1.691
+++ check	15 Sep 2009 19:05:55 -0000	1.692
@@ -824,6 +824,7 @@
 }
 &abort_if_error_flagged($File, 0);
 
+# TODO: need to bring in fixes from html5_validate() here
 sub compoundxml_validate (\$) {
   my $File = shift;
   my $ua = new W3C::Validator::UserAgent ($CFG, $File);
@@ -976,12 +977,9 @@
     # differences as long as our transcoding process does not "fix" the
     # charset info in XML declaration, meta http-equiv/charset and/or BOM
     # (any others?).
-    if($File->{'Direct Input'}) { # sane default when using html5 validator by direct input
-        $req->content_type("text/html; charset=UTF-8");
-    }
-    else {
-        $req->content_type("$File->{ContentType}; charset=UTF-8");
-    }
+
+    my $ct = $File->{'Direct Input'} ? "text/html" : $File->{ContentType};
+    $req->content_type("$ct; charset=UTF-8");
     $req->content(Encode::encode_utf8(join("\n", @{$File->{Content}})));
   }
   else {
@@ -990,11 +988,15 @@
     # is the same later when displaying error contexts (regardless of EOL chars
     # used in the document).
 
-    my @content_type = ($File->{ContentType} => undef);
-    push(@content_type, charset => $File->{Charset}->{HTTP})
-      if $File->{Charset}->{HTTP};
-
-    $req->content_type(HTTP::Headers::Util::join_header_words(@content_type));
+    if ($File->{'Direct Input'}) {
+      $req->content_type("text/html; 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));
+    }
     $req->content_ref(\$File->{Bytes});
   }
 
Received on Tuesday, 15 September 2009 19:06:05 GMT

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