/*
- * $Id: client_side.cc,v 1.182 1997/12/31 23:57:16 wessels Exp $
+ * $Id: client_side.cc,v 1.183 1998/01/01 00:05:52 wessels Exp $
*
* DEBUG: section 33 Client-side Routines
* AUTHOR: Duane Wessels
} else {
debug(12, 5) ("clientWriteComplete: FD %d Setting read handler for next request\n", fd);
fd_note(fd, "Reading next request");
- commSetSelect(fd, COMM_SELECT_READ, clientReadRequest, conn, 0);
+ clientReadRequest(fd, conn); /* Read next request */
commSetTimeout(fd, 15, requestTimeout, conn);
}
} else {
if (!ignoreErrno(errno)) {
debug(50, 2) ("clientReadRequest: FD %d: %s\n", fd, xstrerror());
comm_close(fd);
+ return;
+ } else if(conn->in.offset == 0) {
+ debug(50, 2) ("clientReadRequest: FD %d: no data to process\n");
+ return;
}
- return;
+ /* Continue to process previously read data */
+ size=0;
}
conn->in.offset += size;
conn->in.buf[conn->in.offset] = '\0'; /* Terminate the string */
while (conn->in.offset > 0) {
+ int nrequests;
+ /* Limit the number of concurrent requests to 2 */
+ for (H = &conn->chr, nrequests = 0; *H; H = &(*H)->next, nrequests++);
+ if (nrequests >= 2) {
+ debug(12, 2) ("clientReadRequest: FD %d max concurrent requests reached\n", fd);
+ debug(12, 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 */
+ break;
+ }
+ /* Process request */
http = parseHttpRequest(conn,
&method,
&parser_return_code,
*/
if (conn->in.offset > 0)
memmove(conn->in.buf, conn->in.buf + http->req_sz, conn->in.size);
- /* link */
+ /* add to the client request queue */
for (H = &conn->chr; *H; H = &(*H)->next);
*H = http;
conn->nrequests++;
/*
- * $Id: store.cc,v 1.360 1997/12/31 05:53:19 wessels Exp $
+ * $Id: store.cc,v 1.361 1998/01/01 00:05:53 wessels Exp $
*
* DEBUG: section 20 Storeage Manager
* AUTHOR: Harvest Derived
storeKeyText(e->key));
return 1;
}
- diff = hdr_sz + content_length - e->object_len;
- if (diff != 0) {
- debug(20, 3) ("storeEntryValidLength: %d bytes too %s; '%s'\n",
- diff < 0 ? -diff : diff,
- diff < 0 ? "small" : "big",
+ if (e->mem_obj->method == METHOD_HEAD) {
+ debug(20, 5) ("storeEntryValidLength: HEAD request: %s\n",
storeKeyText(e->key));
- return 0;
+ return 1;
}
- return 1;
+ if (e->mem_obj->reply->code == HTTP_NOT_MODIFIED)
+ return 1;
+ if (e->mem_obj->reply->code == HTTP_NO_CONTENT)
+ return 1;
+ diff = hdr_sz + content_length - e->object_len;
+ if (diff == 0)
+ return 1;
+ debug(20, 3) ("storeEntryValidLength: %d bytes too %s; '%s'\n",
+ diff < 0 ? -diff : diff,
+ diff < 0 ? "small" : "big",
+ storeKeyText(e->key));
+ return 0;
}
static void