Commit 59c8caa9 authored by Dietmar Maurer's avatar Dietmar Maurer

use LWP to download changelog

parent 7cb07c3d
......@@ -4,7 +4,10 @@ use strict;
use warnings;
use File::stat ();
use LWP::UserAgent;
use PVE::Tools qw(extract_param);
use PVE::Cluster;
use PVE::SafeSyslog;
use PVE::INotify;
use PVE::Exception qw(raise_param_exc);
......@@ -343,10 +346,27 @@ __PACKAGE__->register_method({
my $data = "";
# fixme: proxy?
my $dccfg = PVE::Cluster::cfs_read_file('datacenter.cfg');
my $proxy = $dccfg->{http_proxy};
my $ua = LWP::UserAgent->new;
$ua->agent("PVE/1.0");
$ua->timeout(10);
$ua->max_size(1024*1024);
if ($proxy) {
$ua->proxy(['http'], $proxy);
} else {
$ua->env_proxy;
}
my $response = $ua->get($url);
my $cmd = ['wget', '-T', 10, '-O-', $url];
PVE::Tools::run_command($cmd, outfunc => sub { $data .= shift . "\n"; });
if ($response->is_success) {
$data = $response->decoded_content;
} else {
die $response->status_line;
}
return $data;
}});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment