Subject: | Net::Server::HTTP doesn't handle multipart/form-data properly [WITH FIX] |
The parse_headers method puts HTTP_ in front of CONTENT_TYPE, which
then confuses CGI.
Checking the header parsing from HTTP::Server::Simple, I replaced the
foreach loop in parse_headers with:
foreach my $l (@lines) {
my ($tag, $value) = split /\s*:\s*/, $l, 2;
$tag = uc($tag);
$tag =~ s/^COOKIES$/COOKIE/;
$tag =~ s/-/_/g;
$tag = "HTTP_" . $tag
unless $tag =~ m/^CONTENT_(?:LENGTH|TYPE)$/;
if ( exists $ENV{$tag} ) {
$ENV{$tag} .= ", $value";
}
else {
$ENV{$tag} = $value;
}
}
And now this works. (It also looks like you may not have been handling
the case where there is more than one value for a key/tag, which would
happen with forms with select-multiple entries. The above looks like it
would solve that issue?)