Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Why cant I connect through a proxy using perl?

( #123085=categorized question: print w/ replies, xml ) Need Help??
Contributed by Anonymous Monk on Nov 04, 2001 at 01:42 UTC
Q&A  > HTTP and FTP clients


Description:

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)

Answer: Why cant I connect through a proxy using perl?
contributed by IlyaM

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.

Answer: Why cant I connect through a proxy using perl?
contributed by redbrick

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.

Please (register and) log in if you wish to add an answer



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others having an uproarious good time at the Monastery: (18)
    As of 2015-07-31 17:47 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









      Results (279 votes), past polls