title: LWP::UserAgent's env_proxy gives "Access is denied" for non-admin users
body: <p>Environment:
  - Active Perl 5.16
  - Windows 2003 Server
  - IIS 6 with Windows Authentication</p>
  
  <p>I was trying to use the Perl module "LWP::Simple" in a Perl CGI script, and it worked fine for "admins" on the Server (with Windows Authentication, the IIS/CGI environment knows the users Windows username and some of us (like me) are admins on the server).  However, for all the rest of our non-admin users, they were getting "The specified CGI application misbehaved by not returning a complete set of HTTP headers".  I narrowed it down to the "use LWP::Simple" line; if the line was in, the non-admins got the error; if the line was out, no error for anyone.</p>
  
  <p>Since this was a "use" line, it seemed to me impossible to debug the error under IIS (no decent error logs!), so I broke down the LWP::Simple module (which just uses a lot of LWP::UserAgent stuff) and created the following simple script to reproduce the underlying error:</p>
  
  <pre><code>#!perl
  
  use strict;
  use warnings;
  
  use CGI::Pretty qw(:standard -any -no_xhtml -oldstyle_urls *center);
  use CGI::Carp qw(fatalsToBrowser set_message);
  use LWP::UserAgent;
  
  print header;
  
  my $ua = LWP::UserAgent-&gt;new;  # we create a global UserAgent object
  $ua-&gt;env_proxy;
  print "&lt;hr&gt;\n";
  
  my $response = $ua-&gt;get('http://search.cpan.org/');
  
  if ($response-&gt;is_success) {
       print $response-&gt;decoded_content;  # or whatever
  }
  else {
       die $response-&gt;status_line;
  }
  </code></pre>
  
  <p>Since the error is not happening in a "use" line, we don't get the dreaded missing-http-headers error, and the real error appears on the screen:</p>
  
  <pre><code>Access is denied
  </code></pre>
  
  <p>This allowed me to narrow down to ONE line:</p>
  
  <pre><code>$ua-&gt;env_proxy;
  </code></pre>
  
  <p>If that line is in the code, the words "Access is denied" is shown on the screen for non-admins (admins do not get any errors).  In both cases, the rest of the script works fine, but this error is preventing LWP::Simple from working at all (the error occurs in a "use" line and gives the missing-http-headers error).</p>
  
  <p>While my workaround is to NOT use LWP::Simple and instead use LWP::UserAgent (skipping the "$ua->env_proxy" part), <strong>I would really like to know WHY "$ua->env_proxy" gives "Access is denied" for non-admins</strong>.</p>
  
  <p>Can anyone help me figure that out?</p>