LWP with proxy problem

From: Woogie (kent_zunker_at_bmc.com)
Date: 12/20/03


Date: 20 Dec 2003 09:02:15 -0800

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::Protocol::http::request: ()
LWP::Protocol::collect: read 28 bytes
LWP::UserAgent::request: Simple response: OK

Home
PE

Trace with proxy:

LWP::UserAgent::new: ()
LWP::UserAgent::proxy: 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::Protocol::http::request: ()
LWP::Protocol::collect: read 236 bytes
LWP::Protocol::collect: read 594 bytes
LWP::Protocol::collect: read 416 bytes
LWP::Protocol::collect: read 450 bytes
LWP::Protocol::collect: read 1017 bytes
LWP::Protocol::collect: read 443 bytes
LWP::Protocol::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::Debug::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;



Relevant Pages

  • Re: LWP with proxy problem
    ... > When running the sample code below without a proxy the GET returns the ... > expected data. ... When run with the $proxy uncommented the GET returns ... > Trace without proxy: ...
    (comp.lang.perl.misc)
  • LWP with proxy problem
    ... When running the sample code below without a proxy the GET returns the ... expected data. ... Trace without proxy: ...
    (comp.lang.perl.misc)
  • Re: LWP with proxy problem
    ... > When running the sample code below without a proxy the GET returns the ... When run with the $proxy uncommented the GET returns ... > Trace without proxy: ... in the proxy URL, ...
    (comp.lang.perl.misc)
  • Re: The page cannot be displayed
    ... How do I do a simple proxy trace? ... Change your Connection settings to say you're using a proxy ... requests are being sent in each case. ...
    (microsoft.public.windows.inetexplorer.ie6.browser)
  • Re: How to resolve SOAP differences
    ... to the "Proxy" property of HttpWebRequest. ... >> number of free trace tools available, ... But WinHttpCfg is able to trace HTTPS. ...
    (microsoft.public.dotnet.framework.webservices)