if ($config{sslcookie}) {
print $session->header(-charset => 'utf-8',
-cookie => $session->cookie(-httponly => 1, -secure => 1));
- } else {
+ }
+ else {
print $session->header(-charset => 'utf-8',
-cookie => $session->cookie(-httponly => 1));
}
}
sub decode_cgi_utf8 ($) {
- # decode_form_utf8 method is needed for 5.10
+ # decode_form_utf8 method is needed for 5.01
if ($] < 5.01) {
my $cgi = shift;
foreach my $f ($cgi->param) {
if ($] >= 5.01) {
my $form = shift;
foreach my $f ($form->field) {
+ my @value=map { decode_utf8($_) } $form->field($f);
$form->field(name => $f,
- value => decode_utf8($form->field($f)),
+ value => \@value,
force => 1,
);
}
showform($form, $buttons, $session, $q);
}
-sub cgi_custom_failure ($$) {
- my $header=shift;
+sub cgi_custom_failure ($$$) {
+ my $q=shift;
+ my $httpstatus=shift;
my $message=shift;
- print $header;
+ print $q->header(
+ -status => $httpstatus,
+ -charset => 'utf-8',
+ );
print $message;
# Internet Explod^Hrer won't show custom 404 responses
$session->delete();
cgi_savesession($session);
cgi_custom_failure(
- $q->header(-status => "403 Forbidden"),
+ $q, "403 Forbidden",
gettext("You are banned."));
}
}