mirror of
https://git.proxmox.com/git/pve-http-server
synced 2025-07-01 17:44:40 +00:00
allow API calls to download file contents.
We use this to download backup files with pmg.
This commit is contained in:
parent
c26f8b28fb
commit
20a61215ce
@ -752,6 +752,13 @@ sub handle_api2_request {
|
|||||||
$delay = 0 if $delay < 0;
|
$delay = 0 if $delay < 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (defined(my $filename = $res->{download})) {
|
||||||
|
my $fh = IO::File->new($filename) ||
|
||||||
|
die "unable to open file '$filename' - $!\n";
|
||||||
|
send_file_start($self, $reqstate, $filename);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
my ($raw, $ct, $nocomp) = $formatter->($res, $res->{data}, $params, $path,
|
my ($raw, $ct, $nocomp) = $formatter->($res, $res->{data}, $params, $path,
|
||||||
$auth, $self->{formatter_config});
|
$auth, $self->{formatter_config});
|
||||||
|
|
||||||
@ -1744,6 +1751,9 @@ sub rest_handler {
|
|||||||
|
|
||||||
# to pass the request to the local priviledged daemon use:
|
# to pass the request to the local priviledged daemon use:
|
||||||
# { proxy => 'localhost' , proxy_params => $params };
|
# { proxy => 'localhost' , proxy_params => $params };
|
||||||
|
|
||||||
|
# to download aspecific file use:
|
||||||
|
# { download => "/path/to/file" };
|
||||||
}
|
}
|
||||||
|
|
||||||
sub check_cert_fingerprint {
|
sub check_cert_fingerprint {
|
||||||
|
Loading…
Reference in New Issue
Block a user