mirror of
https://git.proxmox.com/git/pve-manager
synced 2025-07-25 15:05:11 +00:00
pvesh: code cleanups for streamed response handling
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
86f9a0acea
commit
6d7deac70d
@ -289,18 +289,13 @@ my $handle_streamed_response = sub {
|
|||||||
my ($fh, $path, $encoding, $type) =
|
my ($fh, $path, $encoding, $type) =
|
||||||
$download->@{'fh', 'path', 'content-encoding', 'content-type'};
|
$download->@{'fh', 'path', 'content-encoding', 'content-type'};
|
||||||
|
|
||||||
die "{download} returned but neither fh nor path given\n"
|
die "{download} returned but neither fh nor path given\n" if !defined($fh) && !defined($path);
|
||||||
if !defined($fh) && !defined($path);
|
|
||||||
|
|
||||||
die "unknown 'content-encoding' $encoding\n"
|
die "unknown 'content-encoding' $encoding\n" if defined($encoding) && $encoding ne 'gzip';
|
||||||
if defined($encoding) && $encoding ne 'gzip';
|
die "unknown 'content-type' $type\n" if defined($type) && $type !~ qw!^(?:text/plain|application/json)$!;
|
||||||
|
|
||||||
die "unknown 'content-type' $type\n"
|
|
||||||
if defined($type) && $type !~ qw!^(text/plain)|(application/json)$!;
|
|
||||||
|
|
||||||
if (defined($path)) {
|
if (defined($path)) {
|
||||||
open($fh, '<', $path)
|
open($fh, '<', $path) or die "open stream path '$path' for reading failed - $!\n";
|
||||||
or die "open stream path '$path' for reading failed: $!\n";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
local $/;
|
local $/;
|
||||||
|
Loading…
Reference in New Issue
Block a user