Re: [squid-users] browser caught in a loop while redirecting

From: Robert Collins <robertc@dont-contact.us>
Date: 04 Apr 2003 07:39:34 +1000

On Fri, 2003-04-04 at 07:29, Mack wrote:
> Hi!
>
> This has probably come up before on the list, but couldn't find anything. I have the
> following code as a redirection perl script:
>
> #!/usr/bin/perl
> $|=1;
>
> while (<>)
> {
> $url = "http://www.somesite.com\n";
> print "302:$url\n";
> }
>
> I took an example from squid-cache.org and just modified it, and please forgive me if
> the code is totally wrong because I'm no perl genius (i'm no programming genius in
> general, for that matter!). My problem is that the browser seems to be caught in a
> loop--it continuously redirects to the "http://www.somesite.com" and never gets there.
> It's like the refresh button is held down indefinitely or something. The page never
> loads, just keeps "refreshing". I can hit the stop button and just get an action
> canceled erorr page. Does anybody know what I've done wrong?

Two things. One, you are printing
http://www.somesite.com\n\n <--note the double \n!

Two, you are doing it unconditionally, so *every* request will get
redirected, even ones for www.somesite.com.

Rob

-- 
GPG key available at: <http://users.bigpond.net.au/robertc/keys.txt>.

Received on Thu Apr 03 2003 - 14:40:18 MST

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 17:14:39 MST