]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
pipeline_prefetch directive to disable/enable the prefetch of pipelined
authorhno <>
Wed, 21 Feb 2001 05:49:23 +0000 (05:49 +0000)
committerhno <>
Wed, 21 Feb 2001 05:49:23 +0000 (05:49 +0000)
requests.

src/cf.data.pre
src/client_side.cc
src/structs.h

index 580f94c7fb2e17681797ba58318b48faec3d7e93..eb49b8df129bdb87d62d729a28c94a53aa84b819 100644 (file)
@@ -1,6 +1,6 @@
 
 #
-# $Id: cf.data.pre,v 1.214 2001/02/10 16:40:40 hno Exp $
+# $Id: cf.data.pre,v 1.215 2001/02/20 22:49:23 hno Exp $
 #
 #
 # SQUID Web Proxy Cache          http://www.squid-cache.org/
@@ -3492,6 +3492,16 @@ DOC_START
        disable persistent connections with clients and/or servers.
 DOC_END
 
+NAME: pipeline_prefetch
+TYPE: onoff
+LOC: Config.onoff.pipeline_prefetch
+DEFAULT: on
+DOC_START
+       To boost the performance of pipelined requests to closer
+       match that of a non-proxied environment Squid tries to fetch
+       up to two requests in parallell from a pipeline.
+DOC_END
+
 NAME: extension_methods
 TYPE: wordlist
 LOC: Config.ext_methods
index e6c707faaedb21ff766c8fb4f3236877b4c99cdb..cd22b90b1f71646a2ccc013839f99ae953fe4256 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: client_side.cc,v 1.527 2001/02/13 21:45:48 hno Exp $
+ * $Id: client_side.cc,v 1.528 2001/02/20 22:49:23 hno Exp $
  *
  * DEBUG: section 33    Client-side Routines
  * AUTHOR: Duane Wessels
@@ -1706,18 +1706,19 @@ clientRequestBodyTooLarge(int clen)
  * mysterious breakages.
  */
 static int
-clientAlwaysAllowResponse(http_status sline) {
+clientAlwaysAllowResponse(http_status sline)
+{
     switch (sline) {
-       case HTTP_CONTINUE:
-       case HTTP_SWITCHING_PROTOCOLS:
-       case HTTP_PROCESSING:
-       case HTTP_NO_CONTENT:
-       case HTTP_NOT_MODIFIED:
-           return 1;
-           /* unreached */
-           break;
-       default:
-           return 0;
+    case HTTP_CONTINUE:
+    case HTTP_SWITCHING_PROTOCOLS:
+    case HTTP_PROCESSING:
+    case HTTP_NO_CONTENT:
+    case HTTP_NOT_MODIFIED:
+       return 1;
+       /* unreached */
+       break;
+    default:
+       return 0;
     }
 }
 
@@ -1790,7 +1791,7 @@ clientSendMoreData(void *data, char *buf, ssize_t size)
        } else if (rep) {
            aclCheck_t *ch;
            int rv;
-           body_size = size - rep->hdr_sz;
+           body_size = size - rep->hdr_sz;
            assert(body_size >= 0);
            body_buf = buf + rep->hdr_sz;
            http->range_iter.prefix_size = rep->hdr_sz;
@@ -1803,7 +1804,7 @@ clientSendMoreData(void *data, char *buf, ssize_t size)
                RequestMethodStr[http->request->method], http->uri,
                rv ? "ALLOWED" : "DENIED",
                AclMatchedName ? AclMatchedName : "NO ACL's");
-           if (!rv && rep->sline.status != HTTP_FORBIDDEN 
+           if (!rv && rep->sline.status != HTTP_FORBIDDEN
                && !clientAlwaysAllowResponse(rep->sline.status)) {
                /* the if above is slightly broken, but there is no way
                 * to tell if this is a squid generated error page, or one from
@@ -2534,12 +2535,11 @@ parseHttpRequest(ConnStateData * conn, method_t * method_p, int *status,
                    snprintf(http->uri, url_sz, "http://%s:%d%s",
                        inet_ntoa(http->conn->me.sin_addr),
                        vport, url);
-           } else
-               if (vport_mode)
-                   vport = natLookup.nl_realport;
-               snprintf(http->uri, url_sz, "http://%s:%d%s",
-                   inet_ntoa(natLookup.nl_realip),
-                   vport, url);
+           } else if (vport_mode)
+               vport = natLookup.nl_realport;
+           snprintf(http->uri, url_sz, "http://%s:%d%s",
+               inet_ntoa(natLookup.nl_realip),
+               vport, url);
 #else
 #if LINUX_NETFILTER
            /* If the call fails the address structure will be unchanged */
@@ -2672,7 +2672,7 @@ clientReadRequest(int fd, void *data)
            break;
        /* Limit the number of concurrent requests to 2 */
        for (H = &conn->chr, nrequests = 0; *H; H = &(*H)->next, nrequests++);
-       if (nrequests >= 2) {
+       if (nrequests >= (Config.onoff.pipeline_prefetch ? 2 : 1)) {
            debug(33, 3) ("clientReadRequest: FD %d max concurrent requests reached\n", fd);
            debug(33, 5) ("clientReadRequest: FD %d defering new request until one is done\n", fd);
            conn->defer.until = squid_curtime + 100;    /* Reset when a request is complete */
index 5f1cb110041397cef9f5ba5fcf22be0d89d10f04..c31487c515b5e54bcb2c7f8409e3daa83b09948d 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: structs.h,v 1.383 2001/02/17 07:28:50 hno Exp $
+ * $Id: structs.h,v 1.384 2001/02/20 22:49:24 hno Exp $
  *
  *
  * SQUID Web Proxy Cache          http://www.squid-cache.org/
@@ -536,6 +536,7 @@ struct _SquidConfig {
        int log_ip_on_direct;
        int authenticateIpTTLStrict;
        int ie_refresh;
+       int pipeline_prefetch;
     } onoff;
     acl *aclList;
     struct {