From: Francesco Chemolli Date: Wed, 18 Feb 2009 09:45:32 +0000 (+0100) Subject: Fixed typo in DelayTaggedBucket::stats. X-Git-Tag: SQUID_3_2_0_1~1189^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dd6e6148b8960f95c4dd4aa55de100179fc2933b;p=thirdparty%2Fsquid.git Fixed typo in DelayTaggedBucket::stats. Added comments. String.cci doesn't need to include squid.h, config.h is enough In errorpage.cc there is no need to drop to char* land, we can work with String. --- diff --git a/src/DelayTagged.cc b/src/DelayTagged.cc index 377c2f6584..5947fb94f0 100644 --- a/src/DelayTagged.cc +++ b/src/DelayTagged.cc @@ -195,7 +195,7 @@ DelayTaggedBucket::~DelayTaggedBucket() void DelayTaggedBucket::stats (StoreEntry *entry) const { - storeAppendPrintf(entry, " " SQUIDSTRINGPH , SQUIDSTRINGPRINT(tag)); + storeAppendPrintf(entry, " :" SQUIDSTRINGPH , SQUIDSTRINGPRINT(tag)); theBucket.stats (entry); } diff --git a/src/HttpReply.cc b/src/HttpReply.cc index 0ec76cb1bd..42d0c21b18 100644 --- a/src/HttpReply.cc +++ b/src/HttpReply.cc @@ -439,7 +439,8 @@ HttpReply::bodySize(const HttpRequestMethod& method) const bool HttpReply::sanityCheckStartLine(MemBuf *buf, http_status *error) { - if (buf->contentSize() >= protoPrefix.psize() && protoPrefix.cmp(buf->content(), protoPrefix.size()) != 0) { //hack + //hack warning: using psize instead of size here due to type mismatches with MemBuf. + if (buf->contentSize() >= protoPrefix.psize() && protoPrefix.cmp(buf->content(), protoPrefix.size()) != 0) { debugs(58, 3, "HttpReply::sanityCheckStartLine: missing protocol prefix (" << protoPrefix << ") in '" << buf->content() << "'"); *error = HTTP_INVALID_HEADER; return false; diff --git a/src/ICAP/ICAPXaction.cc b/src/ICAP/ICAPXaction.cc index dcf864c208..82993b60ba 100644 --- a/src/ICAP/ICAPXaction.cc +++ b/src/ICAP/ICAPXaction.cc @@ -148,12 +148,14 @@ void ICAPXaction::closeConnection() cancelRead(); // may not work if (reuseConnection && !doneWithIo()) { + //status() adds leading spaces. debugs(93,5, HERE << "not reusing pconn due to pending I/O" << status()); reuseConnection = false; } if (reuseConnection) { IpAddress client_addr; + //status() adds leading spaces. debugs(93,3, HERE << "pushing pconn" << status()); AsyncCall::Pointer call = NULL; commSetTimeout(connection, -1, call); @@ -161,6 +163,7 @@ void ICAPXaction::closeConnection() theService->cfg().port, NULL, client_addr); disableRetries(); } else { + //status() adds leading spaces. debugs(93,3, HERE << "closing pconn" << status()); // comm_close will clear timeout comm_close(connection); diff --git a/src/String.cci b/src/String.cci index 56958d0286..7f7c881e95 100644 --- a/src/String.cci +++ b/src/String.cci @@ -32,9 +32,9 @@ * */ +#include "config.h" #include "assert.h" #include -#include "squid.h" #ifdef HAVE_STDINT_H #include //for INT_MAX diff --git a/src/errorpage.cc b/src/errorpage.cc index 20e2c48c39..026500a343 100644 --- a/src/errorpage.cc +++ b/src/errorpage.cc @@ -942,7 +942,6 @@ ErrorState::BuildContent() */ if (!Config.errorDirectory && request && request->header.getList(HDR_ACCEPT_LANGUAGE, &hdr) ) { - const char *raw_hdr = hdr.termedBuf(); // raw header string for parsing size_t pos = 0; // current parsing position in header string char *reset = NULL; // where to reset the p pointer for each new tag file char *dt = NULL; @@ -964,12 +963,12 @@ ErrorState::BuildContent() * - IFF a tag contains only two characters we can wildcard ANY translations matching: '-'? .* * with preference given to an exact match. */ - while (pos < hdr.size() && raw_hdr[pos] != ';' && raw_hdr[pos] != ',' && !xisspace(raw_hdr[pos]) && dt < (dir+256) ) { - *dt++ = xtolower(raw_hdr[pos++]); + while (pos < hdr.size() && hdr[pos] != ';' && hdr[pos] != ',' && !xisspace(hdr[pos]) && dt < (dir+256) ) { + *dt++ = xtolower(hdr[pos++]); } *dt++ = '\0'; // nul-terminated the filename content string before system use. - debugs(4, 9, HERE << "STATE: dt='" << dt << "', reset='" << reset << "', reset[1]='" << reset[1] << "', pos=" << pos << ", buf='" << &raw_hdr[pos] << "'"); + debugs(4, 9, HERE << "STATE: dt='" << dt << "', reset='" << reset << "', reset[1]='" << reset[1] << "', pos=" << pos << ", buf='" << hdr.substr(pos,hdr.size()) << "'"); /* if we found anything we might use, try it. */ if (*reset != '\0') { @@ -997,8 +996,8 @@ ErrorState::BuildContent() dt = reset; // reset for next tag testing. we replace the failed name instead of cloning. // IFF we terminated the tag on ';' we need to skip the 'q=' bit to the next ',' or end. - while (pos < hdr.size() && raw_hdr[pos] != ',') pos++; - if (raw_hdr[pos] == ',') pos++; + while (pos < hdr.size() && hdr[pos] != ',') pos++; + if (hdr[pos] == ',') pos++; } } #endif /* USE_ERR_LOCALES */