]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
This patch fixes a presistent connections bug/misfeature. We did non
authorwessels <>
Tue, 28 Apr 1998 02:03:55 +0000 (02:03 +0000)
committerwessels <>
Tue, 28 Apr 1998 02:03:55 +0000 (02:03 +0000)
honor any (Proxy-)Connection: header send by the server.

src/HttpReply.cc
src/http.cc
src/structs.h

index ee1319fd3fcfcb8aa4186e1eeec38d5c5ca9d88e..c54733b50e666fc3e396ffee3f2800ef5de96b97 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: HttpReply.cc,v 1.16 1998/04/27 19:16:06 wessels Exp $
+ * $Id: HttpReply.cc,v 1.17 1998/04/27 20:03:56 wessels Exp $
  *
  * DEBUG: section 58    HTTP Reply (Response)
  * AUTHOR: Alex Rousskov
@@ -273,7 +273,14 @@ httpReplyHdrCacheInit(HttpReply * rep)
     str = httpHeaderGetStr(hdr, HDR_PROXY_CONNECTION);
     if (NULL == str)
        str = httpHeaderGetStr(hdr, HDR_CONNECTION);    /* @?@ FIX ME */
-    rep->proxy_keep_alive = str && 0 == strcasecmp(str, "Keep-Alive");
+    if (str) {
+       rep->keep_alive = (strcasecmp(str, "Keep-Alive") == 0);
+    } else {
+       if (rep->sline.version >= 1.1)
+           rep->keep_alive = 1;        /* 1.1+ defaults to keep-alive */
+       else
+           rep->keep_alive = 0;        /* pre 1.1 default to non-keep-alive */
+    }
     /* final adjustments */
     /* The max-age directive takes priority over Expires, check it first */
     if (rep->cache_control && rep->cache_control->max_age >= 0)
index 4f2abee76ef203c48f6aec0f514179ddf4652274..8918ebcd8acd04bcaf9a81d96b381a1f3af2e19e 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: http.cc,v 1.267 1998/04/27 19:54:01 wessels Exp $
+ * $Id: http.cc,v 1.268 1998/04/27 20:03:55 wessels Exp $
  *
  * DEBUG: section 11    Hypertext Transfer Protocol (HTTP)
  * AUTHOR: Harvest Derived
@@ -366,7 +366,7 @@ httpProcessReplyHeader(HttpStateData * httpState, const char *buf, int size)
        if (EBIT_TEST(httpState->flags, HTTP_KEEPALIVE))
            if (httpState->peer)
                httpState->peer->stats.n_keepalives_sent++;
-       if (reply->proxy_keep_alive)
+       if (reply->keep_alive)
            if (httpState->peer)
                httpState->peer->stats.n_keepalives_recv++;
        ctx_exit(ctx);
@@ -386,6 +386,11 @@ httpPconnTransferDone(HttpStateData * httpState)
      */
     if (!EBIT_TEST(httpState->flags, HTTP_KEEPALIVE))
        return 0;
+    /*
+     * What does the reply have to say about keep-alive?
+     */
+    if (!reply->keep_alive)
+       return 0;
     debug(11, 5) ("httpPconnTransferDone: content_length=%d\n",
        reply->content_length);
     /*
@@ -524,6 +529,7 @@ httpReadReply(int fd, void *data)
            httpState->fd = -1;
            httpStateFree(-1, httpState);
        } else {
+           /* Wait for EOF condition */
            commSetSelect(fd, COMM_SELECT_READ, httpReadReply, httpState, 0);
        }
     }
index 558bc355b9bebb7a8c12171ca6bf650162ecd8b1..a64bbbbdbe453f4b4e878414818ba0719e78e8bc 100644 (file)
@@ -563,7 +563,7 @@ struct _HttpReply {
     String content_type;
     HttpHdrCc *cache_control;
     HttpHdrContRange *content_range;
-    short int proxy_keep_alive;
+    short int keep_alive;
 
     /* public, readable */
     HttpMsgParseState pstate;  /* the current parsing state */