M
mumebuhi
I am having problems accessing any sites outside my organization using
LWP::UserAgent. My organization is using NTLM authentication.
My code looks like the following (similar to the one explained in
http://search.cpan.org/dist/libwww-perl/lib/LWP/Authen/Ntlm.pm).
# --- start ---
use HTTP::Request::Common;
use LWP::UserAgent;
use LWP:
ebug qw(+);
my $url = 'http://www.google.com';
my $ua = LWP::UserAgent->new(keep_alive => 1);
$ua->credentials('host:8080', '', 'username', 'password');
$request = new HTTP::Request GET => $url;
$response = $ua->request($request);
print $response->code . "\n";
# --- end ---
The output is
LWP::UserAgent::new: ()
LWP::UserAgent::request: ()
LWP::UserAgent::send_request: GET http://www.google.com
LWP::UserAgent::_need_proxy: Not proxied
LWP:
rotocol::http::request: ()
LWP:
rotocol::collect: read 624 bytes
LWP::UserAgent::request: Simple response: Found
LWP::UserAgent::request: ()
LWP::UserAgent::send_request: GET
http://bcauth/?cfru=aHR0cDovL3d3dy5nb29nbGUuY29tLw==
LWP::UserAgent::_need_proxy: Not proxied
LWP:
rotocol::http::request: ()
LWP:
rotocol::collect: read 744 bytes
LWP:
rotocol::collect: read 66 bytes
LWP::UserAgent::request: Simple response: Unauthorized
401
Help?
LWP::UserAgent. My organization is using NTLM authentication.
My code looks like the following (similar to the one explained in
http://search.cpan.org/dist/libwww-perl/lib/LWP/Authen/Ntlm.pm).
# --- start ---
use HTTP::Request::Common;
use LWP::UserAgent;
use LWP:
my $url = 'http://www.google.com';
my $ua = LWP::UserAgent->new(keep_alive => 1);
$ua->credentials('host:8080', '', 'username', 'password');
$request = new HTTP::Request GET => $url;
$response = $ua->request($request);
print $response->code . "\n";
# --- end ---
The output is
LWP::UserAgent::new: ()
LWP::UserAgent::request: ()
LWP::UserAgent::send_request: GET http://www.google.com
LWP::UserAgent::_need_proxy: Not proxied
LWP:
LWP:
LWP::UserAgent::request: Simple response: Found
LWP::UserAgent::request: ()
LWP::UserAgent::send_request: GET
http://bcauth/?cfru=aHR0cDovL3d3dy5nb29nbGUuY29tLw==
LWP::UserAgent::_need_proxy: Not proxied
LWP:
LWP:
LWP:
LWP::UserAgent::request: Simple response: Unauthorized
401
Help?