}
$dynamic = $htmldoc =~ s/$mark/$include/;
}
- # evaluate <<perl-code>>
- while ($htmldoc =~ /<<(.+?)>>/s) {
- local $pc = $1;
- local $__ = '';
- tie *STDOUT => "Buffer",\$__;
- $__ .= eval $pc;
- untie *STDOUT;
- $dynamic = $htmldoc =~ s/<<(.+?)>>/$__/s;
- };
+ # evaluate <<perl-code>> or <<<perl-code>>>
+ {
+ local $timeout = '';
+ local $SIG{ALRM} = sub { $timeout = '<h3>TIMEOUT!</h3>' };
+ alarm(10);
+ while ($htmldoc =~ /<<(.+?>?)>>/s) {
+ local $pc = $1;
+ if ($pc =~ s/^<(.+)>$/$1/) {
+ # eval code without output substitution
+ eval('package DOP;' . $pc);
+ last if $timeout;
+ $dynamic = $htmldoc =~ s/<<<(.+?)>>>//s;
+ } else {
+ # eval code with output substitution
+ local $__ = '';
+ tie *STDOUT => "Buffer",\$__;
+ $__ .= eval('package DOP;' . $pc);
+ untie *STDOUT;
+ last if $timeout;
+ $dynamic = $htmldoc =~ s/<<(.+?)>>/$__/s;
+ }
+ }
+ alarm(0);
+ $dynamic = $htmldoc =~ s/<<(.+?>?)>>/$timeout/sg if $timeout;
+ }
# substitute $variable$ with value from environment (if present)
while ($htmldoc =~ /\$([\w_]+)\$/g) {
$var = $1;
"Content-Length: $size",
"Content-Range: $range",
"Content-Type: $type",
- '',
);
} else {
# streaming?
'Server: fexsrv',
"Expires: 0",
"Content-Type: $type",
- '',
);
} else {
# Java (clients) needs Last-Modified header!
"Content-Length: $size",
"Content-Type: $type",
);
- nvt_print("Set-Cookie: locale=$locale") if $use_cookies and $locale;
- nvt_print('');
+ # nvt_print("Set-Cookie: locale=$locale") if $use_cookies and $locale;
}
}
+ nvt_print($_) foreach(@extra_header);
+ nvt_print('');
if ($ENV{REQUEST_METHOD} eq 'GET') {
if ($type eq 'text/html') {