summaryrefslogtreecommitdiffstats
path: root/httpd
diff options
context:
space:
mode:
authorVille Skytt? <ville.skytta@iki.fi>2011-03-10 22:48:10 +0200
committerVille Skytt? <ville.skytta@iki.fi>2011-03-10 22:48:10 +0200
commitbe3f731d145652618cda8a08b7a6d13468cdb84b (patch)
tree5563bd8c733418964caaed410566e45a9e07054d /httpd
parentb8785f7752585e5d3d79409e99164e838159c799 (diff)
downloadmarkup-validator-be3f731d145652618cda8a08b7a6d13468cdb84b.zip
markup-validator-be3f731d145652618cda8a08b7a6d13468cdb84b.tar.gz
markup-validator-be3f731d145652618cda8a08b7a6d13468cdb84b.tar.bz2
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).
Diffstat (limited to 'httpd')
-rwxr-xr-xhttpd/cgi-bin/check35
-rw-r--r--httpd/conf/httpd.conf15
2 files changed, 11 insertions, 39 deletions
diff --git a/httpd/cgi-bin/check b/httpd/cgi-bin/check
index e06fce3..6cd4d2e 100755
--- a/httpd/cgi-bin/check
+++ b/httpd/cgi-bin/check
@@ -2795,37 +2795,6 @@ sub prepCGI
$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 @@ sub prepCGI
}
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 --git a/httpd/conf/httpd.conf b/httpd/conf/httpd.conf
index 254e1bd..87efd20 100644
--- a/httpd/conf/httpd.conf
+++ b/httpd/conf/httpd.conf
@@ -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 @@ AliasMatch ^/+w3c-validator/+feedback(\.html)?$ \
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 @@ Alias /w3c-validator/ /usr/local/validator/htdocs/
<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]