W3C home > Mailing lists > Public > www-validator-cvs@w3.org > March 2011

markup-validator commit: Remove internal support for /check/referer, do it in httpd.conf instead.

From: Mercurial notifier <nobody@w3.org>
Date: Thu, 10 Mar 2011 20:48:18 +0000
Message-Id: <E1PxmmQ-0005Ef-RA@mcbain.w3.org>
To: markup-validator updates <www-validator-cvs@w3.org>
changeset:   3213:c2a8c311f2b4
tag:         tip
user:        Ville Skyttä <ville.skytta@iki.fi>
date:        Thu Mar 10 22:48:10 2011 +0200
files:       httpd/cgi-bin/check httpd/conf/httpd.conf
description:
Remove internal support for /check/referer, do it in httpd.conf instead.

/check/referer has been deprecated in favor of /check?uri=referer
since 2003 (validator 0.6.5 beta 1).


diff -r 6595643c8f61 -r c2a8c311f2b4 httpd/cgi-bin/check
--- a/httpd/cgi-bin/check	Thu Mar 10 22:43:57 2011 +0200
+++ b/httpd/cgi-bin/check	Thu Mar 10 22:48:10 2011 +0200
@@ -2795,37 +2795,6 @@
         $q->param($param, TRUE) unless $q->param($param);
     }
 
-    my $path_info = $q->path_info();
-
-    # IIS reportedly does not provide the $path_info we expect - hack around it.
-    $path_info =~ s|(.*)/check\.pl(.*)$|$2|
-        if ($ENV{SERVER_SOFTWARE} and
-        $ENV{SERVER_SOFTWARE} =~ /Microsoft-IIS/);
-
-    # apparently, with mod_perl2, $path_info is empty even if it should be
-    # filled. working around that
-    if (!$path_info && $File->{Env}->{'Self URI'} =~ /check\/referr?er$/) {
-        $path_info = '/referer';
-        $File->{Env}->{'Self URI'} =~ s/\/referr?er$//;
-    }
-
-    # Futz the URL so "/referer" works.
-    if ($path_info) {
-        if ($path_info =~ m|^/referr?er$|) {
-            if ($q->referer) {
-                $q->param('uri', $q->referer);
-                print redirect &self_url_q($q, $File);
-            }
-            else {
-                print redirect $File->{Env}->{'Self URI'} . '?uri=referer';
-            }
-        }
-        else {
-            print redirect &self_url_q($q, $File);
-        }
-        exit;
-    }
-
     $File->{Env}->{'Home Page'} =
         URI->new_abs(".", $File->{Env}->{'Self URI'});
 
@@ -2851,9 +2820,7 @@
         }
         else {
 
-            # Redirected from /check/referer to /check?uri=referer because
-            # the browser didn't send a Referer header, or the request was
-            # for /check?uri=referer but no Referer header was found.
+            # No Referer header was found.
             $File->{'Error Flagged'} = TRUE;
             &get_error_template($File)->param(fatal_referer_error => TRUE);
         }
diff -r 6595643c8f61 -r c2a8c311f2b4 httpd/conf/httpd.conf
--- a/httpd/conf/httpd.conf	Thu Mar 10 22:43:57 2011 +0200
+++ b/httpd/conf/httpd.conf	Thu Mar 10 22:48:10 2011 +0200
@@ -11,10 +11,16 @@
 # To run the validator without mod_perl 2.x even if it is loaded, comment
 # out the "IfDefine MODPERL2" sections below.
 
-# First, tell httpd that check and sendfeedback.pl are CGI scripts.
+# Legacy: support /check/referer by redirecting to check?uri=referer
 
-AliasMatch ^/+w3c-validator/+check(/+referer)?$ \
-           /usr/local/validator/cgi-bin/check
+<IfModule mod_rewrite.c>
+RewriteEngine On
+RewriteRule ^(/+w3c-validator/+check)/+referr?er\b $1?uri=referer [R=301,QSA,L]
+</IfModule>
+
+# Tell httpd that check and sendfeedback.pl are CGI scripts.
+
+Alias /w3c-validator/check /usr/local/validator/cgi-bin/check
 AliasMatch ^/+w3c-validator/+feedback(\.html)?$ \
            /usr/local/validator/cgi-bin/sendfeedback.pl
 
@@ -23,7 +29,7 @@
 PerlSwitches -T
 </IfDefine>
 
-<LocationMatch "^/+w3c-validator/+(check(/+referer)?|feedback(\.html)?)$">
+<LocationMatch "^/+w3c-validator/+(check|feedback(\.html)?)$">
   Options               +ExecCGI
   SetHandler            cgi-script
 <IfDefine MODPERL2>
@@ -58,7 +64,6 @@
 
   <IfModule mod_rewrite.c>
   Options +SymLinksIfOwnerMatch
-  RewriteEngine On
   RewriteBase /w3c-validator/
   RewriteRule fragment-upload(.html)? detailed.html#validate-by-input [R,L,NE]
   RewriteRule file-upload(.html)? detailed.html#validate-by-upload [R,L,NE]
Received on Thursday, 10 March 2011 20:48:21 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 15:17:45 UTC