###PERL_LIB: use lib /botm/lib/bsta
use botm_common (
+ 'HTTP_STATUS',
'read_header_env',
'url_query_decode',
'read_data_file',
'join_path',
'merge_url',
- 'open_encoded', 'stat_encoded'
+ 'open_encoded', 'stat_encoded',
+ 'http_header_line', 'http_header_content_length', 'http_header_content_disposition'
);
use bsta_lib (
'STATE', 'INTF_STATE',
$method = $1;
}
else{
- exit fail_method($ENV{'REQUEST_METHOD'}, 'GET, POST, HEAD');
+ exit fail_method($ENV{'REQUEST_METHOD'}, ['GET', 'POST', 'HEAD']);
}
%http = read_header_env(\%ENV);
{'path' => CGI_PATH()},
{'path' => $frame_file}
);
- exit redirect ($method, $frame_path, 303);
+ exit redirect ($method, $frame_path, HTTP_STATUS->{'see_other'});
}
}
unless ($r) {
}
if (my @file_info = stat_encoded($frame_path)){
- print 'Content-length: '.$file_info[7]."\n";
+ print http_header_content_length($file_info[7]);
}
if ($frame_data{'content-type'} ne '') {
- print 'Content-type: '.$frame_data{'content-type'}."\n";
+ print http_header_line('content-type', $frame_data{'content-type'});
+}
+if ($frame_file ne '') {
+ print http_header_content_disposition('inline', $frame_file);
}
unless (binmode STDOUT) {
close($fh);