diff options
author | duerst <duerst@localhost> | 2002-10-12 12:55:23 +0000 |
---|---|---|
committer | duerst <duerst@localhost> | 2002-10-12 12:55:23 +0000 |
commit | 97e216c24d611d106005fed9ef37a9ca6da4c84e (patch) | |
tree | c33bb4e50133f388c37ff0e7594dacb8a59c4598 | |
parent | 3b6c83c98e59d1a4b040d2c12321cd236e45e131 (diff) | |
download | markup-validator-97e216c24d611d106005fed9ef37a9ca6da4c84e.zip markup-validator-97e216c24d611d106005fed9ef37a9ca6da4c84e.tar.gz markup-validator-97e216c24d611d106005fed9ef37a9ca6da4c84e.tar.bz2 |
- saved original Content-Type in addition to type
- matching both text/*+xml and text/xml (and same for application) now
- extending matching to include '.' and '-' in * above
-rwxr-xr-x | httpd/cgi-bin/check | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/httpd/cgi-bin/check b/httpd/cgi-bin/check index dddc5da..e2d3e76 100755 --- a/httpd/cgi-bin/check +++ b/httpd/cgi-bin/check @@ -9,7 +9,7 @@ # This source code is available under the license at: # http://www.w3.org/Consortium/Legal/copyright-software # -# $Id: check,v 1.250 2002-10-12 10:12:24 link Exp $ +# $Id: check,v 1.251 2002-10-12 12:55:23 duerst Exp $ # # Disable buffering on STDOUT! @@ -95,7 +95,7 @@ BEGIN { # # Strings - $VERSION = q$Revision: 1.250 $; + $VERSION = q$Revision: 1.251 $; $VERSION =~ s/Revision: ([\d\.]+) /$1/; @@ -151,7 +151,7 @@ $File->{'Header'} = &prepSSI({ }); $File->{'Footer'} = &prepSSI({ File => $CFG->{'Footer'}, - Date => q$Date: 2002-10-12 10:12:24 $, + Date => q$Date: 2002-10-12 12:55:23 $, }); # @@ -258,7 +258,7 @@ $File = &find_xml_encoding ($File); # if ($File->{Charset}->{HTTP}) { # HTTP, if given, is authoritative. $File->{Charset}->{Use} = $File->{Charset}->{HTTP}; -} elsif ($File->{Type} =~ m(^text/\w+\+xml$)) { +} elsif ($File->{ContentType} =~ m(^text/([-.a-zA-Z0-9]\+)?xml$)) { # Act as if $http_charset was 'us-ascii'. (MIME rules) $File->{Charset}->{Use} = 'us-ascii'; &add_warning($File, <<".EOF."); @@ -275,7 +275,7 @@ if ($File->{Charset}->{HTTP}) { # HTTP, if given, is authoritative. $File->{Charset}->{Use} = $File->{Charset}->{XML}; } elsif ($File->{Charset}->{Auto} =~ /^utf-16[bl]e$/ && $File->{BOM} == 2) { $File->{Charset}->{Use} = 'utf-16'; -} elsif ($File->{Type} =~ m(^application/\w+\+xml$)) { +} elsif ($File->{ContentType} =~ m(^application/([-.a-zA-Z0-9]+\+)?xml$)) { $File->{Charset}->{Use} = "utf-8"; } @@ -1135,7 +1135,7 @@ sub handle_uri { exit; } - my($type, $charset) = &parse_content_type($File, $res->header('Content-Type')); + my($type, $ct, $charset) = &parse_content_type($File, $res->header('Content-Type')); my $lastmod = undef; if ( $res->last_modified ) { @@ -1144,6 +1144,7 @@ sub handle_uri { $File->{Bytes} = $res->content; $File->{Type} = $type; + $File->{ContentType} = $ct; $File->{Charset}->{HTTP} = lc $charset; $File->{Modified} = $lastmod; $File->{Server} = scalar $res->server; @@ -1168,10 +1169,11 @@ sub handle_file { local $/ = undef; # set line delimiter so that <> reads rest of file $file = <$f>; - my($type, $charset) = &parse_content_type($File, $h->{'Content-Type'}); + my($type, $ct, $charset) = &parse_content_type($File, $h->{'Content-Type'}); $File->{Bytes} = $file; $File->{Type} = $type; + $File->{ContentType} = $ct; $File->{Charset}->{HTTP} = lc $charset; $File->{Modified} = $h->{'Last-Modified'}; $File->{Server} = $h->{'Server'}; @@ -1234,7 +1236,7 @@ sub parse_content_type { EOF } - return $type, $charset; + return $type, $ct, $charset; } |