in reply to How to Get around Proxy

Try setting the If-Last-Modified header in the request to the current time. This should make your proxy get the latest version rather than use a cache version.

The code below uses LWP in debug mode to work through the problem.

#! /usr/bin/perl -w use strict; use warnings; use LWP::Debug qw(+); #for debugging info use LWP::UserAgent; use HTTP::Request; use HTTP::Response; use HTTP::Date; # Create a user agent that uses the proxy info from the environment my $ua = LWP::UserAgent->new(env_proxy=>1); # Create the request my $request = HTTP::Request->new('GET'=>'http://www.perlmonks.com/'); # Add the If-Modified-Since header $request->push_header (if_modified_since=>time2str(time)); #Submit your request my $response = $ua->request($request); if ($response->is_success) { print "Retrieved URL OK\n"; } else { print $response->status_line . "\n"; }

inman

Replies are listed 'Best First'.
Re: Re: How to Get around Proxy
by tachyon (Chancellor) on Oct 27, 2003 at 23:16 UTC

    It is probably a good idea to use (time - 86400) or some time yesterday just to make sure that time sync errors don't cause any issues. ++ as this method is what is supposed to work. As we all know however some (if not all) proxies play fairly fast and loose with caching which is why I suggested the ugly query string hack.

    cheers

    tachyon

    s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print

      Somehow ur tricks doesnt seem to wrok..... will some one check my code instead. And give me an idea where have gone wrong