title: Why don't my LWP::UserAgent credentials work?
body: <p>I'm trying to access a protected file. Server is using digest authentication - which I can see from the printed out response.
  Here is the sample code:</p>
  
  <pre><code>use LWP;
  use strict;
  
  my $url = 'http://somesite.com/aa/bb/cc.html';
  my $username = 'scott';
  my $password = 'tiger';
  
  my $browser = LWP::UserAgent-&gt;new('Mozilla');
  $browser-&gt;credentials("http://somesite.com:80","realm-name",$username=&gt;$password);
  my $response=$browser-&gt;get($url);
  
  print $response-&gt;content;
  </code></pre>
  
  <p>Name of the realm I got it from the popup window I get when I try to access that resource from the browser. Same username and password are working extremely fine in the browser and I'm able to see the content but when I run the above script it always says <code>401 Authorization required</code>. </p>
  
  <p>How does LWP work?</p>
  
  <p>Do I need to ask LWP to send MD5 hash (digest) of the username and password or is it like internally it checks which authentication to use and sends the corresponding (basic/digest) way of sending credentials.
  My questions are</p>
  
  <ol>
  <li>How can I set LWP so that it sends digest of username and password?</li>
  <li>What if the server is using windows NTLM authentication protocol? How should I go about in such a situation?</li>
  </ol>
  
  <p>any quick help is highly appreciated !</p>