Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Why cant I connect through a proxy using perl?

by Anonymous Monk
on Nov 04, 2001 at 01:42 UTC ( #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!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • 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?
    [ambrus]: Corion: no, these days like half of the times the professors write the articles in TeX (with formatting that's mostly acceptible but not usually good), and the other half of the time it's people who are already co-authors of the article that write it
    [erix]: there is lyx

    How do I use this? | Other CB clients
    Other Users?
    Others avoiding work at the Monastery: (12)
    As of 2017-09-26 10:56 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?
      During the recent solar eclipse, I:









      Results (293 votes). Check out past polls.

      Notices?