X-Git-Url: http://git.treefish.org/fex.git/blobdiff_plain/7fa382617fbaccc0ce522b2b3adbbee9db5ad227..3aae246cf7f4af7ae49da09e5ed0c180f31f0c12:/cgi-bin/pup diff --git a/cgi-bin/pup b/cgi-bin/pup index 4ddac70..a944995 100755 --- a/cgi-bin/pup +++ b/cgi-bin/pup @@ -5,7 +5,9 @@ # Author: Ulli Horlacher # -use CGI::Carp qw(fatalsToBrowser); +BEGIN { ($ENV{PERLINIT}||'') =~ /(.+)/s and eval $1 } + +use utf8; # add fex lib (our $FEXLIB) = $ENV{FEXLIB} =~ /(.+)/; @@ -34,7 +36,7 @@ chdir $spooldir or http_die("$spooldir - $!\n"); my $qs = $ENV{QUERY_STRING}; (my $multi) = $qs =~ s/(^|&)multi//; - + # parse HTTP QUERY_STRING (parameter=value pairs) if ($qs) { foreach (split '&',$qs) { @@ -48,7 +50,7 @@ if ($qs) { ord($1) )); } - setparam($x,$_); + setparam($x,$_); } } } @@ -62,7 +64,7 @@ if ($ENV{REQUEST_METHOD} eq 'POST') { } binmode(STDIN,':raw'); - + READPOST: while (&nvt_read) { if (/^Content-Disposition:\s*form-data;\s*name="([a-z]\w*)"/i) { my $x = $1; @@ -95,7 +97,7 @@ if ($to and $from and checkaddress($from)) { exec($FEXHOME.'/bin/fexsrv') if $ENV{KEEP_ALIVE}; exit; } - + http_header('200 ok'); print html_header($head); @@ -172,27 +174,13 @@ pq(qq( # 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 ($_ = )) { - debuglog($_); - $len = length; - s/\r?\n//; - } - return $len; -}