--------------------- PatchSet 4610 Date: 2002/08/09 12:18:52 Author: rbcollins Branch: esi Tag: (none) Log: update debug sections for rearranged code Members: src/client_side.c:1.65.2.1->1.65.2.2 src/client_side_reply.c:1.1.2.1->1.1.2.2 src/client_side_request.c:1.1.2.1->1.1.2.2 src/protos.h:1.59.2.1->1.59.2.2 Index: squid/src/client_side.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/client_side.c,v retrieving revision 1.65.2.1 retrieving revision 1.65.2.2 diff -u -r1.65.2.1 -r1.65.2.2 --- squid/src/client_side.c 9 Aug 2002 11:49:45 -0000 1.65.2.1 +++ squid/src/client_side.c 9 Aug 2002 12:18:52 -0000 1.65.2.2 @@ -1,6 +1,6 @@ /* - * $Id: client_side.c,v 1.65.2.1 2002/08/09 11:49:45 rbcollins Exp $ + * $Id: client_side.c,v 1.65.2.2 2002/08/09 12:18:52 rbcollins Exp $ * * DEBUG: section 33 Client-side Routines * AUTHOR: Duane Wessels @@ -93,7 +93,6 @@ static PF connStateFree; static PF requestTimeout; static PF clientLifetimeTimeout; -/* FIXME: move to _request.c */ int clientCheckTransferDone(clientHttpRequest const *); static void checkFailureRatio(err_type, hier_code); static clientHttpRequest *parseHttpRequestAbort(ConnStateData * conn, const char *uri); static clientHttpRequest *parseHttpRequest(ConnStateData *, method_t *, int *, char **, size_t *); @@ -104,7 +103,6 @@ static void clientSetKeepaliveFlag(clientHttpRequest *); static int clientCheckContentLength(request_t * r); static DEFER httpAcceptDefer; -/* FIXME: remove */ int clientReplyBodyTooLarge(HttpReply *, ssize_t clen); static int clientRequestBodyTooLarge(int clen); static void clientProcessBody(ConnStateData * conn); @@ -1562,75 +1560,6 @@ #endif /* USE_SSL */ -#define SENDING_BODY 0 -#define SENDING_HDRSONLY 1 -int -clientCheckTransferDone(clientHttpRequest const * http) -{ - int sending = SENDING_BODY; - StoreEntry *entry = http->entry; - MemObject *mem; - http_reply *reply; - int sendlen; - if (entry == NULL) - return 0; - /* - * For now, 'done_copying' is used for special cases like - * Range and HEAD requests. - */ - if (http->flags.done_copying) - return 1; - /* - * Handle STORE_OK objects. - * objectLen(entry) will be set proprely. - */ - if (entry->store_status == STORE_OK) { - if (http->out.offset >= objectLen(entry)) - return 1; - else - return 0; - } - /* - * Now, handle STORE_PENDING objects - */ - mem = entry->mem_obj; - assert(mem != NULL); - assert(http->request != NULL); - reply = mem->reply; - if (reply->hdr_sz == 0) - return 0; /* haven't found end of headers yet */ - else if (reply->sline.status == HTTP_OK) - sending = SENDING_BODY; - else if (reply->sline.status == HTTP_NO_CONTENT) - sending = SENDING_HDRSONLY; - else if (reply->sline.status == HTTP_NOT_MODIFIED) - sending = SENDING_HDRSONLY; - else if (reply->sline.status < HTTP_OK) - sending = SENDING_HDRSONLY; - else if (http->request->method == METHOD_HEAD) - sending = SENDING_HDRSONLY; - else - sending = SENDING_BODY; - /* - * Figure out how much data we are supposed to send. - * If we are sending a body and we don't have a content-length, - * then we must wait for the object to become STORE_OK. - */ - if (sending == SENDING_HDRSONLY) - sendlen = reply->hdr_sz; - else if (reply->content_length < 0) - return 0; - else - sendlen = reply->content_length + reply->hdr_sz; - /* - * Now that we have the expected length, did we send it all? - */ - if (http->out.offset < sendlen) - return 0; - else - return 1; -} - /* * This function is designed to serve a fairly specific purpose. * Occasionally our vBNS-connected caches can talk to each other, but not Index: squid/src/client_side_reply.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/Attic/client_side_reply.c,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -u -r1.1.2.1 -r1.1.2.2 --- squid/src/client_side_reply.c 9 Aug 2002 11:49:45 -0000 1.1.2.1 +++ squid/src/client_side_reply.c 9 Aug 2002 12:18:53 -0000 1.1.2.2 @@ -1,9 +1,9 @@ /* - * $Id: client_side_reply.c,v 1.1.2.1 2002/08/09 11:49:45 rbcollins Exp $ + * $Id: client_side_reply.c,v 1.1.2.2 2002/08/09 12:18:53 rbcollins Exp $ * * DEBUG: section 88 Client-side Reply Routines - * AUTHOR: Robert Collins + * AUTHOR: Robert Collins (Originally Duane Wessels in client_side.c) * * SQUID Web Proxy Cache http://www.squid-cache.org/ * ---------------------------------------------------------- @@ -41,7 +41,6 @@ extern aclCheck_t * clientAclChecklistCreate(const acl_access * acl, const clientHttpRequest * http); /* used in all client_* source files */ static int clientGotNotEnough(clientHttpRequest const *); /* static */ int clientReplyBodyTooLarge(HttpReply *, ssize_t); -int clientCheckTransferDone(clientHttpRequest const *); /* This will go away when clientProcessRequest gets split */ extern void clientProcessRequest(clientHttpRequest *); static int clientOnlyIfCached(clientHttpRequest * http); @@ -60,7 +59,7 @@ clientHttpRequest *http = data; char *url = http->uri; StoreEntry *entry = NULL; - debug(33, 3) ("clientProcessExpired: '%s'\n", http->uri); + debug(88, 3) ("clientProcessExpired: '%s'\n", http->uri); assert(http->entry->lastmod >= 0); /* * check if we are allowed to contact other servers @@ -96,13 +95,13 @@ delaySetStoreClient(http->sc, delayClient(http)); #endif http->request->lastmod = http->old_entry->lastmod; - debug(33, 5) ("clientProcessExpired: lastmod %ld\n", (long int) entry->lastmod); + debug(88, 5) ("clientProcessExpired: lastmod %ld\n", (long int) entry->lastmod); http->entry = entry; http->out.offset = 0; fwdStart(http->conn ? http->conn->fd : -1, http->entry, http->request); /* Register with storage manager to receive updates when data comes in. */ if (EBIT_TEST(entry->flags, ENTRY_ABORTED)) - debug(33, 0) ("clientProcessExpired: found ENTRY_ABORTED object\n"); + debug(88, 0) ("clientProcessExpired: found ENTRY_ABORTED object\n"); http->reqofs = 0; storeClientCopy(http->sc, entry, http->out.offset, @@ -118,10 +117,10 @@ int object_length; MemObject *mem = entry->mem_obj; time_t mod_time = entry->lastmod; - debug(33, 3) ("modifiedSince: '%s'\n", storeUrl(entry)); + debug(88, 3) ("modifiedSince: '%s'\n", storeUrl(entry)); if (mod_time < 0) mod_time = entry->timestamp; - debug(33, 3) ("modifiedSince: mod_time = %ld\n", (long int) mod_time); + debug(88, 3) ("modifiedSince: mod_time = %ld\n", (long int) mod_time); if (mod_time < 0) return 1; /* Find size of the object */ @@ -129,19 +128,19 @@ if (object_length < 0) object_length = contentLen(entry); if (mod_time > request->ims) { - debug(33, 3) ("--> YES: entry newer than client\n"); + debug(88, 3) ("--> YES: entry newer than client\n"); return 1; } else if (mod_time < request->ims) { - debug(33, 3) ("--> NO: entry older than client\n"); + debug(88, 3) ("--> NO: entry older than client\n"); return 0; } else if (request->imslen < 0) { - debug(33, 3) ("--> NO: same LMT, no client length\n"); + debug(88, 3) ("--> NO: same LMT, no client length\n"); return 0; } else if (request->imslen == object_length) { - debug(33, 3) ("--> NO: same LMT, same length\n"); + debug(88, 3) ("--> NO: same LMT, same length\n"); return 0; } else { - debug(33, 3) ("--> YES: same LMT, different length\n"); + debug(88, 3) ("--> YES: same LMT, different length\n"); return 1; } } @@ -150,35 +149,35 @@ clientGetsOldEntry(StoreEntry * new_entry, StoreEntry * old_entry, request_t * request){ const http_status status = new_entry->mem_obj->reply->sline.status; if (0 == status) { - debug(33, 5) ("clientGetsOldEntry: YES, broken HTTP reply\n"); + debug(88, 5) ("clientGetsOldEntry: YES, broken HTTP reply\n"); return 1; } /* If the reply is a failure then send the old object as a last * resort */ if (status >= 500 && status < 600) { - debug(33, 3) ("clientGetsOldEntry: YES, failure reply=%d\n", status); + debug(88, 3) ("clientGetsOldEntry: YES, failure reply=%d\n", status); return 1; } /* If the reply is anything but "Not Modified" then * we must forward it to the client */ if (HTTP_NOT_MODIFIED != status) { - debug(33, 5) ("clientGetsOldEntry: NO, reply=%d\n", status); + debug(88, 5) ("clientGetsOldEntry: NO, reply=%d\n", status); return 0; } /* If the client did not send IMS in the request, then it * must get the old object, not this "Not Modified" reply */ if (!request->flags.ims) { - debug(33, 5) ("clientGetsOldEntry: YES, no client IMS\n"); + debug(88, 5) ("clientGetsOldEntry: YES, no client IMS\n"); return 1; } /* If the client IMS time is prior to the entry LASTMOD time we * need to send the old object */ if (modifiedSince(old_entry, request)) { - debug(33, 5) ("clientGetsOldEntry: YES, modified since %ld\n", + debug(88, 5) ("clientGetsOldEntry: YES, modified since %ld\n", (long int) request->ims); return 1; } - debug(33, 5) ("clientGetsOldEntry: NO, new one is fine\n"); + debug(88, 5) ("clientGetsOldEntry: NO, new one is fine\n"); return 0; } @@ -192,7 +191,7 @@ int unlink_request = 0; StoreEntry *oldentry; http_status status; - debug(33, 3) ("clientHandleIMSReply: %s, %ld bytes\n", url, (long int) size); + debug(88, 3) ("clientHandleIMSReply: %s, %ld bytes\n", url, (long int) size); if (entry == NULL) { return; } @@ -204,7 +203,7 @@ mem = entry->mem_obj; status = mem->reply->sline.status; if (EBIT_TEST(entry->flags, ENTRY_ABORTED)) { - debug(33, 3) ("clientHandleIMSReply: ABORTED '%s'\n", url); + debug(88, 3) ("clientHandleIMSReply: ABORTED '%s'\n", url); /* We have an existing entry, but failed to validate it */ /* Its okay to send the old one anyway */ http->log_type = LOG_TCP_REFRESH_FAIL_HIT; @@ -216,10 +215,10 @@ 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); + debug(88, 3) ("clientHandleIMSReply: Incomplete headers for '%s'\n", url); if (size + http->reqofs >= HTTP_REQBUF_SZ) { /* will not get any bigger than that */ - debug(33, 3) ("clientHandleIMSReply: Reply is too large '%s', using old entry\n", url); + debug(88, 3) ("clientHandleIMSReply: Reply is too large '%s', using old entry\n", url); /* use old entry, this repeats the code abovez */ http->log_type = LOG_TCP_REFRESH_FAIL_HIT; storeUnregister(http->sc, entry, http); @@ -304,13 +303,13 @@ StoreEntry *e = http->entry; MemObject *mem; request_t *r = http->request; - debug(33, 3) ("clientCacheHit: %s, %d bytes\n", http->uri, (int) size); + debug(88, 3) ("clientCacheHit: %s, %d bytes\n", http->uri, (int) size); if (http->entry == NULL) { - debug(33, 3) ("clientCacheHit: request aborted\n"); + debug(88, 3) ("clientCacheHit: request aborted\n"); return; } else if (size < 0) { /* swap in failure */ - debug(33, 3) ("clientCacheHit: swapin failure for %s\n", http->uri); + debug(88, 3) ("clientCacheHit: swapin failure for %s\n", http->uri); http->log_type = LOG_TCP_SWAPFAIL_MISS; if ((e = http->entry)) { http->entry = NULL; @@ -336,7 +335,7 @@ } else if (size + http->reqofs >= HTTP_REQBUF_SZ && http->out.offset == 0) { clientProcessMiss(http); } else { - debug(33, 3) ("clientCacheHit: waiting for HTTP reply headers\n"); + debug(88, 3) ("clientCacheHit: waiting for HTTP reply headers\n"); http->reqofs += size; assert(http->reqofs <= HTTP_REQBUF_SZ); storeClientCopy(http->sc, e, @@ -358,7 +357,7 @@ break; case VARY_MATCH: /* This is the correct entity for this request. Continue */ - debug(33, 2) ("clientProcessHit: Vary MATCH!\n"); + debug(88, 2) ("clientProcessHit: Vary MATCH!\n"); break; case VARY_OTHER: /* This is not the correct entity for this request. We need @@ -371,12 +370,12 @@ /* Note: varyEvalyateMatch updates the request with vary information * so we only get here once. (it also takes care of cancelling loops) */ - debug(33, 2) ("clientProcessHit: Vary detected!\n"); + debug(88, 2) ("clientProcessHit: Vary detected!\n"); clientProcessRequest(http); return; case VARY_CANCEL: /* varyEvaluateMatch found a object loop. Process as miss */ - debug(33, 1) ("clientProcessHit: Vary object loop!\n"); + debug(88, 1) ("clientProcessHit: Vary object loop!\n"); clientProcessMiss(http); return; } @@ -401,7 +400,7 @@ http->log_type = LOG_TCP_MEM_HIT; clientSendMoreData(data, buf, size); } else if (refreshCheckHTTP(e, r) && !http->flags.internal) { - debug(33, 5) ("clientCacheHit: in refreshCheck() block\n"); + debug(88, 5) ("clientCacheHit: in refreshCheck() block\n"); /* * We hold a stale copy; it needs to be validated */ @@ -448,7 +447,7 @@ */ /* ESI TODO: If ESI can alter datestamp on the parent page, this needs review */ if (mem->reply->sline.status != HTTP_OK) { - debug(33, 4) ("clientCacheHit: Reply code %d != 200\n", + debug(88, 4) ("clientCacheHit: Reply code %d != 200\n", mem->reply->sline.status); http->log_type = LOG_TCP_MISS; clientProcessMiss(http); @@ -495,7 +494,7 @@ char *url = http->uri; request_t *r = http->request; ErrorState *err = NULL; - debug(33, 4) ("clientProcessMiss: '%s %s'\n", + debug(88, 4) ("clientProcessMiss: '%s %s'\n", RequestMethodStr[r->method], url); /* * We might have a left-over StoreEntry from a failed cache hit @@ -503,8 +502,8 @@ */ if (http->entry) { if (EBIT_TEST(http->entry->flags, ENTRY_SPECIAL)) { - debug(33, 0) ("clientProcessMiss: miss on a special object (%s).\n", url); - debug(33, 0) ("\tlog_type = %s\n", log_tags[http->log_type]); + debug(88, 0) ("clientProcessMiss: miss on a special object (%s).\n", url); + debug(88, 0) ("\tlog_type = %s\n", log_tags[http->log_type]); storeEntryDump(http->entry, 1); } storeUnregister(http->sc, http->entry, http); @@ -562,7 +561,7 @@ char *url = http->uri; request_t *r = http->request; ErrorState *err = NULL; - debug(33, 4) ("clientProcessOnlyIfCachedMiss: '%s %s'\n", + debug(88, 4) ("clientProcessOnlyIfCachedMiss: '%s %s'\n", RequestMethodStr[r->method], url); http->al.http.code = HTTP_GATEWAY_TIMEOUT; err = clientBuildError (ERR_ONLY_IF_CACHED_MISS, HTTP_GATEWAY_TIMEOUT, NULL, @@ -584,7 +583,7 @@ HttpReply *r; http_status status = HTTP_NOT_FOUND; http_version_t version; - debug(33, 3) ("Config2.onoff.enable_purge = %d\n", Config2.onoff.enable_purge); + debug(88, 3) ("Config2.onoff.enable_purge = %d\n", Config2.onoff.enable_purge); if (!Config2.onoff.enable_purge) { http->log_type = LOG_TCP_DENIED; err = clientBuildError(ERR_ACCESS_DENIED, HTTP_FORBIDDEN, NULL, &http->conn->peer.sin_addr, @@ -627,14 +626,14 @@ /* Release the cached URI */ entry = storeGetPublicByRequestMethod(http->request, METHOD_GET); if (entry) { - debug(33, 4) ("clientPurgeRequest: GET '%s'\n", + debug(88, 4) ("clientPurgeRequest: GET '%s'\n", storeUrl(entry)); storeRelease(entry); status = HTTP_OK; } entry = storeGetPublicByRequestMethod(http->request, METHOD_HEAD); if (entry) { - debug(33, 4) ("clientPurgeRequest: HEAD '%s'\n", + debug(88, 4) ("clientPurgeRequest: HEAD '%s'\n", storeUrl(entry)); storeRelease(entry); status = HTTP_OK; @@ -643,14 +642,14 @@ if (http->request->vary_headers && !strstr(http->request->vary_headers, "=")) { entry = storeGetPublic(urlCanonical(http->request), METHOD_GET); if (entry) { - debug(33, 4) ("clientPurgeRequest: Vary GET '%s'\n", + debug(88, 4) ("clientPurgeRequest: Vary GET '%s'\n", storeUrl(entry)); storeRelease(entry); status = HTTP_OK; } entry = storeGetPublic(urlCanonical(http->request), METHOD_HEAD); if (entry) { - debug(33, 4) ("clientPurgeRequest: Vary HEAD '%s'\n", + debug(88, 4) ("clientPurgeRequest: Vary HEAD '%s'\n", storeUrl(entry)); storeRelease(entry); status = HTTP_OK; @@ -668,6 +667,77 @@ storeComplete(http->entry); } +#define SENDING_BODY 0 +#define SENDING_HDRSONLY 1 +int +clientCheckTransferDone(clientHttpRequest const * http) +{ + int sending = SENDING_BODY; + StoreEntry *entry = http->entry; + MemObject *mem; + http_reply *reply; + int sendlen; + if (entry == NULL) + return 0; + /* + * For now, 'done_copying' is used for special cases like + * Range and HEAD requests. + */ + if (http->flags.done_copying) + return 1; + /* + * Handle STORE_OK objects. + * objectLen(entry) will be set proprely. + */ + if (entry->store_status == STORE_OK) { + if (http->out.offset >= objectLen(entry)) + return 1; + else + return 0; + } + /* + * Now, handle STORE_PENDING objects + */ + mem = entry->mem_obj; + assert(mem != NULL); + assert(http->request != NULL); + reply = mem->reply; + if (reply->hdr_sz == 0) + return 0; /* haven't found end of headers yet */ + else if (reply->sline.status == HTTP_OK) + sending = SENDING_BODY; + else if (reply->sline.status == HTTP_NO_CONTENT) + sending = SENDING_HDRSONLY; + else if (reply->sline.status == HTTP_NOT_MODIFIED) + sending = SENDING_HDRSONLY; + else if (reply->sline.status < HTTP_OK) + sending = SENDING_HDRSONLY; + else if (http->request->method == METHOD_HEAD) + sending = SENDING_HDRSONLY; + else + sending = SENDING_BODY; + /* + * Figure out how much data we are supposed to send. + * If we are sending a body and we don't have a content-length, + * then we must wait for the object to become STORE_OK. + */ + if (sending == SENDING_HDRSONLY) + sendlen = reply->hdr_sz; + else if (reply->content_length < 0) + return 0; + else + sendlen = reply->content_length + reply->hdr_sz; + /* + * Now that we have the expected length, did we send it all? + */ + if (http->out.offset < sendlen) + return 0; + else + return 1; +} + + + int clientGotNotEnough(clientHttpRequest const * http) { @@ -698,19 +768,19 @@ int done; #if SIZEOF_SIZE_T == 4 if (http->out.size > 0x7FFF0000) { - debug(33, 1) ("WARNING: closing FD %d to prevent counter overflow\n", fd); - debug(33, 1) ("\tclient %s\n", inet_ntoa(http->conn ? http->conn->peer.sin_addr : no_addr)); - debug(33, 1) ("\treceived %d bytes\n", (int) http->out.size); - debug(33, 1) ("\tURI %s\n", http->log_uri); + debug(88, 1) ("WARNING: closing FD %d to prevent counter overflow\n", fd); + debug(88, 1) ("\tclient %s\n", inet_ntoa(http->conn ? http->conn->peer.sin_addr : no_addr)); + debug(88, 1) ("\treceived %d bytes\n", (int) http->out.size); + debug(88, 1) ("\tURI %s\n", http->log_uri); return 2; } #endif #if SIZEOF_OFF_T == 4 if (http->out.offset > 0x7FFF0000) { - debug(33, 1) ("WARNING: closing FD %d to prevent counter overflow\n", fd); - debug(33, 1) ("\tclient %s\n", inet_ntoa(http->conn ? http->conn->peer.sin_addr : no_addr)); - debug(33, 1) ("\treceived %d bytes (offset %d)\n", (int) http->out.size, (int) http->out.offset); - debug(33, 1) ("\tURI %s\n", http->log_uri); + debug(88, 1) ("WARNING: closing FD %d to prevent counter overflow\n", fd); + debug(88, 1) ("\tclient %s\n", inet_ntoa(http->conn ? http->conn->peer.sin_addr : no_addr)); + debug(88, 1) ("\treceived %d bytes (offset %d)\n", (int) http->out.size, (int) http->out.offset); + debug(88, 1) ("\tURI %s\n", http->log_uri); return 2; } #endif @@ -723,16 +793,16 @@ */ return 2; if ((done = clientCheckTransferDone(http)) != 0 || size == 0) { - debug(33, 5) ("clientWriteComplete: FD %d transfer is DONE\n", fd); + debug(88, 5) ("clientWriteComplete: FD %d transfer is DONE\n", fd); /* Ok we're finished, but how? */ if (httpReplyBodySize(http->request->method, entry->mem_obj->reply) < 0) { - debug(33, 5) ("clientWriteComplete: closing, content_length < 0\n"); + debug(88, 5) ("clientWriteComplete: closing, content_length < 0\n"); return 2; } else if (!done) { - debug(33, 5) ("clientWriteComplete: closing, !done, but read 0 bytes\n"); + debug(88, 5) ("clientWriteComplete: closing, !done, but read 0 bytes\n"); return 2; } else if (clientGotNotEnough(http)) { - debug(33, 5) ("clientWriteComplete: client didn't get all it expected\n"); + debug(88, 5) ("clientWriteComplete: client didn't get all it expected\n"); return 2; } else if (http->request->flags.proxy_keepalive) { return 0; /* allow keepalive */ @@ -859,7 +929,7 @@ getMyHostname(), getMyPort()); #endif if (httpReplyBodySize(request->method, rep) < 0) { - debug(33, 3) ("clientBuildReplyHeader: can't keep-alive, unknown body size\n"); request->flags.proxy_keepalive = 0; + debug(88, 3) ("clientBuildReplyHeader: can't keep-alive, unknown body size\n"); request->flags.proxy_keepalive = 0; } /* Signal keep-alive if needed */ httpHeaderPutStr(hdr, @@ -915,21 +985,21 @@ ssize_t size = http->reqofs + retsize; ssize_t body_size = size; - debug(33, 5) ("clientSendMoreData: %s, %d bytes (%d new bytes)\n", http->uri, (int) size, retsize); + debug(88, 5) ("clientSendMoreData: %s, %d bytes (%d new bytes)\n", http->uri, (int) size, retsize); assert(size <= HTTP_REQBUF_SZ); assert(http->request != NULL); /* ESI TODO: remove this assert once everything is stable */ assert(http->stream_head && cbdataReferenceValid(http->stream_head)); dlinkDelete(&http->active, &ClientActiveRequests); dlinkAdd(http, &http->active, &ClientActiveRequests); - debug(33, 5) ("clientSendMoreData: FD %d '%s', out.offset=%ld \n", + debug(88, 5) ("clientSendMoreData: FD %d '%s', out.offset=%ld \n", fd, storeUrl(entry), (long int) http->out.offset); /* update size of the request */ http->reqsize = size; /* ESI sub-requests go through regardless */ if (conn && conn->chr != http && !http->flags.esi) { /* there is another object in progress, defer this one */ - debug(33, 2) ("clientSendMoreData: Deferring %s\n", storeUrl(entry)); + debug(88, 2) ("clientSendMoreData: Deferring %s\n", storeUrl(entry)); return; } else if (http->request->flags.reset_tcp) { if (fd != -1) @@ -983,14 +1053,14 @@ body_size = size - rep->hdr_sz; assert(body_size >= 0); body_buf = buf + rep->hdr_sz; - debug(33, 3) ("clientSendMoreData: Appending %d bytes after %d bytes of headers\n", + debug(88, 3) ("clientSendMoreData: Appending %d bytes after %d bytes of headers\n", (int) body_size, rep->hdr_sz); ch = aclChecklistCreate(Config.accessList.reply, http->request, NULL); ch->reply = rep; rv = aclCheckFast(Config.accessList.reply, ch); aclChecklistFree(ch); ch = NULL; - debug(33, 2) ("The reply for %s %s is %s, because it matched '%s'\n", + debug(88, 2) ("The reply for %s %s is %s, because it matched '%s'\n", RequestMethodStr[http->request->method], http->uri, rv ? "ALLOWED" : "DENIED", AclMatchedName ? AclMatchedName : "NO ACL's"); @@ -1013,7 +1083,7 @@ } /* ESI TODO: replace me with a true ESI header check */ if (http->flags.accel && strstr (http->uri, "esi")) { - debug (33, 0) ("Enabling ESI processing for %s\n", http->uri); + debug(88, 0) ("Enabling ESI processing for %s\n", http->uri); clientStreamInsertHead (&http->stream_head, esiProcessStream, NULL); } } else if (size < HTTP_REQBUF_SZ && entry->store_status == STORE_PENDING) { Index: squid/src/client_side_request.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/Attic/client_side_request.c,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -u -r1.1.2.1 -r1.1.2.2 --- squid/src/client_side_request.c 9 Aug 2002 11:49:45 -0000 1.1.2.1 +++ squid/src/client_side_request.c 9 Aug 2002 12:18:53 -0000 1.1.2.2 @@ -1,9 +1,9 @@ /* - * $Id: client_side_request.c,v 1.1.2.1 2002/08/09 11:49:45 rbcollins Exp $ + * $Id: client_side_request.c,v 1.1.2.2 2002/08/09 12:18:53 rbcollins Exp $ * * DEBUG: section 85 Client-side Request Routines - * AUTHOR: Robert Collins + * AUTHOR: Robert Collins (Originall Duane Wessels in client_side.c) * * SQUID Web Proxy Cache http://www.squid-cache.org/ * ---------------------------------------------------------- @@ -44,7 +44,6 @@ /* Local functions */ static int checkAccelOnly(clientHttpRequest *); /*static*/ aclCheck_t * clientAclChecklistCreate(const acl_access * acl, const clientHttpRequest * http); -int clientCheckTransferDone(clientHttpRequest const *); static int clientCachable(clientHttpRequest * http); static int clientHierarchical(clientHttpRequest * http); static void clientInterpretRequestHeaders(clientHttpRequest * http); @@ -86,7 +85,7 @@ strcpy(http->uri, url); if ((request = urlParse(method, http->uri)) == NULL) { - debug(33, 5) ("Invalid URL: %s\n", http->uri); + debug(85, 5) ("Invalid URL: %s\n", http->uri); return -1; } http->log_uri = xstrdup(urlCanonicalClean(request)); @@ -162,7 +161,7 @@ clientHttpRequest *http = data; if (checkAccelOnly(http)) { /* deny proxy requests in accel_only mode */ - debug(33, 1) ("clientAccessCheck: proxy request denied in accel_only mode\n"); + debug(85, 1) ("clientAccessCheck: proxy request denied in accel_only mode\n"); clientAccessCheckDone(ACCESS_DENIED, http); return; } @@ -178,7 +177,7 @@ http_status status; ErrorState *err = NULL; char *proxy_auth_msg = NULL; - debug(33, 2) ("The request %s %s is %s, because it matched '%s'\n", + debug(85, 2) ("The request %s %s is %s, because it matched '%s'\n", RequestMethodStr[http->request->method], http->uri, answer == ACCESS_ALLOWED ? "ALLOWED" : "DENIED", AclMatchedName ? AclMatchedName : "NO ACL's"); @@ -191,10 +190,10 @@ http->redirect_state = REDIRECT_PENDING; redirectStart(http, clientRedirectDone, http); } else { - debug(33, 5) ("Access Denied: %s\n", http->uri); - debug(33, 5) ("AclMatchedName = %s\n", + debug(85, 5) ("Access Denied: %s\n", http->uri); + debug(85, 5) ("AclMatchedName = %s\n", AclMatchedName ? AclMatchedName : ""); - debug(33, 5) ("Proxy Auth Message = %s\n", + debug(85, 5) ("Proxy Auth Message = %s\n", proxy_auth_msg ? proxy_auth_msg : ""); /* * NOTE: get page_id here, based on AclMatchedName because @@ -405,11 +404,11 @@ request->flags.cachable = 1; if (clientHierarchical(http)) request->flags.hierarchical = 1; - debug(33, 5) ("clientInterpretRequestHeaders: REQ_NOCACHE = %s\n", + debug(85, 5) ("clientInterpretRequestHeaders: REQ_NOCACHE = %s\n", request->flags.nocache ? "SET" : "NOT SET"); - debug(33, 5) ("clientInterpretRequestHeaders: REQ_CACHABLE = %s\n", + debug(85, 5) ("clientInterpretRequestHeaders: REQ_CACHABLE = %s\n", request->flags.cachable ? "SET" : "NOT SET"); - debug(33, 5) ("clientInterpretRequestHeaders: REQ_HIERARCHICAL = %s\n", + debug(85, 5) ("clientInterpretRequestHeaders: REQ_HIERARCHICAL = %s\n", request->flags.hierarchical ? "SET" : "NOT SET"); } @@ -419,7 +418,7 @@ clientHttpRequest *http = data; request_t *new_request = NULL; request_t *old_request = http->request; - debug(33, 5) ("clientRedirectDone: '%s' result=%s\n", http->uri, + debug(85, 5) ("clientRedirectDone: '%s' result=%s\n", http->uri, result ? result : "NULL"); assert(http->redirect_state == REDIRECT_PENDING); http->redirect_state = REDIRECT_DONE; @@ -431,7 +430,7 @@ http->redirect.status = status; http->redirect.location = xstrdup(t + 1); } else { - debug(33, 1) ("clientRedirectDone: bad input: %s\n", result); + debug(85, 1) ("clientRedirectDone: bad input: %s\n", result); } } if (strcmp(result, http->uri)) @@ -510,11 +509,11 @@ #endif if (NULL == e) { /* this object isn't in the cache */ - debug(33, 3) ("clientProcessRequest2: storeGet() MISS\n"); + debug(85, 3) ("clientProcessRequest2: storeGet() MISS\n"); return LOG_TCP_MISS; } if (Config.onoff.offline) { - debug(33, 3) ("clientProcessRequest2: offline HIT\n"); + debug(85, 3) ("clientProcessRequest2: offline HIT\n"); http->entry = e; return LOG_TCP_HIT; } @@ -524,20 +523,20 @@ return LOG_TCP_MISS; } if (!storeEntryValidToSend(e)) { - debug(33, 3) ("clientProcessRequest2: !storeEntryValidToSend MISS\n"); + debug(85, 3) ("clientProcessRequest2: !storeEntryValidToSend MISS\n"); http->entry = NULL; return LOG_TCP_MISS; } if (EBIT_TEST(e->flags, ENTRY_SPECIAL)) { /* Special entries are always hits, no matter what the client says */ - debug(33, 3) ("clientProcessRequest2: ENTRY_SPECIAL HIT\n"); + debug(85, 3) ("clientProcessRequest2: ENTRY_SPECIAL HIT\n"); http->entry = e; return LOG_TCP_HIT; } #if HTTP_VIOLATIONS if (e->store_status == STORE_PENDING) { if (r->flags.nocache || r->flags.nocache_hack) { - debug(33, 3) ("Clearing no-cache for STORE_PENDING request\n\t%s\n", + debug(85, 3) ("Clearing no-cache for STORE_PENDING request\n\t%s\n", storeUrl(e)); r->flags.nocache = 0; r->flags.nocache_hack = 0; @@ -545,7 +544,7 @@ } #endif if (r->flags.nocache) { - debug(33, 3) ("clientProcessRequest2: no-cache REFRESH MISS\n"); + debug(85, 3) ("clientProcessRequest2: no-cache REFRESH MISS\n"); http->entry = NULL; return LOG_TCP_CLIENT_REFRESH_MISS; } @@ -554,7 +553,7 @@ http->entry = NULL; return LOG_TCP_MISS; } - debug(33, 3) ("clientProcessRequest2: default HIT\n"); + debug(85, 3) ("clientProcessRequest2: default HIT\n"); http->entry = e; return LOG_TCP_HIT; } @@ -566,7 +565,7 @@ request_t *r = http->request; HttpReply *rep; http_version_t version; - debug(33, 4) ("clientProcessRequest: %s '%s'\n", + debug(85, 4) ("clientProcessRequest: %s '%s'\n", RequestMethodStr[r->method], url); if (r->method == METHOD_CONNECT) { @@ -596,7 +595,7 @@ } else { http->log_type = clientProcessRequest2(http); } - debug(33, 4) ("clientProcessRequest: %s for '%s'\n", + debug(85, 4) ("clientProcessRequest: %s for '%s'\n", log_tags[http->log_type], http->uri); /* Here is where we start requesting data - from the cache or from the network Index: squid/src/protos.h =================================================================== RCS file: /cvsroot/squid-sf//squid/src/protos.h,v retrieving revision 1.59.2.1 retrieving revision 1.59.2.2 diff -u -r1.59.2.1 -r1.59.2.2 --- squid/src/protos.h 9 Aug 2002 11:49:45 -0000 1.59.2.1 +++ squid/src/protos.h 9 Aug 2002 12:18:53 -0000 1.59.2.2 @@ -1,6 +1,6 @@ /* - * $Id: protos.h,v 1.59.2.1 2002/08/09 11:49:45 rbcollins Exp $ + * $Id: protos.h,v 1.59.2.2 2002/08/09 12:18:53 rbcollins Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -151,6 +151,9 @@ extern ErrorState *clientBuildError (err_type, http_status, char const *, struct in_addr *, request_t *); extern int clientBeginRequest (method_t, char const *, CSR *, void *); +/* client_side_reply.c - client side reply related routines (pure logic, no comms) */ +extern int clientCheckTransferDone(clientHttpRequest const *); + /* clientStream.c */ extern void clientStreamInsertHead (clientStreamNode **, CSR *, void *); extern clientStreamNode *clientStreamNew (CSR *, void *);