- From: Ville Skytta <ville@dev.w3.org>
- Date: Sat, 15 Jan 2005 15:20:41 +0000
- To: www-validator-cvs@w3.org
Update of /sources/public/validator/httpd/cgi-bin In directory hutz:/tmp/cvs-serv14788/httpd/cgi-bin Modified Files: check Log Message: Move more HTML escaping to templates. Index: check =================================================================== RCS file: /sources/public/validator/httpd/cgi-bin/check,v retrieving revision 1.372 retrieving revision 1.373 diff -u -d -r1.372 -r1.373 --- check 9 Jan 2005 20:40:33 -0000 1.372 +++ check 15 Jan 2005 15:20:39 -0000 1.373 @@ -303,6 +303,7 @@ filename => File::Spec->catfile($CFG->{Paths}->{Templates}, $lang, 'result.tmpl'), die_on_bad_params => FALSE, + loop_context_vars => TRUE, ); my $E = HTML::Template->new( filename => File::Spec->catfile($CFG->{Paths}->{Templates}, @@ -415,15 +416,15 @@ $File->{Charset}->{Use} = 'us-ascii'; my @_source; if ($File->{'Is Upload'}) { - @_source = ('sent by your web browser', ($File->{Server}||'unknown'), 'browser send'); + @_source = ('sent by your web browser', &ent($File->{Server}||'unknown'), 'browser send'); } else { - @_source = ('returned by your web server', ($File->{Server}||'unknown'), 'server return'); + @_source = ('returned by your web server', &ent($File->{Server}||'unknown'), 'server return'); } + my $ct = &ent($File->{ContentType}); &add_warning($File, 'note', 'Note:', <<".EOF."); The HTTP Content-Type header $_source[0] ($_source[1]) did not contain a "charset" parameter, but the Content-Type was one of the XML text/* - sub-types (<code>$File->{ContentType}</code>). The relevant - specification + sub-types (<code>$ct</code>). The relevant specification (<a href="http://www.ietf.org/rfc/rfc3023.txt">RFC 3023</a>) specifies a strong default of "us-ascii" for such documents so we will use this value regardless of any encoding you @@ -695,15 +696,15 @@ # # Set debug info for HTML report. $T->param(opt_debug => $DEBUG); - $T->param( - debug => [ - {name => 'Command', value => &ent("@cmd")}, - {name => 'SP_CHARSET_FIXED', value => &ent($ENV{SP_CHARSET_FIXED})}, - {name => 'SP_ENCODING', value => &ent($ENV{SP_ENCODING})}, - {name => 'SP_BCTF', value => &ent($ENV{SP_BCTF})}, - {name => 'Content-Encoding', value => &ent($File->{ContentEnc})}, - {name => 'Transfer-Encoding',value => &ent($File->{TransferEnc})}, - ], + $T->param(debug => + [ + {name => 'Command', value => "@cmd"}, + {name => 'SP_CHARSET_FIXED', value => $ENV{SP_CHARSET_FIXED}}, + {name => 'SP_ENCODING', value => $ENV{SP_ENCODING}}, + {name => 'SP_BCTF', value => $ENV{SP_BCTF}}, + {name => 'Content-Encoding', value => $File->{ContentEnc}}, + {name => 'Transfer-Encoding', value => $File->{TransferEnc}}, + ], ); #FIXME: This needs a UI and testing! @@ -836,8 +837,6 @@ # Get the pretty text version of the FPI if a mapping exists. if (my $prettyver = $CFG->{Types}->{$File->{Version}}->{Display}) { $File->{Version} = $prettyver; -} else { - $File->{Version} = &ent($File->{Version}); } # @@ -937,7 +936,7 @@ # # The URI... - $T->param(file_uri => &ent($File->{URI})); + $T->param(file_uri => $File->{URI}); $T->param(file_uri_param => uri_escape($File->{URI})); # @@ -965,7 +964,7 @@ # # Namespaces... - $T->param(file_namespace => &ent($File->{Namespace})); + $T->param(file_namespace => $File->{Namespace}); # $T->param(file_namespaces => $File->{Namespaces}) # if $File->{Namespaces}; } @@ -1255,7 +1254,7 @@ $File->{TransferEnc} = $res->header('Client-Transfer-Encoding'); $File->{Charset}->{HTTP} = lc $charset; $File->{Modified} = $lastmod; - $File->{Server} = &ent(scalar $res->server); + $File->{Server} = scalar $res->server; $File->{Size} = scalar $res->content_length; $File->{URI} = scalar $res->request->uri->canonical; $File->{'Is Upload'} = FALSE; @@ -1284,7 +1283,7 @@ $File->{ContentType} = $ct; $File->{Charset}->{HTTP} = lc $charset; $File->{Modified} = $h->{'Last-Modified'}; - $File->{Server} = &ent($h->{'User-Agent'}); # Fake a "server". :-) + $File->{Server} = $h->{'User-Agent'}; # Fake a "server". :-) $File->{Size} = $h->{'Content-Length'}; $File->{URI} = "$f"; # Need to stringify because we want ref # to return false later in add_table. This @@ -1865,17 +1864,12 @@ # Create a HTML representation of the document. sub source { my $File = shift; - my $line = 1; - my @source = (); # Remove any BOM since we're not at BOT anymore... $File->{Content}->[0] = substr $File->{Content}->[0], ($File->{BOM} ? 3 : 0); # remove BOM - for (@{$File->{Content}}) { - push @source, {file_source_i => $line, file_source_line => ent $_}; - $line++; - } + my @source = map({file_source_line => $_}, @{$File->{Content}}); return \@source; } @@ -2500,7 +2494,7 @@ <meta> <uri>), &ent($File->{URI}), qq(</uri> <modified>), &ent($File->{Modified}), qq(</modified> - <server>), $File->{Server}, qq(</server> + <server>), &ent($File->{Server}), qq(</server> <size>), &ent($File->{Size}), qq(</size> <encoding>), &ent($File->{Charset}->{Use}), qq(</encoding> <doctype>), &ent($File->{DOCTYPE}), qq(</doctype>
Received on Saturday, 15 January 2005 15:20:42 UTC