From b7a8e5d306e1d80cb25312d5ddabe52616de821f Mon Sep 17 00:00:00 2001 From: timriker Date: Sat, 27 Sep 2003 06:30:49 +0000 Subject: [PATCH] LWP::UserAgent - proxy support git-svn-id: https://svn.code.sf.net/p/infobot/code/trunk/blootbot@836 c11ca15a-4712-0410-83d8-924469b57eb5 --- src/Net.pl | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/Net.pl b/src/Net.pl index 306e20a..1d167cc 100644 --- a/src/Net.pl +++ b/src/Net.pl @@ -182,21 +182,20 @@ sub getURLAsFile { my ($url,$file) = @_; my ($ua,$res,$req); - return unless &loadPerlModule("LWP::Simple"); - -### PROXY NOT SUPPORTED WITH SIMPLE? -### $ua->proxy('http', $param{'httpProxy'}) if &IsParam("httpProxy"); - my $time = time(); + return unless &loadPerlModule("LWP::UserAgent"); + $ua = new LWP::UserAgent; + $ua->proxy('http', $param{'httpProxy'}) if &IsParam("httpProxy"); + my $req = HTTP::Request->new('GET', $url); + my $time = time(); &status("getURLAsFile: getting '$url' as '$file'"); - my $retval = getstore($url, $file); + my $res = $ua->request($req, $file); my $delta_time = time() - $time; if ($delta_time) { my $size = -s $file || 0; my $rate = int($size / $delta_time / 1024); &status("getURLAsFile: Done. ($rate kB/sec)"); } - - return $retval; + return $res; } 1; -- 2.39.2