All pastes #23283 Raw Edit

Mine

public text v1 · immutable
#23283 ·published 2005-09-18 14:47 UTC
rendered paste body
proxy patch made by Ruza (ruza@hysteria.sk)


~/tmp$ diff -ruN stahni.nova.orig-20050618 stahni.nova.1 
--- stahni.nova.orig-20050618   2005-09-18 16:44:20.000000000 +0200
+++ stahni.nova.1       2005-09-18 16:46:25.000000000 +0200
@@ -1,5 +1,6 @@
 #!/usr/bin/perl
 use strict;
+use warnings;
 use LWP::UserAgent;
 use POSIX qw/_exit/;
 use POSIX ":sys_wait_h";
@@ -37,6 +38,8 @@
     'czech-tv' => "-"
 );
 my $old_mplayer = 0; # define this if your mplayer need explicit kill on finished download
+# your http proxy only <hostname>:<port> (without http:// !)
+my $http_proxy = "SET_THIS_TO_HOSTNAME:PORT";
 
 # variables
 my $verbose = 0;
@@ -86,6 +89,7 @@
 # init
 my $ua = LWP::UserAgent->new;
 $ua->agent("stahni.nova/SVN ");
+$ua->proxy(['http'], "http://$http_proxy");  # set proxy
 
 sub REAPER {
     my $child;
@@ -191,7 +195,7 @@
     }
 
     my $pid = open MPL,"-|","$mplayer","-vo","null","-ao","null","-nocache",
-       "-dumpstream","-dumpfile","$outfil","$url" or die("Asi nemas mplayer");
+       "-dumpstream","-dumpfile","$outfil","http_proxy://$http_proxy/$url" or die("Asi nemas mplayer");
 
     if (not $verbose) {
        close STDERR;
@@ -250,7 +254,7 @@
        }
     }
 
-    print "Stahuji $msg :                                           ";
+    print "Stahuji $url $msg :                                      ";
     my $r = stahnito($outfil,$url);
     if ($r == 1) {
        print "[   OK   ]\n";