mirror of
https://github.com/webmin/webmin.git
synced 2025-07-29 11:50:54 +00:00
Fix to send a file in chunks
https://forum.virtualmin.com/t/upgrade-2-102-killed-download-from-server-feature/122413/7?u=ilia
This commit is contained in:
@ -99,17 +99,21 @@ if ($ENV{'PATH_INFO'}) {
|
||||
print "Content-Disposition: Attachment\n";
|
||||
}
|
||||
}
|
||||
else {
|
||||
while(read(FILE, $buffer, &get_buffer_size_binary())) {
|
||||
$fdata .= $buffer;
|
||||
}
|
||||
}
|
||||
close(FILE);
|
||||
|
||||
print "Content-length: $fsize\n";
|
||||
print "X-Content-Type-Options: nosniff\n";
|
||||
print "Content-type: $type\n\n";
|
||||
print "$fdata";
|
||||
# File is already read, so print it
|
||||
if ($dangertypes) {
|
||||
print "$fdata";
|
||||
}
|
||||
else {
|
||||
# Send the file
|
||||
while(read(FILE, $buffer, &get_buffer_size_binary())) {
|
||||
print("$buffer");
|
||||
}
|
||||
}
|
||||
close(FILE);
|
||||
}
|
||||
|
||||
# Switch back to root
|
||||
|
Reference in New Issue
Block a user