# Author: Ulli Horlacher <framstag@rus.uni-stuttgart.de>
#
-use CGI::Carp qw(fatalsToBrowser);
+BEGIN { ($ENV{PERLINIT}||'') =~ /(.+)/s and eval $1 }
# add fex lib
(our $FEXLIB) = $ENV{FEXLIB} =~ /(.+)/;
my $qs = $ENV{QUERY_STRING};
(my $multi) = $qs =~ s/(^|&)multi//;
-
+
# parse HTTP QUERY_STRING (parameter=value pairs)
if ($qs) {
foreach (split '&',$qs) {
ord($1)
));
}
- setparam($x,$_);
+ setparam($x,$_);
}
}
}
}
binmode(STDIN,':raw');
-
+
READPOST: while (&nvt_read) {
if (/^Content-Disposition:\s*form-data;\s*name="([a-z]\w*)"/i) {
my $x = $1;
exec($FEXHOME.'/bin/fexsrv') if $ENV{KEEP_ALIVE};
exit;
}
-
+
http_header('200 ok');
print html_header($head);
# set parameter variables
sub setparam {
my ($v,$vv) = @_;
-
+
$v = uc(despace($v));
if ($v eq 'LOCALE' and $vv =~ /^(\w+)$/) {
$locale = $1;
- } elsif ($v eq 'FROM') {
+ } elsif ($v eq 'FROM') {
$from = normalize_email($vv);
} elsif ($v eq 'TO') {
$to = normalize_email($vv);
}
}
-
-
-# read one line from STDIN (net socket) and assign it to $_
-# returns number of read bytes
-sub nvt_read {
- my $len = 0;
-
- if (defined ($_ = <STDIN>)) {
- debuglog($_);
- $len = length;
- s/\r?\n//;
- }
- return $len;
-}