]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Deny forwarding loops in accel mode
authorwessels <>
Tue, 26 May 1998 22:34:19 +0000 (22:34 +0000)
committerwessels <>
Tue, 26 May 1998 22:34:19 +0000 (22:34 +0000)
src/client_side.cc

index a397bc8a90c26f77b02ee2d90cec1001f5d952d5..5fce190a738ad3464640415f21fd2c74977a3d3d 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: client_side.cc,v 1.313 1998/05/22 23:44:00 wessels Exp $
+ * $Id: client_side.cc,v 1.314 1998/05/26 16:34:19 wessels Exp $
  *
  * DEBUG: section 33    Client-side Routines
  * AUTHOR: Duane Wessels
@@ -763,11 +763,9 @@ clientInterpretRequestHeaders(clientHttpRequest * http)
        String s = httpHeaderGetList(req_hdr, HDR_VIA);
        /* ThisCache cannot be a member of Via header, "1.0 ThisCache" can */
        if (strListIsSubstr(&s, ThisCache, ',')) {
-           if (!http->flags.accel) {
-               debug(33, 1) ("WARNING: Forwarding loop detected for '%s'\n",
-                   http->uri);
-               debug(33, 1) ("--> %s\n", strBuf(s));
-           }
+           debug(33, 1) ("WARNING: Forwarding loop detected for '%s'\n",
+               http->uri);
+           debug(33, 1) ("--> %s\n", strBuf(s));
            EBIT_SET(request->flags, REQ_LOOPDETECT);
        }
 #if FORW_VIA_DB
@@ -1629,6 +1627,18 @@ clientProcessMiss(clientHttpRequest * http)
        clientProcessOnlyIfCachedMiss(http);
        return;
     }
+    /*
+     * Deny loops when running in accelerator/transproxy mode.
+     */
+    if (http->flags.accel && EBIT_TEST(r->flags, REQ_LOOPDETECT)) {
+       http->al.http.code = HTTP_FORBIDDEN;
+       err = errorCon(ERR_ACCESS_DENIED, HTTP_FORBIDDEN);
+       err->request = requestLink(r);
+       err->src_addr = http->conn->peer.sin_addr;
+       http->entry = clientCreateStoreEntry(http, r->method, 0);
+       errorAppendEntry(http->entry, err);
+       return;
+    }
     /*
      * Check if this host is allowed to fetch MISSES from us (miss_access)
      */