/*
- * $Id: client_side.cc,v 1.565 2002/03/07 12:11:26 adrian Exp $
+ * $Id: client_side.cc,v 1.566 2002/04/01 05:59:50 wessels Exp $
*
* DEBUG: section 33 Client-side Routines
* AUTHOR: Duane Wessels
/* h->reqbuf = h->norm_reqbuf; */
assert(h->reqbuf == h->norm_reqbuf);
storeClientCopy(h->sc, e, 0, HTTP_REQBUF_SZ, h->reqbuf,
- clientSendMoreData, h);
+ clientSendMoreData, h);
return e;
}
storeUnlockObject(entry);
entry = http->entry = http->old_entry;
http->sc = http->old_sc;
- http->reqbuf = http->norm_reqbuf;
- http->reqofs = http->old_reqofs;
- http->reqsize = http->old_reqsize;
+ http->reqbuf = http->norm_reqbuf;
+ http->reqofs = http->old_reqofs;
+ http->reqsize = http->old_reqsize;
} else if (STORE_PENDING == entry->store_status && 0 == status) {
debug(33, 3) ("clientHandleIMSReply: Incomplete headers for '%s'\n", url);
if (size + http->reqofs >= HTTP_REQBUF_SZ) {
storeUnlockObject(entry);
entry = http->entry = http->old_entry;
http->sc = http->old_sc;
- http->reqbuf = http->norm_reqbuf;
- http->reqofs = http->old_reqofs;
- http->reqsize = http->old_reqsize;
+ http->reqbuf = http->norm_reqbuf;
+ http->reqofs = http->old_reqofs;
+ http->reqsize = http->old_reqsize;
/* continue */
} else {
- http->reqofs += size;
+ http->reqofs += size;
storeClientCopy(http->sc, entry,
http->out.offset + http->reqofs,
HTTP_REQBUF_SZ - http->reqofs,
requestUnlink(entry->mem_obj->request);
entry->mem_obj->request = NULL;
}
- http->reqbuf = http->norm_reqbuf;
- http->reqofs = http->old_reqofs;
- http->reqsize = http->old_reqsize;
+ http->reqbuf = http->norm_reqbuf;
+ http->reqofs = http->old_reqofs;
+ http->reqsize = http->old_reqsize;
} else {
/* the client can handle this reply, whatever it is */
http->log_type = LOG_TCP_REFRESH_MISS;
http->entry->mem_obj->method = http->request->method;
http->sc = storeClientListAdd(http->entry, http);
http->log_type = LOG_TCP_HIT;
- http->reqofs = 0;
+ http->reqofs = 0;
storeClientCopy(http->sc, http->entry,
http->out.offset,
HTTP_REQBUF_SZ,
}
/* ignore range header in non-GETs */
if (request->method == METHOD_GET) {
- /*
- * Since we're not doing ranges atm, just set the flag if
- * the header exists, and then free the range header info
- * -- adrian
- */
- request->range = httpHeaderGetRange(req_hdr);
- if (request->range) {
- request->flags.range = 1;
- httpHdrRangeDestroy(request->range);
- request->range = NULL;
- }
+ /*
+ * Since we're not doing ranges atm, just set the flag if
+ * the header exists, and then free the range header info
+ * -- adrian
+ */
+ request->range = httpHeaderGetRange(req_hdr);
+ if (request->range) {
+ request->flags.range = 1;
+ httpHdrRangeDestroy(request->range);
+ request->range = NULL;
+ }
}
if (httpHeaderHas(req_hdr, HDR_AUTHORIZATION))
request->flags.auth = 1;
clientProcessMiss(http);
} else {
debug(33, 3) ("clientCacheHit: waiting for HTTP reply headers\n");
- http->reqofs += size;
- assert(http->reqofs <= HTTP_REQBUF_SZ);
+ http->reqofs += size;
+ assert(http->reqofs <= HTTP_REQBUF_SZ);
storeClientCopy(http->sc, e,
http->out.offset + http->reqofs,
HTTP_REQBUF_SZ,
aclChecklistFree(ch);
} else if (size < HTTP_REQBUF_SZ && entry->store_status == STORE_PENDING) {
/* wait for more to arrive */
- http->reqofs += retsize;
- assert(http->reqofs <= HTTP_REQBUF_SZ);
+ http->reqofs += retsize;
+ assert(http->reqofs <= HTTP_REQBUF_SZ);
storeClientCopy(http->sc, entry,
http->out.offset + http->reqofs,
HTTP_REQBUF_SZ - http->reqofs,
return;
}
} else {
- /* Avoid copying to MemBuf if we know "rep" is NULL, and we only have a body */
- http->out.offset += body_size;
- assert(rep == NULL);
- comm_write(fd, buf, size, clientWriteBodyComplete, http, NULL);
- /* NULL because clientWriteBodyComplete frees it */
- return;
+ /* Avoid copying to MemBuf if we know "rep" is NULL, and we only have a body */
+ http->out.offset += body_size;
+ assert(rep == NULL);
+ comm_write(fd, buf, size, clientWriteBodyComplete, http, NULL);
+ /* NULL because clientWriteBodyComplete frees it */
+ return;
}
if (http->request->method == METHOD_HEAD) {
if (rep) {
if (0 == storeClientCopyPending(http->sc, entry, http)) {
if (EBIT_TEST(entry->flags, ENTRY_ABORTED))
debug(33, 0) ("clientKeepaliveNextRequest: ENTRY_ABORTED\n");
- http->reqofs = 0;
+ http->reqofs = 0;
storeClientCopy(http->sc, entry,
http->out.offset,
HTTP_REQBUF_SZ,
* storage manager. */
if (EBIT_TEST(entry->flags, ENTRY_ABORTED))
debug(33, 0) ("clientWriteComplete 2: ENTRY_ABORTED\n");
- http->reqofs = 0;
+ http->reqofs = 0;
storeClientCopy(http->sc, entry,
http->out.offset,
HTTP_REQBUF_SZ,
}
/* We don't cache any range requests (for now!) -- adrian */
if (r->flags.range) {
- http->entry = NULL;
- return LOG_TCP_MISS;
+ http->entry = NULL;
+ return LOG_TCP_MISS;
}
debug(33, 3) ("clientProcessRequest2: default HIT\n");
http->entry = e;
#if DELAY_POOLS
delaySetStoreClient(http->sc, delayClient(r));
#endif
- assert(http->log_type == LOG_TCP_HIT);
- http->reqofs = 0;
+ assert(http->log_type == LOG_TCP_HIT);
+ http->reqofs = 0;
storeClientCopy(http->sc, http->entry,
http->out.offset,
HTTP_REQBUF_SZ,
/*
- * $Id: comm.cc,v 1.326 2002/02/26 02:30:50 adrian Exp $
+ * $Id: comm.cc,v 1.327 2002/04/01 05:59:50 wessels Exp $
*
* DEBUG: section 5 Socket Functions
* AUTHOR: Harvest Derived
fde *F = NULL;
PF *callback;
for (fd = 0; fd <= Biggest_FD; fd++) {
- F = &fd_table[fd];
- if (!F->flags.open)
- continue;
- if (F->timeout == 0)
- continue;
- if (F->timeout > squid_curtime)
- continue;
- debug(5, 5) ("checkTimeouts: FD %d Expired\n", fd);
- if (F->timeout_handler) {
- debug(5, 5) ("checkTimeouts: FD %d: Call timeout handler\n", fd);
- callback = F->timeout_handler;
- F->timeout_handler = NULL;
- callback(fd, F->timeout_data);
- } else {
- debug(5, 5) ("checkTimeouts: FD %d: Forcing comm_close()\n", fd);
- comm_close(fd);
- }
- }
-}
-
-
-int
+ F = &fd_table[fd];
+ if (!F->flags.open)
+ continue;
+ if (F->timeout == 0)
+ continue;
+ if (F->timeout > squid_curtime)
+ continue;
+ debug(5, 5) ("checkTimeouts: FD %d Expired\n", fd);
+ if (F->timeout_handler) {
+ debug(5, 5) ("checkTimeouts: FD %d: Call timeout handler\n", fd);
+ callback = F->timeout_handler;
+ F->timeout_handler = NULL;
+ callback(fd, F->timeout_data);
+ } else {
+ debug(5, 5) ("checkTimeouts: FD %d: Forcing comm_close()\n", fd);
+ comm_close(fd);
+ }
+ }
+}
+
+
+int
commDeferRead(int fd)
{
fde *F = &fd_table[fd];
if (F->defer_check == NULL)
- return 0;
+ return 0;
return F->defer_check(fd, F->defer_data);
}
-