From: wessels <> Date: Fri, 16 Oct 1998 05:44:37 +0000 (+0000) Subject: clientKeepaliveNextRequest() used to assume (assert) that conn->chr X-Git-Tag: SQUID_3_0_PRE1~2570 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=21f2031d74ebc4ea400abed6d84990bc1c205859;p=thirdparty%2Fsquid.git clientKeepaliveNextRequest() used to assume (assert) that conn->chr was either NULL, or if conn->chr was set, then conn->chr->entry must also be set. But the cilent request could be blocked on ACL or redirector operations, in which case conn->chr->entry is NULL. --- diff --git a/src/client_side.cc b/src/client_side.cc index 879bdf6be3..5ff9d09180 100644 --- a/src/client_side.cc +++ b/src/client_side.cc @@ -1,6 +1,6 @@ /* - * $Id: client_side.cc,v 1.413 1998/10/15 23:40:05 wessels Exp $ + * $Id: client_side.cc,v 1.414 1998/10/15 23:44:37 wessels Exp $ * * DEBUG: section 33 Client-side Routines * AUTHOR: Duane Wessels @@ -230,9 +230,9 @@ clientRedirectDone(void *data, char *result) char *t = result; if ((t = strchr(result, ':')) != NULL) { http->redirect.status = status; - http->redirect.location = xstrdup(t+1); + http->redirect.location = xstrdup(t + 1); } else { - debug(33,1)("clientRedirectDone: bad input: %s\n", result); + debug(33, 1) ("clientRedirectDone: bad input: %s\n", result); } } if (strcmp(result, http->uri)) @@ -1524,8 +1524,7 @@ clientSendMoreData(void *data, char *buf, ssize_t size) memFree(MEM_CLIENT_SOCK_BUF, buf); } -static -void +static void clientKeepaliveNextRequest(clientHttpRequest * http) { ConnStateData *conn = http->conn; @@ -1533,10 +1532,26 @@ clientKeepaliveNextRequest(clientHttpRequest * http) debug(33, 3) ("clientKeepaliveNextRequest: FD %d\n", conn->fd); conn->defer.until = 0; /* Kick it to read a new request */ httpRequestFree(http); - if ((http = conn->chr) != NULL) { + if ((http = conn->chr) == NULL) { + debug(33, 5) ("clientKeepaliveNextRequest: FD %d reading next req\n", + conn->fd); + fd_note(conn->fd, "Reading next request"); + /* + * Set the timeout BEFORE calling clientReadRequest(). + */ + commSetTimeout(conn->fd, 15, requestTimeout, conn); + clientReadRequest(conn->fd, conn); /* Read next request */ + /* + * Note, the FD may be closed at this point. + */ + } else if ((entry = http->entry) == NULL) { + /* + * this request is in progress, maybe doing an ACL or a redirect, + * execution will resume after the operation completes. + */ + } else { debug(33, 1) ("clientKeepaliveNextRequest: FD %d Sending next\n", conn->fd); - entry = http->entry; assert(entry); if (0 == storeClientCopyPending(entry, http)) { if (entry->store_status == STORE_ABORTED) @@ -1549,18 +1564,6 @@ clientKeepaliveNextRequest(clientHttpRequest * http) clientSendMoreData, http); } - } else { - debug(33, 5) ("clientKeepaliveNextRequest: FD %d reading next request\n", - conn->fd); - fd_note(conn->fd, "Reading next request"); - /* - * Set the timeout BEFORE calling clientReadRequest(). - */ - commSetTimeout(conn->fd, 15, requestTimeout, conn); - clientReadRequest(conn->fd, conn); /* Read next request */ - /* - * Note, the FD may be closed at this point. - */ } }