--------------------- PatchSet 1272 Date: 2005/03/26 23:43:53 Author: nlewycky Branch: prefetching Tag: (none) Log: Update debug statements. Fix PrefetchStream to actually pull the whole file. Members: src/HTMLAnalysisStream.cc:1.1.2.3->1.1.2.4 src/PrefetchStream.cc:1.1.2.5->1.1.2.6 Index: squid3/src/HTMLAnalysisStream.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/Attic/HTMLAnalysisStream.cc,v retrieving revision 1.1.2.3 retrieving revision 1.1.2.4 diff -u -r1.1.2.3 -r1.1.2.4 --- squid3/src/HTMLAnalysisStream.cc 25 Feb 2005 05:43:31 -0000 1.1.2.3 +++ squid3/src/HTMLAnalysisStream.cc 26 Mar 2005 23:43:53 -0000 1.1.2.4 @@ -1,6 +1,6 @@ /* - * $Id: HTMLAnalysisStream.cc,v 1.1.2.3 2005/02/25 05:43:31 nlewycky Exp $ + * $Id: HTMLAnalysisStream.cc,v 1.1.2.4 2005/03/26 23:43:53 nlewycky Exp $ * * DEBUG: section 93 HTML parsing and fetching * AUTHOR: Nick Lewycky @@ -59,18 +59,18 @@ HttpReply *reply, StoreIOBuffer buffer) { assert(node->data.getRaw()); - debugs(93, 1, "(AS) bufferData"); + debugs(93, 4, "(AS) bufferData"); HTMLAnalysisStream::Pointer self = dynamic_cast(node->data.getRaw()); if (!self.getRaw()) { /* detach time. but if it's not my node->data, whose is it? */ - debugs(93, 1, "(AS) this makes no sense at all!"); + debugs(93, 4, "(AS) this makes no sense at all!"); return; } - debugs(93, 1, "(AS) length: " << buffer.length << + debugs(93, 4, "(AS) length: " << buffer.length << ", offset: " << buffer.offset); self->parse(buffer.data, buffer.length, 1); node->readBuffer.offset += buffer.length; @@ -87,22 +87,22 @@ if (!req) return; - debugs(93, 1, "(AS) before read"); + debugs(93, 4, "(AS) before read"); clientStreamRead(node, req, node->readBuffer); - debugs(93, 1, "(AS) after read"); + debugs(93, 4, "(AS) after read"); } void htmlStreamDetach(clientStreamNode *node, ClientHttpRequest *req) { - debugs(93, 1, "(AS) detach"); + debugs(93, 4, "(AS) detach"); clientStreamDetach(node, req); } clientStream_status_t htmlStreamStatus(clientStreamNode *node, ClientHttpRequest *req) { - debugs(93, 1, "(AS) status"); + debugs(93, 4, "(AS) status"); return clientStreamStatus(node, req); } @@ -119,7 +119,7 @@ relative_url = urlCanonicalClean(request); - debugs(93, 1, "analyzing " << relative_url); + debugs(93, 4, "analyzing " << relative_url); } HTMLAnalysisStream::~HTMLAnalysisStream() @@ -135,8 +135,8 @@ void HTMLAnalysisStream::parse(const char *document, size_t len, bool partial) { - debugs(93, 1, "(AS) chunk to parse, " << len << " long " << (partial?"partial":"")); - debugs(93, 1, "(AS) chunk is: " << string(document, len)); + debugs(93, 4, "(AS) chunk to parse, " << len << " long " << (partial?"partial":"")); + debugs(93, 4, "(AS) chunk is: " << string(document, len)); htmlParseChunk(parser, document, len, partial ? 0 : 1); } Index: squid3/src/PrefetchStream.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/Attic/PrefetchStream.cc,v retrieving revision 1.1.2.5 retrieving revision 1.1.2.6 diff -u -r1.1.2.5 -r1.1.2.6 --- squid3/src/PrefetchStream.cc 25 Feb 2005 05:43:31 -0000 1.1.2.5 +++ squid3/src/PrefetchStream.cc 26 Mar 2005 23:43:53 -0000 1.1.2.6 @@ -1,6 +1,6 @@ /* - * $Id: PrefetchStream.cc,v 1.1.2.5 2005/02/25 05:43:31 nlewycky Exp $ + * $Id: PrefetchStream.cc,v 1.1.2.6 2005/03/26 23:43:53 nlewycky Exp $ * * DEBUG: section 93 HTML parsing and fetching * AUTHOR: Nick Lewycky @@ -55,7 +55,7 @@ char *url = urlResolveRelative(href.c_str(), relative_url.c_str()); if (!url) { - debugs(93, 1, "Unable to resolve " << href << + debugs(93, 4, "(PS) Unable to resolve " << href << " against relative " << relative_url); return; } @@ -73,7 +73,7 @@ xfree(n); xfree(p); xfree(url); - debugs(93, 1, "Refusing to fetch " << href << + debugs(93, 4, "(PS) Refusing to fetch " << href << " against relative " << relative_url); return; } @@ -88,7 +88,7 @@ // into the cache. Prefetching will tend to aggravate that problem. // TODO: remove this on landing of the collapsed_forwarding branch. if (pending.find(url) != pending.end()) { - debugs(93, 1, "Request of " << url << " coalesced."); + debugs(93, 4, "(PS) Request of " << url << " coalesced."); return; } pending.insert(url); @@ -96,11 +96,11 @@ // Refuse re-download negatively cached entries ... by refusing to // fetch any entry found in the cache. if (storeGetPublic(url, METHOD_GET)) { - debugs(93, 1, "No need to prefetch " << url); + debugs(93, 4, "(PS) No need to prefetch " << url); return; } - debugs(93, 1, "prefetching " << url); + debugs(93, 4, "(PS) prefetching " << url); HttpHeader tempheaders(hoRequest); tempheaders.update(&request->header, NULL); @@ -124,7 +124,7 @@ PrefetchStream::Detach, stream.getRaw(), &tempheaders, stream->discard_buffer, /*256*/HTTP_REQBUF_SZ, (ClientHttpRequest::flags_type){0,0,0,0,0}, no_addr)) { - debugs(93, 1, "Failed to prefetch " << url); + debugs(93, 4, "(PS) Failed to prefetch " << url); return; } httpHeaderClean(&tempheaders); @@ -152,8 +152,8 @@ PrefetchStream::bufferData(clientStreamNode *node, ClientHttpRequest *req, HttpReply *reply, StoreIOBuffer buffer) { - debugs(93, 1, "(PS) bufferData"); - //debugs(93, 1, "reply " << reply << " body " << string(buffer.data, buffer.length)); + debugs(93, 4, "(PS) bufferData"); + //debugs(93, 4, "reply " << reply << " body " << string(buffer.data, buffer.length)); assert(!req->getConn().getRaw()); @@ -162,7 +162,7 @@ else { if (reply) { if (reply->sline.status != HTTP_OK) { - debugs(93, 1, "Aborting on non-\"HTTP OK\""); + debugs(93, 4, "(PS) Aborting on non-\"HTTP OK\""); httpReplyDestroy(reply); httpRequestFree(req); return; @@ -178,43 +178,44 @@ if (buffer.data && buffer.length) { - debugs(93, 1, "advancing"); + debugs(93, 4, "(PS) advancing"); req->out.offset += buffer.length; } if (!reply && !buffer.data && !buffer.length) { - debugs(93, 1, "EOF / Read error / aborted entry"); + debugs(93, 4, "(PS) EOF / Read error / aborted entry"); httpRequestFree(req); return; } if (clientHttpRequestStatus(-1, req)) { - debugs(93, 1, "XXX some sort of weird overflow condition?"); + debugs(93, 4, "(PS) XXX some sort of weird overflow condition?"); node->data = NULL; return; } switch (clientStreamStatus(node, req)) { case STREAM_UNPLANNED_COMPLETE: - debugs(93, 1, "stream_unplanned_complete"); + debugs(93, 4, "(PS) stream_unplanned_complete"); httpRequestFree(req); return; case STREAM_COMPLETE: - debugs(93, 1, "stream_complete"); + debugs(93, 4, "(PS) stream_complete"); httpRequestFree(req); return; case STREAM_FAILED: - debugs(93, 1, "stream_failed"); + debugs(93, 4, "(PS) stream_failed"); httpRequestFree(req); return; case STREAM_NONE: - debugs(93, 1, "stream_none"); - debugs(93, 1, "read"); - /*clientStreamRead(node, req, buffer);*/ - debugs(93, 1, "after read"); + debugs(93, 4, "(PS) stream_none"); + debugs(93, 4, "(PS) before read"); + buffer.offset += buffer.length; + clientStreamRead(node, req, buffer); + debugs(93, 4, "(PS) after read"); return; default: - debugs(93, 1, "default"); + debugs(93, 4, "(PS) default"); return; } } @@ -222,7 +223,7 @@ void PrefetchStream::detach(clientStreamNode *node, ClientHttpRequest *req) { - debugs(93, 1, "(PS) detach"); + debugs(93, 4, "(PS) detach"); pending.erase(pending_element); clientStreamDetach(node, req); }