Hey KC Perl Mongers and CCCKC - <br><br>I am trying to retrieve scan result information from Qualys from inside a corporate network that has a proxy that requires authentication.<br><br>There seems to be a problem with LWP and proxy settings as found in the following links.<br>
<br><a href="http://www.codecomments.com/archive233-2006-1-764165.html">http://www.codecomments.com/archive233-2006-1-764165.html</a><br><a href="http://groups.google.fi/group/perl.libwww/browse_thread/thread/aee0e06b1404387/e28d1e3670a21ad5?lnk=st&amp;q=%22https+through+proxy+with+libwww%22&amp;rnum=1#e28d1e3670a21ad5">http://groups.google.fi/group/perl.libwww/browse_thread/thread/aee0e06b1404387/e28d1e3670a21ad5?lnk=st&amp;q=%22https+through+proxy+with+libwww%22&amp;rnum=1#e28d1e3670a21ad5</a><br>
<a href="http://rt.cpan.org/Public/Bug/Display.html?id=1894">http://rt.cpan.org/Public/Bug/Display.html?id=1894</a><br><br>But when I try the workarounds by using the environment variables for http_proxy and/or https_proxy it still fails.<br>
<br>If anyone has seen this before or knows a quick fix, please let me know.  I am tempted to just call wget which can authenticate to the proxy and pass the Qualys credentials as well.<br><br>Here is my test code to just retrieve the scan_results from Qualys.<br>
<br>=========================<br>#!/usr/bin/perl<br><br>use strict;<br>$|++;<br><br>use LWP::UserAgent;<br>#use LWP::Debug qw(+);<br><br>my $username = &#39;qualys_user&#39;;<br>my $password = &#39;qualys_pass&#39;;<br>$ENV{HTTP_PROXY} = &#39;<a href="http://proxyuser:proxypass@192.168.1.1:8080">http://proxyuser:proxypass@192.168.1.1:8080</a>&#39;;<br>
$ENV{HTTPS_PROXY} = &#39;<a href="http://proxyuser:proxypass@192.168.1.1:8080">http://proxyuser:proxypass@192.168.1.1:8080</a>&#39;;<br><br>my $ua = LWP::UserAgent-&gt;new;<br># This script doesn&#39;t work with the below line uncommented or commented.<br>
# I assume that if this is commented that LWP will use the environment variables defined above.<br>#$ua-&gt;proxy([&#39;http&#39;, &#39;https&#39;], &#39;http://proxyuser:proxypass@192.168.1.1:8080&#39;);<br><br><br>my $req = HTTP::Request-&gt;new(GET =&gt; &#39;https://$username:$password\@<a href="http://qualysguard.qualys.com/msp/scan_report_list.php&#39;">qualysguard.qualys.com/msp/scan_report_list.php&#39;</a>);<br>
my $res = $ua-&gt;request($req);<br>if ($res-&gt;is_success) {<br>    print $res-&gt;as_string;<br>}<br>else {<br>    print &quot;Failed: &quot;, $res-&gt;status_line, &quot;\n&quot;;<br>}<br>=========================<br>
<br>If I use the Environment variables I get the following message:<br><br>Failed: 500 Can&#39;t connect to <a href="http://qualysguard.qualys.com:443">qualysguard.qualys.com:443</a> (Timeout)<br><br>If I uncomment the line &quot;$ua-&gt;proxy([&#39;http&#39;, &#39;https&#39;], &#39;http://proxyuser:proxypass@192.168.1.1:8080&#39;);&quot;  I get this message:<br>
<br>Failed: 400 Bad Request<br>