summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2011-01-31 21:55:50 +0100
committerDaniel Friesel <derf@finalrewind.org>2011-01-31 21:55:50 +0100
commit1b23db3d002e2519140d59645b5388652fa204bb (patch)
tree125171dea374d3226e093f217bfa2da99386c13d /bin
parent7c869ec04330f2f07c571b1fec8c14273d754ea6 (diff)
vnet: Switch to LWP::UserAgent to ignore proxy settings (I want _my_ IP)
Diffstat (limited to 'bin')
-rwxr-xr-xbin/vnet19
1 files changed, 14 insertions, 5 deletions
diff --git a/bin/vnet b/bin/vnet
index 3238614..fd3b898 100755
--- a/bin/vnet
+++ b/bin/vnet
@@ -11,7 +11,7 @@ use autodie;
use GD;
use Getopt::Std;
use Term::ANSIColor;
-use LWP::Simple;
+use LWP::UserAgent;
my %opts;
my $alpha;
@@ -19,10 +19,19 @@ my $share = $0;
my ($ext_ip, $int_ip);
sub get_ext_ip {
- my $ext = get('http://derf.homelinux.org/cgi-bin/clientinfo/ip.cgi')
- // qq{?} ;
- chomp $ext;
- return $ext;
+ my $ua = LWP::UserAgent->new(
+ env_proxy => 0
+ );
+ my $re = $ua->get('http://derf.homelinux.org/cgi-bin/clientinfo/ip.cgi');
+
+ if ($re->is_success()) {
+ my $text = $re->decoded_content();
+ chomp $text;
+ return $text;
+ }
+ else {
+ return qq{?};
+ }
}
sub get_int_ip {