Here a sample a code that make correct NTLM authentification it's use the last libwww version (5.64 i hope): Note that the keep_alive => 1 is important NTLM authorize TCP/IP connection and not request Hope that help you...
#Libraries inclusion use DBI; use LWP::UserAgent; use HTTP::Headers::Util; use DBD::Oracle; use Crypt::SSLeay::MainContext; use Net::Ping; # For NTLM authentification use Authen::NTLM; use LWP::ConnCache; use HTML::HeadParser; #User Agent declaration $ua = new LWP::UserAgent( keep_alive => 1); my $req = new HTTP::Request GET => $addrTxt; #$req->content_type('application/x-www-form-urlencoded'); #$req->content('match=www&errors=0'); #Pass request to the user agent and get a response back my $res = $ua->request($req); #Update into url table the url link status depending on the previo +us test #Null for success and 0 for failure if (!$res->is_error) { # URL is OK undef $nul; $updateStatus->execute($nul,$linkNo) or die "Couldn't execute +statement: " . $dbh->errstr; next; } # URL En erreur if ( $res->status_line =~ /^401/ && $res->headers()->header("WW +W-Authenticate") eq "NTLM" ) { # Try the NLTM Authorization ntlm_user($tableParam{"NTUser"}); ntlm_password($tableParam{"NTPass"}); ntlm_domain($tableParam{"NTDomain"}); $headers = new HTTP::Headers(); $headers->header("Authorization" => "NTLM " . ntlm()); $request = HTTP::Request->new('GET', $addrTxt, $headers); $response = $ua->request($request); $headers = $response->headers(); $auth_type = $headers->header("WWW-Authenticate"); if($auth_type =~ /^NTLM (.*)$/) { $chal_resp = ntlm($1); $headers = new HTTP::Headers(); $headers->header("Authorization" => "NTLM " . $chal_re +sp); $request = HTTP::Request->new('GET', $addrTxt, $header +s); $res = $ua->request($request); if (!$res->is_error) { # URL OK undef $nul; $updateStatus->execute($nul,$linkNo) or die "Couldn't execute statement: " . $d +bh->errstr; next; } } } # Url In error write_error_log("$linkNo - $addrTxt - " . ($IsLocal ? "Local" +: "Remote") . " - " . $res->status_line); }

In reply to Re: LWP with NTLM-Authentication? by snouhaud
in thread LWP with NTLM-Authentication? by severin

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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, details, 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, summary, 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.