fix #3716: api: download from url: use proxy option for https

The web UI uses the download-url endpoint for downloading an ISO, VZ
template, or OVA file via wget. In a setup where this request has to
go over a proxy (configured in the http_proxy datacenter option), the
download only works for http:// URLs, not https:// URLs. The reason is
that the download-url handler does not pass the https_proxy option to
the download_file_from_url helper, hence the helper only sets the
http_proxy environment variable for wget, not the https_proxy one.

Fix this by also passing the https_proxy option to the
download_file_from_url helper.

This will break setups that rely on http_proxy not being respected for
https:// URLs. For example, setups that have a proxy for external
connections, but download e.g. ISO files (only) via https from an
internal repository that the proxy doesn't serve.

Signed-off-by: Friedrich Weber <f.weber@proxmox.com>
Reviewed-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
Tested-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
Link: https://lore.kernel.org/r/20250326105108.34911-2-f.weber@proxmox.com
This commit is contained in:
Friedrich Weber
2025-03-26 11:51:07 +01:00
committed by Thomas Lamprecht
parent 22ac96a00b
commit 7c62215e48

View File

@ -700,6 +700,7 @@ __PACKAGE__->register_method({
hash_required => 0, hash_required => 0,
verify_certificates => $param->{'verify-certificates'} // 1, verify_certificates => $param->{'verify-certificates'} // 1,
http_proxy => $dccfg->{http_proxy}, http_proxy => $dccfg->{http_proxy},
https_proxy => $dccfg->{http_proxy},
}; };
my ($checksum, $checksum_algorithm) = $param->@{'checksum', 'checksum-algorithm'}; my ($checksum, $checksum_algorithm) = $param->@{'checksum', 'checksum-algorithm'};