mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-09 18:45:54 +02:00
backup.cgi: Read and deliver the requested backup in pieces
Read-in the requested backup file line by line and directly deliver this as stream to the client. This fixes the problem with very big backups on systems with very limited RAM, which resulted in an OOM kill of the CGI and delivery process. Fixes #13096. Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org> Reviewed-by: Michael Tremer <michael.tremer@ipfire.org>
This commit is contained in:
committed by
Peter Müller
parent
4e28814b6f
commit
c797789c1f
@@ -366,6 +366,13 @@ sub deliver_file() {
|
||||
|
||||
# Deliver content
|
||||
open(FILE, "<$file") or die "Unable to open $file: $!";
|
||||
print <FILE>;
|
||||
|
||||
# Read the file line by line and send it
|
||||
# to the client.
|
||||
while (<FILE>) {
|
||||
print $_;
|
||||
}
|
||||
|
||||
# Close file handle.
|
||||
close(FILE);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user