- From: Olivier Thereaux via cvs-syncmail <cvsmail@w3.org>
- Date: Fri, 20 Jun 2008 08:51:04 +0000
- To: www-validator-cvs@w3.org
Update of /sources/public/validator/httpd/cgi-bin In directory hutz:/tmp/cvs-serv29974/httpd/cgi-bin Modified Files: check Log Message: applying patch for the forwarding of accept-* headers in the case of referer validation - as proposed and submitted by Etienne Miret - see thread http://www.w3.org/Search/Mail/Public/search?keywords=&hdr-1-name=subject&hdr-1-query=Content-Negotiation+in+check+referer+requests&index-type=t&type-index=www-validator Index: check =================================================================== RCS file: /sources/public/validator/httpd/cgi-bin/check,v retrieving revision 1.588 retrieving revision 1.589 diff -u -d -r1.588 -r1.589 --- check 5 May 2008 03:30:18 -0000 1.588 +++ check 20 Jun 2008 08:51:01 -0000 1.589 @@ -1115,6 +1115,17 @@ my $over_charset_param = "override charset $File->{Opt}->{Charset}"; $T->param($over_charset_param => TRUE); } + + # Allow content-negotiation + if ($File->{Opt}->{'Accept Header'}) { + $T->param('accept' => $File->{Opt}->{'Accept Header'}); + } + if ($File->{Opt}->{'Accept-Language Header'}) { + $T->param('accept-language' => $File->{Opt}->{'Accept-Language Header'}); + } + if ($File->{Opt}->{'Accept-Charset Header'}) { + $T->param('accept-charset' => $File->{Opt}->{'Accept-Charset Header'}); + } if ($File->{'Error Flagged'}) { $T->param(fatal_error => TRUE); @@ -2073,6 +2084,9 @@ foreach my $param ($q->param) { next if $param eq 'uploaded_file'; # 'uploaded_file' contains data. next if $param eq 'fragment'; # Ditto 'fragment'. + next if $param eq 'accept'; # Original checking had a specific Accept: header sent. + next if $param eq 'accept-language'; # Ditto Accept-Language:. + next if $param eq 'accept-charset'; # Ditto Accept-Charset:. next if $q->param($param) eq '0'; # Keep false-but-set params. # @@ -2128,6 +2142,9 @@ if ($q->param('uri') and $q->param('uri') eq 'referer') { if ($q->referer) { $q->param('uri', $q->referer); + $q->param('accept',$q->http('Accept')) if ($q->http('Accept')); + $q->param('accept-language',$q->http('Accept-Language')) if ($q->http('Accept-Language')); + $q->param('accept-charset',$q->http('Accept-Charset')) if ($q->http('Accept-Charset')); print redirect &self_url_q($q, $File); exit; } else { @@ -2515,6 +2532,9 @@ $thispage .= 'No200=1;' if $q->param('No200'); $thispage .= 'verbose=1;' if $q->param('verbose'); $thispage .= 'group=1;' if $q->param('group'); + $thispage .= 'accept=' . uri_escape($q->param('accept')) . ';' if $q->param('accept'); + $thispage .= 'accept-language='. uri_escape($q->param('accept-language')) .';' if $q->param('accept-language'); + $thispage .= 'accept-charset='. uri_escape($q->param('accept-charset')) .';' if $q->param('accept-charset'); if ($q->param('doctype') and not $q->param('doctype') =~ /(Inline|detect)/i) { @@ -2551,6 +2571,9 @@ $thispage .= ';sp=1' if $File->{Opt}->{'Show Parsetree'}; $thispage .= ';noatt=1' if $File->{Opt}->{'No Attributes'}; $thispage .= ';outline=1' if $File->{Opt}->{'Outline'}; + $thispage .= 'accept=' . uri_escape($File->{Opt}->{'Accept Header'}) . ';' if $File->{Opt}->{'Accept Header'}; + $thispage .= 'accept-language=' . uri_escape($File->{Opt}->{'Accept-Language Header'}) .';' if $File->{Opt}->{'Accept-Language Header'}; + $thispage .= 'accept-charset=' . uri_escape($File->{Opt}->{'Accept-Charset Header'}) .';' if $File->{Opt}->{'Accept-Charset Header'}; # These were not added by report_valid; perhaps they should be? # $thispage .= ';verbose=1' if $File->{Opt}->{'Verbose'}; @@ -2674,6 +2697,7 @@ { my $self = shift; my $error = shift; + # my $mess = $self->{_parser}->split_message($error); my $mess; eval { $mess = $self->{_parser}->split_message($error);
Received on Friday, 20 June 2008 08:51:40 UTC