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

I find myself in a quandry. CPAN's Config.pm shows the correct
http proxy. However, my proxy here requires a username and password.

When I write my own, I use the following lines:

$ua->proxy(['http'],'http://xxxxxx.nb.ford.com:83'); $req->proxy_authorization_basic("username","password"); my $res = $ua->request($req);

My problem is that in walking through CPAN.pm, I cannot tell
where to edit to make it use that kind of proxy authorization.


Can anyone help with this? What does this little button do . .<Click>; "USER HAS SIGNED OFF FOR THE DAY"

Replies are listed 'Best First'.
(Guildenstern) Re: Editing CPAN.pm
by Guildenstern (Deacon) on Dec 13, 2000 at 19:34 UTC
    Looking around, I found the CPAN readme. It looks as if your proxy requires a login you'll have to configure your individual services to support that. The example given in the readme is this:
    If you can go through your firewall with e.g. lynx, presumably with a +command such as /usr/local/bin/lynx -pscott:tiger then you would configure CPAN.pm with the command conf lynx "/usr/local/bin/lynx -pscott:tiger"

    Obviously, you'd have to set up ftp similarly.

    Of course, YMMV.

    Guildenstern
    Negaterd character class uber alles!
Re: Editing CPAN.pm (or set user proxy env)
by ybiC (Prior) on Dec 13, 2000 at 21:05 UTC
    Another option, if running *nix, would be to set the proxy environment.  

    For a Debian box behind an MS proxy, add the following to $home/.bashrc and/or $home/.bash_profile as appropriate.

    export http_proxy="http://NTdomain\user:password@proxy.DNSdomain:portn +umber"

    Thanks to tilly for showing me this a while back.   Well, the "export http_proxy" part anyway, not the MSproxy-specific syntax.

    Update: I think this will eliminate the need to config lynx, wget, etc. separately.
        cheers,
        Don
        striving for Perl Adept
        (it's pronounced "why-bick")

Re: Editing CPAN.pm
by Fastolfe (Vicar) on Dec 13, 2000 at 20:53 UTC
    I had a similar problem where I work. The solution is not to fix CPAN, but to fix the underlying transport mechanisms to know about the authenticated proxy. LWP knows how these work, so it was just a matter of correctly configuring LWP for my machine, which is something that should have been done when it was first installed. Things now work like a charm, and any other script or module that makes use of LWP's functions now automatically sees through the authenticated proxy.
Re: Editing CPAN.pm
by tame1 (Pilgrim) on Dec 13, 2000 at 21:05 UTC
    Solution was found, but it was unwieldy.

    Each program used by CPAN, such as wget, lynx, etc.,
    has it's own way to talk to a proxy. I had to change each
    program config in CPAN's Config.pm.

    For example, wget can use --proxy-user=myid --proxy-passwd=mypass
    The fun part of that one is that you will NOT find it in the
    man page for wget. You will only find it doing wget --help.

    For those who need this in the future, I hope this helps.

    What does this little button do . .<Click>; "USER HAS SIGNED OFF FOR THE DAY"
Re: Editing CPAN.pm
by elwarren (Priest) on Dec 13, 2000 at 22:12 UTC
    Just update your proxy url to include your username and password, like this:
    $ua->proxy(['http'],'http://user:pass@xxxxxx.nb.ford.com:83');