Re: proxy authentication and little patch

[email protected] (Philippe 'BooK' Bruhat)
Newsgroups gmane.comp.lang.perl.modules.lwp
Message-ID <[email protected]>
Le mardi 28 mars 2006 à 23:28, Bas Bloemsaat écrivait:
> Hi,
> 
> Tonight I was stumbling over authentication, trying to get through a proxy
> with LWP::UserAgent.

Did you try using http://user:pass@proxy:port/ for the proxy address?

Compare

    $ HTTP_PROXY=http://localhost:8080/ perl -MLWP -MLWP::Debug=+  -e 'print LWP::UserAgent->new(env_proxy => 1)->request( HTTP::Request->new( GET => "http://www.perdu.com/"))->content()'
    LWP::UserAgent::new: ()
    LWP::UserAgent::proxy: http http://localhost:8080/
    LWP::UserAgent::request: ()
    LWP::UserAgent::send_request: GET http://www.perdu.com/
    LWP::UserAgent::_need_proxy: Proxied to http://localhost:8080/
    LWP::Protocol::http::request: ()
    LWP::UserAgent::request: Simple response: Proxy Authentication Required

with

    $ HTTP_PROXY=http://http:proxy@localhost:8080/ perl -MLWP -MLWP::Debug=+  -e 'print LWP::UserAgent->new(env_proxy => 1)->request( HTTP::Request->new( GET => "http://www.perdu.com/"))->content()'
    LWP::UserAgent::new: ()
    LWP::UserAgent::proxy: http http://http:proxy@localhost:8080/
    LWP::UserAgent::request: ()
    LWP::UserAgent::send_request: GET http://www.perdu.com/
    LWP::UserAgent::_need_proxy: Proxied to http://http:proxy@localhost:8080/
    LWP::Protocol::http::request: ()
    LWP::Protocol::collect: read 204 bytes
    LWP::UserAgent::request: Simple response: OK
    <html><head><title>Vous Etes Perdu ?</title></head><body><h1>Perdu sur l'Internet ?</h1><h2>Pas de panique, on va vous aider</h2><strong><pre>    * <----- vous &ecirc;tes ici</pre></strong></body></html>

-- 
 Philippe "BooK" Bruhat

 Remember that what is good for the goose may not be good for the gender.
                                     (Moral from Groo The Wanderer #4 (Epic))
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.