Squid 1.1.x redirect bug & fix

From: Brent Foster <B.R.Foster@dont-contact.us>
Date: Thu, 9 Jan 1997 16:23:44 +1200

We've discovered a redirector bug in Squid 1.1.x. It's actually caused by
our redirector misbehaving, but it would be nice if Squid handled it
Squid gets a segmentation fault when a redirector sends a response when it
hasn't been asked for one.

To fix it, lines 202-216 of redirect.c need to be replaced with the following:

        if (r == NULL) {
           /* A naughty redirector has spoken without being spoken to */
           debug(29, 0, "redirectHandleRead: unexpected reply: '%s'\n",
           redirector->offset = 0;
        } else {
           debug(29, 5, "redirectHandleRead: reply: '%s'\n",
           if (r->handler) {
                         t == redirector->inbuf ? NULL : redirector->inbuf);
           redirector->redirectState = NULL;
           redirector->flags &= ~REDIRECT_FLAG_BUSY;
           redirector->offset = 0;
           n = ++RedirectStats.replies;
           svc_time = tvSubMsec(redirector->dispatch_time, current_time);
           if (n > REDIRECT_AV_FACTOR)
              n = REDIRECT_AV_FACTOR;
              = (RedirectStats.avg_svc_time * (n - 1) + svc_time) / n;

Duane may have a better way to fix it but this seems to do the job for us.
Now I've got to figure out why the redirectors are randomly sending replies
to Squid that it hasn't asked for...

We're actually using redirectors as authenticators - I'll post a
description of what we've done soon.

Brent Foster
Systems Programmer, Massey University, New Zealand
Received on Wed Jan 08 1997 - 19:51:16 MST

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:34:02 MST