###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',
'merge_settings',
'get_id', 'get_password',
- 'fail_attachment', 'fail_500', 'redirect'
+ 'fail_method', 'fail_content_type', 'fail_attachment', 'fail_500',
+ 'redirect'
);
###PERL_PATH_SEPARATOR: PATH_SEPARATOR = /
$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' => $file_name}
);
- exit redirect ($method, $file_path, 303);
+ exit redirect ($method, $file_path, HTTP_STATUS->{'see_other'});
}
}
unless ($r) {
exit fail_500("Can't switch file to binary mode.");
}
if (my @file_info = stat_encoded($file_path)) {
- print 'Content-length: '.$file_info[7]."\n";
+ print http_header_content_length($file_info[7]);
}
}
if ($file_data{'content-type'} ne '') {
- print 'Content-type: '.$file_data{'content-type'}."\n";
+ print http_header_line('content-type', $file_data{'content-type'});
}
if ($file_name ne '') {
- print 'Content-disposition: inline; filename="'.$file_name.'"'."\n";
+ print http_header_content_disposition('inline', $file_name);
}
unless ($direct) {
unless (binmode STDOUT) {