http://www.perlmonks.org?node_id=123085

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Well, I had in mind to let my program connect to a server through a proxy.

For this, I'm using LWP::UserAgent. Though my problem is that regardless of what proxy I use, I cant connect out. If I "remove" the proxy, everything works fine, but not with it.

I believe the problem has something to do with the "no_proxy" definition.

$ua->proxy('http', 'http://my.proxy.com:80/'); $ua->no_proxy('proxy.com');

Anyone have any idea of what Im doing wrong?

Thanks in advance

Edited by footpad, ~Sun Nov 25 04:28:22 2001 (GMT)

Replies are listed 'Best First'.
Re: Why cant I connect through a proxy using perl?
by IlyaM (Parson) on Nov 25, 2001 at 07:11 UTC
    I don't know what the reason of your problem but often turning on debug trace in LWP helps to debug problems with LWP.

    Try to add

    use LWP::Debug qw(+);

    into you program and see what happens when it tryes to talk with proxy. See LWP::Debug docs for more info about LWP debug tracing.

Re: Why cant I connect through a proxy using perl?
by redbrick (Initiate) on May 14, 2002 at 19:25 UTC

    Mmm... I am also new to this stuff, but while I was wandering around hacking deluge (a web stress tool http://deluge.sourceforge.net), I found the following code:

    $ua->env_proxy();

    where $ua is an instance of UserAgent. And in the UserAgent pod, I found that this command imports proxy settings from the following enviroment vars: http_proxy and ftp_proxy.

    Hope that this works for you.

Re: Why cant I connect through a proxy using perl?
by Anonymous Monk on Nov 04, 2001 at 01:43 UTC
    Hm, why did I post the same question thrice? Sorry

    Originally posted as a Categorized Answer.