W
Woogie
When running the sample code below without a proxy the GET returns the
expected data. When run with the $proxy uncommented the GET returns
the content of the login page for the site being accessed. The site
in the code is valid for ease of testing. I also am including the LWP
debug info for each attempt.
Can anyone explain this behavior and what can I do to correct it?
Thanks in advance
Trace without proxy:
LWP::UserAgent::new: ()
LWP::UserAgent::request: ()
LWP::UserAgent::send_request: GET
https://squid.servebeer.com/getservices.do?user=Guest&password=JustLooking&format=csv
LWP::UserAgent::_need_proxy: Not proxied
LWP:
rotocol::http::request: ()
LWP:
rotocol::collect: read 28 bytes
LWP::UserAgent::request: Simple response: OK
Home
PE
Trace with proxy:
LWP::UserAgent::new: ()
LWP::UserAgent:
roxy: https http://148.245.207.85:8080
LWP::UserAgent::request: ()
LWP::UserAgent::send_request: GET
https://squid.servebeer.com/getservices.do?user=Guest&password=JustLooking&format=csv
LWP::UserAgent::_need_proxy: Proxied to http://148.245.207.85:8080
LWP:
rotocol::http::request: ()
LWP:
rotocol::collect: read 236 bytes
LWP:
rotocol::collect: read 594 bytes
LWP:
rotocol::collect: read 416 bytes
LWP:
rotocol::collect: read 450 bytes
LWP:
rotocol::collect: read 1017 bytes
LWP:
rotocol::collect: read 443 bytes
LWP:
rotocol::collect: read 643 bytes
LWP::UserAgent::request: Simple response: OK
<html lang="en">
<!-- Start Head -->
<head>
<title>
Error
</title>
<script language="JavaScript">
....
Here is the sample code:
#!/usr/bin/perl -w
use LWP::UserAgent;
use HTTP::Request;
use HTTP::Response;
use Crypt::SSLeay;
LWP:
ebug::level('+');
$url = "https://squid.servebeer.com/getservices.do?user=Guest&password=JustLooking&format=csv";
#$proxy="http://xxx.xxx.xxx.xxx:8080";
$ua = LWP::UserAgent->new();
if (defined $proxy)
{
$ENV{HTTPS_PROXY} = $proxy;
# initialize from environment variables
$ua->env_proxy;
}
$req = HTTP::Request->new(GET => $url);
$response = $ua->request($req);
if ($response->is_error())
{
printf " %s\n", $response->status_line;
}
else
{
$content = $response->content();
print $content;
}
exit;
expected data. When run with the $proxy uncommented the GET returns
the content of the login page for the site being accessed. The site
in the code is valid for ease of testing. I also am including the LWP
debug info for each attempt.
Can anyone explain this behavior and what can I do to correct it?
Thanks in advance
Trace without proxy:
LWP::UserAgent::new: ()
LWP::UserAgent::request: ()
LWP::UserAgent::send_request: GET
https://squid.servebeer.com/getservices.do?user=Guest&password=JustLooking&format=csv
LWP::UserAgent::_need_proxy: Not proxied
LWP:
LWP:
LWP::UserAgent::request: Simple response: OK
Home
PE
Trace with proxy:
LWP::UserAgent::new: ()
LWP::UserAgent:
LWP::UserAgent::request: ()
LWP::UserAgent::send_request: GET
https://squid.servebeer.com/getservices.do?user=Guest&password=JustLooking&format=csv
LWP::UserAgent::_need_proxy: Proxied to http://148.245.207.85:8080
LWP:
LWP:
LWP:
LWP:
LWP:
LWP:
LWP:
LWP:
LWP::UserAgent::request: Simple response: OK
<html lang="en">
<!-- Start Head -->
<head>
<title>
Error
</title>
<script language="JavaScript">
....
Here is the sample code:
#!/usr/bin/perl -w
use LWP::UserAgent;
use HTTP::Request;
use HTTP::Response;
use Crypt::SSLeay;
LWP:
$url = "https://squid.servebeer.com/getservices.do?user=Guest&password=JustLooking&format=csv";
#$proxy="http://xxx.xxx.xxx.xxx:8080";
$ua = LWP::UserAgent->new();
if (defined $proxy)
{
$ENV{HTTPS_PROXY} = $proxy;
# initialize from environment variables
$ua->env_proxy;
}
$req = HTTP::Request->new(GET => $url);
$response = $ua->request($req);
if ($response->is_error())
{
printf " %s\n", $response->status_line;
}
else
{
$content = $response->content();
print $content;
}
exit;