diff options
author | link <link@localhost> | 2002-11-02 16:36:10 +0000 |
---|---|---|
committer | link <link@localhost> | 2002-11-02 16:36:10 +0000 |
commit | 4fe1626c6507fe597fefc0a049e2004c15eede26 (patch) | |
tree | 4be1db19dea936df444597d6be29cc7da7c73554 | |
parent | 6ce12b7c3bf0669623cecb5b2d76ccc1f9d2d08d (diff) | |
download | markup-validator-4fe1626c6507fe597fefc0a049e2004c15eede26.zip markup-validator-4fe1626c6507fe597fefc0a049e2004c15eede26.tar.gz markup-validator-4fe1626c6507fe597fefc0a049e2004c15eede26.tar.bz2 |
Applying patch from Frederic Schutz, fixing the redirect code (which I
broke in the last version ;D). Thanks Frederic!
-rwxr-xr-x | httpd/cgi-bin/check | 42 |
1 files changed, 25 insertions, 17 deletions
diff --git a/httpd/cgi-bin/check b/httpd/cgi-bin/check index bfefb0e..20185be 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.280 2002-10-30 21:47:00 link Exp $ +# $Id: check,v 1.281 2002-11-02 16:36:10 link Exp $ # # Disable buffering on STDOUT! @@ -95,7 +95,7 @@ BEGIN { # # Strings - $VERSION = q$Revision: 1.280 $; + $VERSION = q$Revision: 1.281 $; $VERSION =~ s/Revision: ([\d\.]+) /$1/; @@ -157,7 +157,7 @@ $File->{'Header'} = &prepSSI({ }); $File->{'Footer'} = &prepSSI({ File => $CFG->{'Footer'}, - Date => q$Date: 2002-10-30 21:47:00 $, + Date => q$Date: 2002-11-02 16:36:10 $, }); # @@ -1936,13 +1936,7 @@ sub prepCGI { if ($q->path_info eq '/referer') { $q->param('uri', 'referer'); } else { - my $thispage = $File->{Env}->{'Self URI'}; - $thispage .= '?uri=' . $q->param('uri'); - $thispage .= ';ss=1' if $q->param('ss'); - $thispage .= ';sp=1' if $q->param('sp'); - $thispage .= ';noatt=1' if $q->param('noatt'); - $thispage .= ';outline=1' if $q->param('outline'); - + my $thispage = &self_url($q); print $q->redirect($thispage); exit; } @@ -1976,13 +1970,7 @@ sub prepCGI { # Redirect to a GETable URL if method is POST without a file upload. if ($q->request_method eq 'POST' and not $File->{'Is Upload'}) { - my $thispage = $File->{Env}->{'Self URI'}; - $thispage .= '?uri=' . $q->param('uri'); - $thispage .= ';ss=1' if $q->param('ss'); - $thispage .= ';sp=1' if $q->param('sp'); - $thispage .= ';noatt=1' if $q->param('noatt'); - $thispage .= ';outline=1' if $q->param('outline'); - + my $thispage = &self_url($q); print $q->redirect($thispage); exit; } @@ -2715,3 +2703,23 @@ sub popup_charset { ], ); } + +# +# Construct a self-referential URL. +sub self_url { + my $q = shift; + my $thispage = $File->{Env}->{'Self URI'}; + $thispage .= '?uri=' . $q->param('uri'); + $thispage .= ';ss=1' if $q->param('ss'); + $thispage .= ';sp=1' if $q->param('sp'); + $thispage .= ';noatt=1' if $q->param('noatt'); + $thispage .= ';outline=1' if $q->param('outline'); + if ($q->param('doctype') + and not $q->param('doctype') =~ /(Inline|detect)/i) { + $thispage .= ';doctype=' . $q->param('doctype'); + } + if ($q->param('charset') and not $q->param('charset') =~ /detect/i) { + $thispage .= ';charset=' . $q->param('charset'); + } + return $thispage; +} |