--------------------- PatchSet 5574 Date: 2003/01/01 20:14:07 Author: ymc Branch: dtd Tag: (none) Log: disabled DTD for ims, nocache and refresh now it is working perfectly! YaY! :) Members: src/client_side.c:1.5.2.9.2.11.2.6->1.5.2.9.2.11.2.7 Index: squid/src/client_side.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/client_side.c,v retrieving revision 1.5.2.9.2.11.2.6 retrieving revision 1.5.2.9.2.11.2.7 diff -u -r1.5.2.9.2.11.2.6 -r1.5.2.9.2.11.2.7 --- squid/src/client_side.c 31 Dec 2002 17:45:27 -0000 1.5.2.9.2.11.2.6 +++ squid/src/client_side.c 1 Jan 2003 20:14:07 -0000 1.5.2.9.2.11.2.7 @@ -1,6 +1,6 @@ /* - * $Id: client_side.c,v 1.5.2.9.2.11.2.6 2002/12/31 17:45:27 ymc Exp $ + * $Id: client_side.c,v 1.5.2.9.2.11.2.7 2003/01/01 20:14:07 ymc Exp $ * * DEBUG: section 33 Client-side Routines * AUTHOR: Duane Wessels @@ -95,6 +95,7 @@ static void clientCheckNoCacheDone(int answer, void *data); static STCB clientHandleIMSReply; #ifdef DTD +static void clientProcessDTD(clientHttpRequest * http); static int clientDTDCachableReply(clientHttpRequest * httpState); static STCB clientHandleHEADReply; static void clientCacheDTDHit(void *data, char *buf, ssize_t size); @@ -320,6 +321,76 @@ } } +/* + * Prepare to fetch the object as it's a cache miss of some kind. + */ +static void +clientProcessDTD(clientHttpRequest * http) +{ + char *url = http->uri; + request_t *r = http->request; + ErrorState *err = NULL; + debug(33, 4) ("clientProcessMiss: '%s %s'\n", + RequestMethodStr[r->method], url); + /* + * We might have a left-over StoreEntry from a failed cache hit + * or IMS request. + */ + 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]); + storeEntryDump(http->entry->p, 1); + } + storeUnregister(http->sc, http->entry->p, http); + http->sc = NULL; + storeUnlockObject(http->entry->p); + http->entry = NULL; + } + if (clientOnlyIfCached(http)) { + clientProcessOnlyIfCachedMiss(http); + return; + } + /* + * Deny loops when running in accelerator/transproxy mode. + */ + if (http->flags.accel && r->flags.loopdetect) { + http->al.http.code = HTTP_FORBIDDEN; + err = errorCon(ERR_ACCESS_DENIED, HTTP_FORBIDDEN); + err->request = requestLink(r); + err->src_addr = http->conn->peer.sin_addr; + http->entry = clientCreateStoreEntry(http, r->method, null_request_flags); + errorAppendEntry(http->entry, err); + return; + } + assert(http->out.offset == 0); + http->entry = clientDTDCreateStoreEntry(http, r->method, r->flags); + if (http->redirect.status) { + HttpReply *rep = httpReplyCreate(); +#if LOG_TCP_REDIRECTS + http->log_type = LOG_TCP_REDIRECT; +#endif + storeReleaseRequest(http->entry->p); + httpRedirectReply(rep, http->redirect.status, http->redirect.location); + httpReplySwapOut(rep, http->entry->p); + httpReplyDestroy(rep); + storeComplete(http->entry->p); + return; + } + if (http->flags.internal) + r->protocol = PROTO_INTERNAL; + fwdStart(http->conn->fd, http->entry, r); + if (EBIT_TEST(http->entry->p->flags, ENTRY_ABORTED)) + debug(33, 0) ("clientProcessMiss: found ENTRY_ABORTED object\n"); + storeClientCopy(http->sc, http->entry->p, + http->out.offset, + http->out.offset, + CLIENT_SOCK_SZ, + memAllocate(MEM_CLIENT_SOCK_BUF), + clientHandleHEADReply, + http); +} + static int clientDTDCachableReply(clientHttpRequest * httpState) { @@ -574,9 +645,6 @@ #if DELAY_POOLS delaySetStoreClient(h->sc, delayClient(h->request)); #endif - if (h->request->method != METHOD_GET) - storeClientCopy(h->sc, e->p, 0, 0, CLIENT_SOCK_SZ, - memAllocate(MEM_CLIENT_SOCK_BUF), clientSendMoreData, h); return e; } #endif @@ -596,9 +664,6 @@ #if DELAY_POOLS delaySetStoreClient(h->sc, delayClient(h->request)); #endif -#ifdef DTD - if (h->request->method != METHOD_GET) -#endif storeClientCopy(h->sc, e->p, 0, 0, CLIENT_SOCK_SZ, memAllocate(MEM_CLIENT_SOCK_BUF), clientSendMoreData, h); return e; @@ -2940,6 +3005,14 @@ http); } else { /* MISS CASE, http->log_type is already set! */ +#ifdef DTD + if (http->request->method == METHOD_GET && !http->request->flags.ims && !http->request->flags.refresh && !http->request->flags.nocache) { + http->request->flags.was_get = 1; + http->request->method = METHOD_HEAD; + clientProcessDTD(http); + } + else +#endif clientProcessMiss(http); } } @@ -2995,11 +3068,7 @@ return; } assert(http->out.offset == 0); -#ifdef DTD - http->entry = clientDTDCreateStoreEntry(http, r->method, r->flags); -#else http->entry = clientCreateStoreEntry(http, r->method, r->flags); -#endif if (http->redirect.status) { HttpReply *rep = httpReplyCreate(); #if LOG_TCP_REDIRECTS @@ -3022,25 +3091,6 @@ } if (http->flags.internal) r->protocol = PROTO_INTERNAL; -#ifdef DTD - if (http->request->method == METHOD_GET) { - http->request->flags.was_get = 1; - http->request->method = METHOD_HEAD; - - fwdStart(http->conn->fd, http->entry, r); - if (EBIT_TEST(http->entry->p->flags, ENTRY_ABORTED)) - debug(33, 0) ("clientProcessMiss: found ENTRY_ABORTED object\n"); - storeClientCopy(http->sc, http->entry->p, - http->out.offset, - http->out.offset, - CLIENT_SOCK_SZ, - memAllocate(MEM_CLIENT_SOCK_BUF), - clientHandleHEADReply, - http); - - } - else -#endif fwdStart(http->conn->fd, http->entry, r); }