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&q=%22https+through+proxy+with+libwww%22&rnum=1#e28d1e3670a21ad5">http://groups.google.fi/group/perl.libwww/browse_thread/thread/aee0e06b1404387/e28d1e3670a21ad5?lnk=st&q=%22https+through+proxy+with+libwww%22&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 = 'qualys_user';<br>my $password = 'qualys_pass';<br>$ENV{HTTP_PROXY} = '<a href="http://proxyuser:proxypass@192.168.1.1:8080">http://proxyuser:proxypass@192.168.1.1:8080</a>';<br>
$ENV{HTTPS_PROXY} = '<a href="http://proxyuser:proxypass@192.168.1.1:8080">http://proxyuser:proxypass@192.168.1.1:8080</a>';<br><br>my $ua = LWP::UserAgent->new;<br># This script doesn'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->proxy(['http', 'https'], 'http://proxyuser:proxypass@192.168.1.1:8080');<br><br><br>my $req = HTTP::Request->new(GET => 'https://$username:$password\@<a href="http://qualysguard.qualys.com/msp/scan_report_list.php'">qualysguard.qualys.com/msp/scan_report_list.php'</a>);<br>
my $res = $ua->request($req);<br>if ($res->is_success) {<br> print $res->as_string;<br>}<br>else {<br> print "Failed: ", $res->status_line, "\n";<br>}<br>=========================<br>
<br>If I use the Environment variables I get the following message:<br><br>Failed: 500 Can't connect to <a href="http://qualysguard.qualys.com:443">qualysguard.qualys.com:443</a> (Timeout)<br><br>If I uncomment the line "$ua->proxy(['http', 'https'], 'http://proxyuser:proxypass@192.168.1.1:8080');" I get this message:<br>
<br>Failed: 400 Bad Request<br>