diff options
author | link <link@localhost> | 2002-11-19 11:51:41 +0000 |
---|---|---|
committer | link <link@localhost> | 2002-11-19 11:51:41 +0000 |
commit | 81c3f4657d13f01f844c5f446217f407733edd9b (patch) | |
tree | a38ea4e56183ec0bb1999af121f78e15b7e9362a | |
parent | 3ba631e6de3426b8c6a04d3291948717a517ae43 (diff) | |
download | markup-validator-81c3f4657d13f01f844c5f446217f407733edd9b.zip markup-validator-81c3f4657d13f01f844c5f446217f407733edd9b.tar.gz markup-validator-81c3f4657d13f01f844c5f446217f407733edd9b.tar.bz2 |
Resurrect CGI.pm undef()-but-exists workaround.
Given ";param" or ";param=", CGI.pm will set $q->param('param') to a
boolean false value (undef() and '', respectively). By looping over
all params and setting them to TRUE if they are not allready -- skipping
params with the string value '0' to enable ";debug=0" -- we can later
just test for a param's boolean value instead of mucking with defined().
-rwxr-xr-x | httpd/cgi-bin/check | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/httpd/cgi-bin/check b/httpd/cgi-bin/check index 78295eb..d63178c 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.297 2002-11-19 11:27:47 link Exp $ +# $Id: check,v 1.298 2002-11-19 11:51:41 link Exp $ # # Disable buffering on STDOUT! @@ -95,7 +95,7 @@ BEGIN { # # Strings - $VERSION = q$Revision: 1.297 $; + $VERSION = q$Revision: 1.298 $; $VERSION =~ s/Revision: ([\d\.]+) /$1/; @@ -157,7 +157,7 @@ $File->{'Header'} = &prepSSI({ }); $File->{'Footer'} = &prepSSI({ File => $CFG->{'Footer'}, - Date => q$Date: 2002-11-19 11:27:47 $, + Date => q$Date: 2002-11-19 11:51:41 $, }); # @@ -1926,6 +1926,22 @@ sub prepCGI { my $File = shift; my $q = shift; + # Avoid CGI.pm's "exists but undef" behaviour. + if (scalar $q->param) { + foreach my $param ($q->param) { + next if $param eq 'uploaded_file'; # 'uploaded_file' contains data. + next if $q->param($param) eq '0'; # Keep false-but-set params. + # + # Parameters that are given to us without specifying a value get + # set to "1" (the "TRUE" constant). This is so we can test for the + # boolean value of a parameter instead of first checking whether + # the param was given and then testing it's value. Needed because + # CGI.pm sets ";param" and ";param=" to a boolean false value + # (undef() or a null string, respectively). + $q->param($param, TRUE) unless $q->param($param); + } + } + # Futz the URI so "/referer" works. if ($q->path_info) { if ($q->path_info eq '/referer' or $q->path_info eq '/referrer') { |