Support possible media streaming in progressive output https://github.com/webmin/webmin/issues/1250 75517a865d

This commit is contained in:
Ilia Rostovtsev
2020-06-25 13:30:19 +03:00
parent 01ee62398d
commit 277b57877d
3 changed files with 12 additions and 4 deletions

View File

@@ -90,7 +90,9 @@ print &ui_table_row(&hlink($text{'edit_format'}, "format"),
[ [ 0, $text{'edit_format0'} ], [ [ 0, $text{'edit_format0'} ],
[ 2, $text{'edit_format2'} ], [ 2, $text{'edit_format2'} ],
[ 3, $text{'edit_format3'} ], [ 3, $text{'edit_format3'} ],
[ 1, $text{'edit_format4'} ] ]), 3); [ 1, $text{'edit_format1'}." ".
&ui_textbox("format",
$fmode == 1 ? $cmd->{'format'} : "", 20) ] ]), 3);
# Show Webmin servers to run on # Show Webmin servers to run on
@servers = &list_servers(); @servers = &list_servers();

View File

@@ -39,8 +39,12 @@ if ($cmd->{'format'} ne 'redirect' && $cmd->{'format'} ne 'form') {
my ($f, $e) = $cmd->{'cmd'} =~ /([\p{L}\_\-\.0-9]+)\.(tar\..*?|[^.]*)$/; my ($f, $e) = $cmd->{'cmd'} =~ /([\p{L}\_\-\.0-9]+)\.(tar\..*?|[^.]*)$/;
my $filename = $f || 'download'; my $filename = $f || 'download';
my $extension = $e || 'unknown'; my $extension = $e || 'unknown';
print "Content-Disposition: attachment; filename=\"$filename.$extension\"\n"; my $ctype = 'inline';
print "Content-type: application/x-download\n"; if ($cmd->{'format'} =~ /^application/) {
$ctype = 'attachment';
}
print "Content-Disposition: $ctype; filename=\"$filename.$extension\"\n";
print "Content-type: ",$cmd->{'format'},"\n";
print "\n"; print "\n";
} }
else { else {

View File

@@ -66,7 +66,9 @@ else {
$cmd->{'format'} = 'form'; $cmd->{'format'} = 'form';
} }
else { else {
$cmd->{'format'} = 'download'; $in{'format'} =~ /^[a-z0-9\.\_\-]+\/[a-z0-9\.\_\-]+/i ||
&error($text{'save_eformat'});
$cmd->{'format'} = $in{'format'};
} }
$cmd->{'noshow'} = $in{'noshow'}; $cmd->{'noshow'} = $in{'noshow'};
$cmd->{'usermin'} = $in{'usermin'}; $cmd->{'usermin'} = $in{'usermin'};