I have a script that I use to create news files in html and I include it on my pages using SSI. I have found a weird bug. When I try to post the text (without quotes): "cd " or "cd," or "cd$", I get an Internal Server Error. I think that it has to do with the way it is parsing the text. It doesn't seem to like the letter "c" and "d" and any special character together except for "cd.". I don't know enough perl to understand the contents, only the jist of it. Here is where I think the error occurs:
You can download the entire script from
Any help would be appreciated.
Code:
sub ReadParse {
my $buf, @pairs;
if ($ENV{'REQUEST_METHOD'} eq 'GET') {
@pairs = split(/&/, $ENV{'QUERY_STRING'});
} elsif ($ENV{'REQUEST_METHOD'} eq 'POST') {
read(STDIN, $buf, $ENV{'CONTENT_LENGTH'});
@pairs = split(/&/, $buf);
}
foreach (@pairs) {
local($key, $val) = split(/=/);
$key =~ tr/+/ /;
$val =~ tr/+/ /;
$key =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$val =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$val =~ s/<!--(.|\n)*-->//g; # Strip SSI
$in{$key} = $val;
}
}
You can download the entire script from
Any help would be appreciated.