[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [help-GIFT] GIFT installation (new to GIFT)
From: |
David Squire |
Subject: |
Re: [help-GIFT] GIFT installation (new to GIFT) |
Date: |
Wed, 04 Feb 2004 09:01:51 +1100 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5) Gecko/20031007 |
David Squire wrote:
[snip]
The gift-install-prerequisites.pl script uses LWP::UserAgent and
HTTP::Request. These packages do support proxies. After the user agent
is created in the subroutine getAndUntar (line 49 in my version
(gift-0.1.9)), the user agent can be told about proxies:
my $ua = LWP::UserAgent->new; # current line 49
# prompt user for proxy details, or hardcode them in a hack :)
my $ProxyIP = 'proxy.mydomain.edu'; # whatever the name of the proxy
machine is.
# I think you can include a port
number suffix
# if necessary (e.g. ':8080')
my $ProxyUsername = ...
my $ProxyPassword = ...
my $ProxyURI = "http://$ProxyUsername:address@hidden";
# set the proxy server
$ua->proxy(['http', 'ftp'] => $ProxyURI);
Now, I have not been able to test this...
Now tested, with the script below. It works.
Cheers,
David
---- start script ----
#!/usr/bin/perl -w
use HTTP::Request;
use LWP::UserAgent;
use strict;
my $ua = LWP::UserAgent->new; # current line 49
# prompt user for proxy details, or hardcode them in a hack :)
my $ProxyIP = 'proxy.monash.edu.au:8080'; # whatever the name of the
proxy machine is.
# You can include a port number suffix if
# necessary (e.g. ':8080')
my $ProxyUsername = '*******'; # No, I'm not going to tell you my real
username and password!
my $ProxyPassword = '********';
my $ProxyURI = "http://$ProxyUsername:address@hidden";
print "$ProxyURI\n";
# set the proxy server
$ua->proxy(['http', 'ftp'] => $ProxyURI);
my $request = HTTP::Request->new(GET => 'http://www.abc.net.au/news/');
my $response = $ua->request($request);
print $response->code;
print '\n';
print $response->content;
---- end script ----
--
Dr. David McG. Squire, Postgraduate Research Coordinator (Caulfield),
Computer Science and Software Engineering, Monash University, Australia
http://www.csse.monash.edu.au/~davids/