Do I need to include some "special" headers or ...?
For our security purposes, actual urls, domain names,username, and password are represented by generic strings enclosed with arrows.
#!/usr/bin/perl -w # test_NTLM-9.pl # use strict; use LWP::UserAgent; use LWP::Debug qw(+); my $page = ""; my $response = ""; my $ua = ""; my $j = ""; my %reports = (); my @headers = (); my $url1 = "http://<some url>/reports.asp"; my $url2 = "http://<some url>.<some domain>.com:80/reports.asp"; { package RequestAgent; our @ISA = qw(LWP::UserAgent); sub get_basic_credentials { return ("<DOMAIN\\username>", "<passowrd>"); } } $ua = RequestAgent -> new (keep_alive => 1); $response = $ua -> post ($url2, \%reports, ['report' => 'E911 Numbers' +]); @headers = $response -> header_field_names(); foreach $j (@headers) { print ("$j = ",$response -> header($j),"\n"); +} if ($response -> is_success) { print ("\nGOOD\n"); $page = $response -> code; } else { print ("\nBAD\n"); $page = $response -> code; } if (defined ($page)) { $page =~ s/<br>/\\\n/g; print ($page); } exit; C:\>test_NTLM-9.pl LWP::UserAgent::new: () LWP::UserAgent::request: () LWP::UserAgent::send_request: POST http://<some domain>.com:80/reports +. asp LWP::UserAgent::_need_proxy: Not proxied LWP::Protocol::http::request: () LWP::Protocol::collect: read 811 bytes LWP::Protocol::collect: read 3620 bytes LWP::UserAgent::request: Simple response: Unauthorized Connection = close Date = Wed, 21 Mar 2007 11:55:29 GMT Server = Microsoft-IIS/5.0 WWW-Authenticate = NegotiateNTLM Content-Length = 4431 Content-Type = text/htmltext-html; charset=Windows-1252 Client-Date = Wed, 21 Mar 2007 11:55:04 GMT Client-Peer = 10.5.15.3:80 Client-Response-Num = 1 Client-Warning = Unsupported authentication scheme 'ntlm' Title = You are not authorized to view this page X-Meta-ROBOTS = NOINDEX BAD 401 C:\>
In reply to Re^6: LWP::UserAgent Authentication
by palladinob
in thread LWP::UserAgent Authentication
by palladinob
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |