/usr/share/perl5/AAT/Download.pm is in octopussy 1.0.6-0ubuntu2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | # $HeadURL: https://syslog-analyzer.svn.sourceforge.net/svnroot/syslog-analyzer/tags/Octopussy-1.0.6/usr/share/perl5/AAT/Download.pm $
# $Revision: 368 $
# $Date: 2010-06-15 10:03:55 +0100 (Tue, 15 Jun 2010) $
# $Author: sebthebert $
=head1 NAME
AAT::Download - AAT Download module
=cut
package AAT::Download;
use strict;
use warnings;
use Readonly;
use LWP;
use AAT::Proxy;
use AAT::Syslog;
use AAT::Utils qw( NOT_NULL );
Readonly my $TIMEOUT => 5; # 5 seconds before timeout
=head1 FUNCTIONS
=head2 File($appli, $download, $dest)
Downloads $download to local file $dest
=cut
sub File
{
my ($appli, $download, $dest) = @_;
my $pc = AAT::Proxy::Configuration($appli);
my $proxy =
(NOT_NULL($pc->{server}) ? "http://$pc->{server}" : '')
. (NOT_NULL($pc->{port}) ? ":$pc->{port}" : '');
my $ua = LWP::UserAgent->new;
$ua->agent($appli);
$ua->proxy('http', $proxy);
$ua->timeout($TIMEOUT);
my $req = HTTP::Request->new(GET => $download);
my $res = $ua->request($req);
if ($res->is_success)
{
if (defined open(my $FILE, '>', $dest))
{
print $FILE $res->content;
close($FILE);
return ($dest);
}
}
else
{
$download =~ s/\%\d\d/ /g; # '%' is not good for sprintf used by syslog
AAT::Syslog::Message($appli, 'DOWNLOAD_FAILED', $download);
}
return (undef);
}
1;
=head1 AUTHOR
Sebastien Thebert <octo.devel@gmail.com>
=cut
|