]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Fix the persistent connection case.
authoradrian <>
Fri, 9 Aug 2002 17:13:33 +0000 (17:13 +0000)
committeradrian <>
Fri, 9 Aug 2002 17:13:33 +0000 (17:13 +0000)
Persistent connections are a bit special and I mistreated them in my
original commit.

In a nutshell, i treated the second  "client" (second request) as having
had no data read from it. In the persistent connection this isn't the case -
at least one read is performed (one read was all I saw, but..) and then
the connection is stalled whilst data pours in from the first connection.

Now I pay attention to whats in http->reqbuf for the second connection
and feed that to clientSendMoreData. Seems to work, too.

Adrian

src/client_side.cc

index 90681db7033de8164bd47360f458da26035dd72d..c0542fda8848765bad5623aa6c7fabe85651a35b 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: client_side.cc,v 1.583 2002/07/20 23:23:17 hno Exp $
+ * $Id: client_side.cc,v 1.584 2002/08/09 11:13:33 adrian Exp $
  *
  * DEBUG: section 33    Client-side Routines
  * AUTHOR: Duane Wessels
@@ -1697,6 +1697,7 @@ clientKeepaliveNextRequest(clientHttpRequest * http)
 {
     ConnStateData *conn = http->conn;
     StoreEntry *entry;
+
     debug(33, 3) ("clientKeepaliveNextRequest: FD %d\n", conn->fd);
     conn->defer.until = 0;     /* Kick it to read a new request */
     httpRequestFree(http);
@@ -1734,13 +1735,28 @@ clientKeepaliveNextRequest(clientHttpRequest * http)
        if (0 == storeClientCopyPending(http->sc, entry, http)) {
            if (EBIT_TEST(entry->flags, ENTRY_ABORTED))
                debug(33, 0) ("clientKeepaliveNextRequest: ENTRY_ABORTED\n");
-           http->reqofs = 0;
-           storeClientCopy(http->sc, entry,
-               http->out.offset,
-               HTTP_REQBUF_SZ,
-               http->reqbuf,
-               clientSendMoreData,
-               http);
+            /* If we have any data in our reqbuf, use it */
+           if (http->reqsize > 0) {
+               /*
+                 * We can pass in reqbuf/size here, since clientSendMoreData ignores what
+                 * is passed and uses them itself.. :-)
+                 * -- adrian
+                 */
+                clientSendMoreData(http, http->reqbuf, http->reqsize);
+           } else {
+               assert(http->out.offset == 0);
+                /*
+                * here - have no data (don't ever think we get here..)
+                 * so lets start copying..
+                * -- adrian
+                */
+               storeClientCopy(http->sc, entry,
+                   http->out.offset,
+                   HTTP_REQBUF_SZ,
+                   http->reqbuf,
+                   clientSendMoreData,
+                   http);
+            }
        }
     }
 }