--------------------- PatchSet 1039 Date: 2004/07/04 16:56:50 Author: ahouhpuc Branch: varyetag Tag: (none) Log: changing vary base object swap out Members: src/CharHashTable.cc:1.1.2.1->1.1.2.2 src/client_side_reply.cc:1.48.2.3->1.48.2.4 src/http.cc:1.33.2.2->1.33.2.3 Index: squid3/src/CharHashTable.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/Attic/CharHashTable.cc,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -u -r1.1.2.1 -r1.1.2.2 --- squid3/src/CharHashTable.cc 3 Jun 2004 22:52:27 -0000 1.1.2.1 +++ squid3/src/CharHashTable.cc 4 Jul 2004 16:56:50 -0000 1.1.2.2 @@ -1,5 +1,5 @@ /* - * $Id: CharHashTable.cc,v 1.1.2.1 2004/06/03 22:52:27 ahouhpuc Exp $ + * $Id: CharHashTable.cc,v 1.1.2.2 2004/07/04 16:56:50 ahouhpuc Exp $ * * SQUID Web Proxy Cache http://www.squid-cache.org/ * ---------------------------------------------------------- @@ -166,10 +166,11 @@ while ((hte = (CharHashTableElement*)hash_next(map))) { size += (strlen((char*)hte->key)+1); // 1 for , - debug(93, 9) ("\t^^^ key=[%s]\n", (char*)hte->key); + debug(93, 9) ("CharHashTable::keys: key=[%s]\n", + (char*)hte->key); } if (!size) { - debug(93, 9) ("\t^^^ CharHashTable::keys: result is empty!\n"); + debug(93, 9) ("CharHashTable::keys: result is empty!\n"); return NULL; } char* result = (char*)xmalloc(size); @@ -180,10 +181,10 @@ xmemcpy(result+pos,(char*)hte->key, strlen((char*)hte->key)); pos += (strlen((char*)hte->key)); // 1 for , result[pos++]= ','; - debug(93, 9) ("\t^^^ key=[%s]\n", (char*)hte->key); + debug(93, 9) ("CharHashTable::keys: key=[%s]\n", (char*)hte->key); } result[size-1] = 0; - debug(93, 9) ("\t^^^ CharHashTable::keys: result=[%s]\n", result); + debug(93, 9) ("CharHashTable::keys: result=[%s]\n", result); return result; } @@ -201,9 +202,7 @@ hte->key = xstrdup(key); hte->element = xstrdup(element); - debug(93, 9) ("CharHashTable::put map size=%d\n", map->count); hash_join(map, hte); - debug(93, 9) ("CharHashTable::put map size=%d\n", map->count); } /* @@ -302,6 +301,7 @@ hash_first(map); while ((hte = (CharHashTableElement*)hash_next(map))) { - debug(93, 9) ("\t^^^ key=[%s] element=[%s]\n", (char*)hte->key, (char*)hte->element); + debug(93, 9) ("CharHashTable::dump: key=[%s] element=[%s]\n", + (char*)hte->key, (char*)hte->element); } } Index: squid3/src/client_side_reply.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/client_side_reply.cc,v retrieving revision 1.48.2.3 retrieving revision 1.48.2.4 diff -u -r1.48.2.3 -r1.48.2.4 --- squid3/src/client_side_reply.cc 7 Jun 2004 00:35:41 -0000 1.48.2.3 +++ squid3/src/client_side_reply.cc 4 Jul 2004 16:56:59 -0000 1.48.2.4 @@ -1,6 +1,6 @@ /* - * $Id: client_side_reply.cc,v 1.48.2.3 2004/06/07 00:35:41 mmatusiak Exp $ + * $Id: client_side_reply.cc,v 1.48.2.4 2004/07/04 16:56:59 ahouhpuc Exp $ * * DEBUG: section 88 Client-side Reply Routines * AUTHOR: Robert Collins (Originally Duane Wessels in client_side.c) @@ -2359,11 +2359,6 @@ tempBuffer.data = body_buf; } - debug(93, 9) ("\t ------- processReplyAccessResult: t->length: %d, t->offset: %ld, t->data:\n%s\n-\n", - tempBuffer.length, tempBuffer.offset, tempBuffer.data); - debug(93, 9) ("\t ------- processReplyAccessResult: n->length: %d, n->offset: %ld, n->data:\n%s\n-\n", - next()->readBuffer.length, next()->readBuffer.offset, next()->readBuffer.data); - /* TODO??: move the data in the buffer back by the request header size */ clientStreamCallback((clientStreamNode *)http->client_stream.head->data, http, rep, tempBuffer); @@ -2467,8 +2462,6 @@ //saved304->hdr_sz = result.length; - debug(93, 9) ("\t --- handleConditionalMiss: length: %d, offset: %ld, data:\n%s\n-\n", - result.length, result.offset, result.data); sendMoreData(result); } @@ -2505,8 +2498,7 @@ // tells if the code below changes the mappings int changed = 1; - if (!vhm->get - ((char*)vary_headers)) { + if (!vhm->get((char*)vary_headers)) { if (etag.str) { // there is ETag @@ -2561,6 +2553,84 @@ } // XXX if (changed) swap out + debug(93, 9) ("updateFakeEntry: changed: %d\n", changed); + vhm->dump(); + em->dump(); + + // MM 2004.06.29 + if (changed) { + + String vary = httpHeaderGetList(&vary_entry->mem_obj->getReply()->header, + HDR_VARY); + + // kill old base + storeRelease(vary_entry); + debug(93, 9) ("\t --> updateFakeEntry: vary_entry: %p, mem: %p\n", + vary_entry, vary_entry->mem_obj); + + debug(93, 9) ("updateFakeEntry: url: %s, log_url: %s, method: %d\n", + entry->mem_obj->url, entry->mem_obj->log_url, + http->request->method); + + debug(93, 9) ("updateFakeEntry: url: %s, log_url: %s, method: %d\n", + vary_entry->mem_obj->url, vary_entry->mem_obj->log_url, + http->request->method); + + // new base + vary_entry = storeCreateEntry(vary_entry->mem_obj->url, + vary_entry->mem_obj->log_url, + http->request->flags, + http->request->method); + debug(93, 9) ("updateFakeEntry: vary_entry: %p\n", vary_entry); + HttpVersion version(1, 0); + httpReplySetHeaders((HttpReply *)vary_entry->getReply(), version, HTTP_OK, "Internal marker object", + "x-squid-internal/vary", -1, -1, squid_curtime + 100000); + + debug(93, 9) ("updateFakeEntry: Internal marker object set\n"); + debug(93, 9) ("updateFakeEntry: vary: %s\n", vary.buf()); + if (vary.size()) { + httpHeaderPutStr((HttpHeader *)&vary_entry->getReply()->header, HDR_VARY, vary.buf()); + vary.clean(); + } + + // mappings + vary_entry->mem_obj->etag_mapping = em; + vary_entry->mem_obj->vary_headers_mapping = vhm; + + debug(93, 9) ("updateFakeEntry: etag_mapping and vary_headers_mapping set\n"); + +#if X_ACCELERATOR_VARY + vary = httpHeaderGetList(&mem->getReply()->header, HDR_X_ACCELERATOR_VARY); + + if (vary.buf()) { + /* Again, we own this structure layout */ + httpHeaderPutStr((HttpHeader *)&vary_entry->getReply()->header, HDR_X_ACCELERATOR_VARY, + vary.buf()); + vary.clean(); + } + +#endif + storeSetPublicKey(vary_entry); + debug(93, 9) ("updateFakeEntry: storeSetPublicKey\n"); + + storeBuffer(vary_entry); + + debug(93, 9) ("updateFakeEntry: storeBuffer\n"); + + /* TODO: remove this when the metadata is separated */ + { + Packer p; + packerToStoreInit(&p, vary_entry); + httpReplyPackHeadersInto(vary_entry->getReply(), &p); + packerClean(&p); + } + + storeBufferFlush(vary_entry); + storeTimestampsSet(vary_entry); + vary_entry->complete(); + storeUnlockObject(vary_entry); + + } // set in sendMoreData to avoid reentering if (flags.varycomplete == 1) @@ -2723,9 +2793,6 @@ buildReply(buf, reqofs); ssize_t body_size = reqofs; - debug(93, 9) ("\t --- sendMoreData: body_size: %d, buf: \n%s\n-\n", - (int)body_size, buf); - if (holdingReply) { holdingBuffer = result; processReplyAccess (); Index: squid3/src/http.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/http.cc,v retrieving revision 1.33.2.2 retrieving revision 1.33.2.3 diff -u -r1.33.2.2 -r1.33.2.3 --- squid3/src/http.cc 6 Jun 2004 01:18:52 -0000 1.33.2.2 +++ squid3/src/http.cc 4 Jul 2004 16:56:59 -0000 1.33.2.3 @@ -1,6 +1,6 @@ /* - * $Id: http.cc,v 1.33.2.2 2004/06/06 01:18:52 mmatusiak Exp $ + * $Id: http.cc,v 1.33.2.3 2004/07/04 16:56:59 ahouhpuc Exp $ * * DEBUG: section 11 Hypertext Transfer Protocol (HTTP) * AUTHOR: Harvest Derived @@ -989,9 +989,6 @@ HttpStateData::processReplyData(const char *buf, size_t len) { - debug(93, 9) ("\t --- processReplyData: reply_hdr_state: %d, len: %d, buf: \n%s\n-\n", - reply_hdr_state, len, buf); - if (reply_hdr_state < 2) { do_next_read = 1; maybeReadData();