title: Perl and LWP not authenticating
body: <p>I'm trying to get an LWP request working to an https server. I have been given a user &amp; pass, advised to use basic authentication. I've tried various chunks of code, and all seem to get an authentication error. My current code is...</p>
  
  <pre><code>use warnings;
  use strict;
  use Data::Dumper;
  use LWP;
  
  my $ua = LWP::UserAgent-&gt;new( keep_alive =&gt; 1 );
  ##also tried by $ua-&gt;credentials('domain','','user','pass');
  ##not sure if I need 'realm' or how I get it, as no popup on screen.
  my $request = HTTP::Request-&gt;new( GET =&gt; "https://my.url.com/somepath/" );
  $request-&gt;authorization_basic('myuser','mypass');
  $request-&gt;header( 'Cache-Control' =&gt; 'no-cache' );
  
  print $response-&gt;content;
  print Dumper $response;
  </code></pre>
  
  <p>The server gives a security error, but if I look at a dump of $response, I see the following...</p>
  
  <pre><code>'_rc' =&gt; '401',
  '_headers' =&gt; bless( {   .... lots of stuff
          'title' =&gt; 'Security Exception',
          'client-warning' =&gt; 'Missing Authenticate header',
          'client-ssl-socket-class' =&gt; 'IO::Socket::SSL',
           ...
          'expires' =&gt; '-1'
                                    }, 'HTTP::Headers' ),
  
  '_msg' =&gt; 'Unauthorized',
  '_request' =&gt; bless( {
       '_content' =&gt; '',
       '_uri' =&gt; bless( do{\(my $o = 'https:theurlabove')}, 'URI::https' ),
       '_method' =&gt; 'GET',
       '_uri_canonical' =&gt; $VAR1-&gt;{'_request'}{'_uri'}
       '_headers' =&gt; bless( {
                             'user-agent' =&gt; 'libwww-perl/6.04',
                             'cache-control' =&gt; 'no-cache',
                             'authorization' =&gt; 'Basic dzx..........'
                           }, 'HTTP::Headers' ),
  </code></pre>
  
  <p>I'm trying to understand whats happening, it looks like in the original request, it has the headers in there, but in the response, its saying I'm 'Missing Authenticate Header'.</p>
  
  <p>Is there something amiss with the code, or something I'm misunderstanding with the request/respinse ?</p>
  
  <p>Thanks. </p>