/*
- * $Id: ACLARP.cc,v 1.23 2006/12/21 20:01:00 serassio Exp $
+ * $Id: ACLARP.cc,v 1.24 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 28 Access Control
* AUTHOR: Duane Wessels
int a1 = 0, a2 = 0, a3 = 0, a4 = 0, a5 = 0, a6 = 0;
if (sscanf(asc, "%x:%x:%x:%x:%x:%x", &a1, &a2, &a3, &a4, &a5, &a6) != 6) {
- debug(28, 0) ("decode_eth: Invalid ethernet address '%s'\n", asc);
+ debugs(28, 0, "decode_eth: Invalid ethernet address '" << asc << "'");
return 0; /* This is not valid address */
}
{
LOCAL_ARRAY(char, eth, 256);
acl_arp_data *q = new acl_arp_data;
- debug(28, 5) ("aclParseArpData: %s\n", t);
+ debugs(28, 5, "aclParseArpData: " << t);
if (sscanf(t, "%[0-9a-fA-F:]", eth) != 1) {
- debug(28, 0) ("aclParseArpData: Bad ethernet address: '%s'\n", t);
+ debugs(28, 0, "aclParseArpData: Bad ethernet address: '" << t << "'");
safe_free(q);
return NULL;
}
if (!decode_eth(eth, q->eth)) {
- debug(28, 0) ("%s line %d: %s\n",
- cfg_filename, config_lineno, config_input_line);
- debug(28, 0) ("aclParseArpData: Ignoring invalid ARP acl entry: can't parse '%s'\n", eth);
+ debugs(28, 0, "" << cfg_filename << " line " << config_lineno << ": " << config_input_line);
+ debugs(28, 0, "aclParseArpData: Ignoring invalid ARP acl entry: can't parse '" << eth << "'");
safe_free(q);
return NULL;
}
return 0;
}
- debug(28, 4) ("Got address %02x:%02x:%02x:%02x:%02x:%02x\n",
- arpReq.arp_ha.sa_data[0] & 0xff, arpReq.arp_ha.sa_data[1] & 0xff,
- arpReq.arp_ha.sa_data[2] & 0xff, arpReq.arp_ha.sa_data[3] & 0xff,
- arpReq.arp_ha.sa_data[4] & 0xff, arpReq.arp_ha.sa_data[5] & 0xff);
+ debugs(28, 4, "Got address "<< std::setfill('0') << std::hex <<
+ std::setw(2) << (arpReq.arp_ha.sa_data[0] & 0xff) << ":" <<
+ std::setw(2) << (arpReq.arp_ha.sa_data[1] & 0xff) << ":" <<
+ std::setw(2) << (arpReq.arp_ha.sa_data[2] & 0xff) << ":" <<
+ std::setw(2) << (arpReq.arp_ha.sa_data[3] & 0xff) << ":" <<
+ std::setw(2) << (arpReq.arp_ha.sa_data[4] & 0xff) << ":" <<
+ std::setw(2) << (arpReq.arp_ha.sa_data[5] & 0xff));
+
/* Do lookup */
acl_arp_data X;
memcpy (X.eth, arpReq.arp_ha.sa_data, 6);
*Top = (*Top)->splay(&X, aclArpCompare);
- debug(28, 3) ("aclMatchArp: '%s' %s\n",
- inet_ntoa(c), splayLastResult ? "NOT found" : "found");
+ debugs(28, 3, "aclMatchArp: '" << inet_ntoa(c) << "' " << (splayLastResult ? "NOT found" : "found"));
return (0 == splayLastResult);
}
ifc.ifc_buf = (char *)ifbuffer;
if (ioctl(HttpSockets[0], SIOCGIFCONF, &ifc) < 0) {
- debug(28, 1) ("Attempt to retrieve interface list failed: %s\n",
- xstrerror());
+ debugs(28, 1, "Attempt to retrieve interface list failed: " << xstrerror());
return 0;
}
if (ifc.ifc_len > (int)sizeof(ifbuffer)) {
- debug(28, 1) ("Interface list too long - %d\n", ifc.ifc_len);
+ debugs(28, 1, "Interface list too long - " << ifc.ifc_len);
return 0;
}
if (NULL != strchr(ifr->ifr_name, ':'))
continue;
- debug(28, 4) ("Looking up ARP address for %s on %s\n", inet_ntoa(c),
- ifr->ifr_name);
+ debugs(28, 4, "Looking up ARP address for " << inet_ntoa(c) << " on " << ifr->ifr_name);
/* Set up structures for ARP lookup */
ipAddr.sin_family = AF_INET;
else if (ENODEV == errno)
(void) 0;
else
- debug(28, 1) ("ARP query failed: %s: %s\n",
- ifr->ifr_name, xstrerror());
+ debugs(28, 1, "ARP query failed: " << ifr->ifr_name << ": " << xstrerror());
continue;
}
if (arpReq.arp_ha.sa_family != ARPHRD_ETHER)
continue;
- debug(28, 4) ("Got address %02x:%02x:%02x:%02x:%02x:%02x on %s\n",
- arpReq.arp_ha.sa_data[0] & 0xff,
- arpReq.arp_ha.sa_data[1] & 0xff,
- arpReq.arp_ha.sa_data[2] & 0xff,
- arpReq.arp_ha.sa_data[3] & 0xff,
- arpReq.arp_ha.sa_data[4] & 0xff,
- arpReq.arp_ha.sa_data[5] & 0xff, ifr->ifr_name);
+ debugs(28, 4, "Got address "<< std::setfill('0') << std::hex <<
+ std::setw(2) << (arpReq.arp_ha.sa_data[0] & 0xff) << ":" <<
+ std::setw(2) << (arpReq.arp_ha.sa_data[1] & 0xff) << ":" <<
+ std::setw(2) << (arpReq.arp_ha.sa_data[2] & 0xff) << ":" <<
+ std::setw(2) << (arpReq.arp_ha.sa_data[3] & 0xff) << ":" <<
+ std::setw(2) << (arpReq.arp_ha.sa_data[4] & 0xff) << ":" <<
+ std::setw(2) << (arpReq.arp_ha.sa_data[5] & 0xff) << " on "<<
+ std::setfill(' ') << ifr->ifr_name);
/* Do lookup */
acl_arp_data X;
/* Return if match, otherwise continue to other interfaces */
if (0 == splayLastResult) {
- debug(28, 3) ("aclMatchArp: %s found on %s\n",
- inet_ntoa(c), ifr->ifr_name);
+ debugs(28, 3, "aclMatchArp: " << inet_ntoa(c) << " found on " << ifr->ifr_name);
return 1;
}
arpReq.arp_ha.sa_data[4] == 0 && arpReq.arp_ha.sa_data[5] == 0)
return 0;
- debug(28, 4) ("Got address %02x:%02x:%02x:%02x:%02x:%02x\n",
- arpReq.arp_ha.sa_data[0] & 0xff, arpReq.arp_ha.sa_data[1] & 0xff,
- arpReq.arp_ha.sa_data[2] & 0xff, arpReq.arp_ha.sa_data[3] & 0xff,
- arpReq.arp_ha.sa_data[4] & 0xff, arpReq.arp_ha.sa_data[5] & 0xff);
+ debugs(28, 4, "Got address "<< std::setfill('0') << std::hex <<
+ std::setw(2) << (arpReq.arp_ha.sa_data[0] & 0xff) << ":" <<
+ std::setw(2) << (arpReq.arp_ha.sa_data[1] & 0xff) << ":" <<
+ std::setw(2) << (arpReq.arp_ha.sa_data[2] & 0xff) << ":" <<
+ std::setw(2) << (arpReq.arp_ha.sa_data[3] & 0xff) << ":" <<
+ std::setw(2) << (arpReq.arp_ha.sa_data[4] & 0xff) << ":" <<
+ std::setw(2) << (arpReq.arp_ha.sa_data[5] & 0xff));
/* Do lookup */
*Top = (*Top)->splay((acl_arp_data *)&arpReq.arp_ha.sa_data, aclArpCompare);
- debug(28, 3) ("aclMatchArp: '%s' %s\n",
- inet_ntoa(c), splayLastResult ? "NOT found" : "found");
+ debugs(28, 3, "aclMatchArp: '" << inet_ntoa(c) << "' " << (splayLastResult ? "NOT found" : "found"));
return (0 == splayLastResult);
}
mib[5] = RTF_LLINFO;
if (sysctl(mib, 6, NULL, &needed, NULL, 0) < 0) {
- debug(28, 0) ("Can't estimate ARP table size!\n");
+ debugs(28, 0, "Can't estimate ARP table size!");
return 0;
}
if ((buf = (char *)xmalloc(needed)) == NULL) {
- debug(28, 0) ("Can't allocate temporary ARP table!\n");
+ debugs(28, 0, "Can't allocate temporary ARP table!");
return 0;
}
if (sysctl(mib, 6, buf, &needed, NULL, 0) < 0) {
- debug(28, 0) ("Can't retrieve ARP table!\n");
+ debugs(28, 0, "Can't retrieve ARP table!");
xfree(buf);
return 0;
}
arpReq.arp_ha.sa_data[4] == 0 && arpReq.arp_ha.sa_data[5] == 0)
return 0;
- debug(28, 4) ("Got address %02x:%02x:%02x:%02x:%02x:%02x\n",
- arpReq.arp_ha.sa_data[0] & 0xff, arpReq.arp_ha.sa_data[1] & 0xff,
- arpReq.arp_ha.sa_data[2] & 0xff, arpReq.arp_ha.sa_data[3] & 0xff,
- arpReq.arp_ha.sa_data[4] & 0xff, arpReq.arp_ha.sa_data[5] & 0xff);
+ debugs(28, 4, "Got address "<< std::setfill('0') << std::hex <<
+ std::setw(2) << (arpReq.arp_ha.sa_data[0] & 0xff) << ":" <<
+ std::setw(2) << (arpReq.arp_ha.sa_data[1] & 0xff) << ":" <<
+ std::setw(2) << (arpReq.arp_ha.sa_data[2] & 0xff) << ":" <<
+ std::setw(2) << (arpReq.arp_ha.sa_data[3] & 0xff) << ":" <<
+ std::setw(2) << (arpReq.arp_ha.sa_data[4] & 0xff) << ":" <<
+ std::setw(2) << (arpReq.arp_ha.sa_data[5] & 0xff));
/* Do lookup */
*Top = (*Top)->splay((acl_arp_data *)&arpReq.arp_ha.sa_data, aclArpCompare);
- debug(28, 3) ("aclMatchArp: '%s' %s\n",
- inet_ntoa(c), splayLastResult ? "NOT found" : "found");
+ debugs(28, 3, "aclMatchArp: '" << inet_ntoa(c) << "' " << (splayLastResult ? "NOT found" : "found"));
return (0 == splayLastResult);
/* Get size of Windows ARP table */
if (GetIpNetTable(NetTable, &ipNetTableLen, FALSE) != ERROR_INSUFFICIENT_BUFFER) {
- debug(28, 0) ("Can't estimate ARP table size!\n");
+ debugs(28, 0, "Can't estimate ARP table size!");
return 0;
}
/* Allocate space for ARP table and assign pointers */
if ((NetTable = (PMIB_IPNETTABLE)xmalloc(ipNetTableLen)) == NULL) {
- debug(28, 0) ("Can't allocate temporary ARP table!\n");
+ debugs(28, 0, "Can't allocate temporary ARP table!");
return 0;
}
/* Get actual ARP table */
if ((dwNetTable = GetIpNetTable(NetTable, &ipNetTableLen, FALSE)) != NO_ERROR) {
- debug(28, 0) ("Can't retrieve ARP table!\n");
+ debugs(28, 0, "Can't retrieve ARP table!");
xfree(NetTable);
return 0;
}
arpReq.arp_ha.sa_data[4] == 0 && arpReq.arp_ha.sa_data[5] == 0)
return 0;
- debug(28, 4) ("Got address %02x:%02x:%02x:%02x:%02x:%02x\n",
- arpReq.arp_ha.sa_data[0] & 0xff, arpReq.arp_ha.sa_data[1] & 0xff,
- arpReq.arp_ha.sa_data[2] & 0xff, arpReq.arp_ha.sa_data[3] & 0xff,
- arpReq.arp_ha.sa_data[4] & 0xff, arpReq.arp_ha.sa_data[5] & 0xff);
+ debugs(28, 4, "Got address "<< std::setfill('0') << std::hex <<
+ std::setw(2) << (arpReq.arp_ha.sa_data[0] & 0xff) << ":" <<
+ std::setw(2) << (arpReq.arp_ha.sa_data[1] & 0xff) << ":" <<
+ std::setw(2) << (arpReq.arp_ha.sa_data[2] & 0xff) << ":" <<
+ std::setw(2) << (arpReq.arp_ha.sa_data[3] & 0xff) << ":" <<
+ std::setw(2) << (arpReq.arp_ha.sa_data[4] & 0xff) << ":" <<
+ std::setw(2) << (arpReq.arp_ha.sa_data[5] & 0xff));
/* Do lookup */
*Top = (*Top)->splay((acl_arp_data *)&arpReq.arp_ha.sa_data, aclArpCompare);
- debug(28, 3) ("aclMatchArp: '%s' %s\n",
- inet_ntoa(c), splayLastResult ? "NOT found" : "found");
+ debugs(28, 3, "aclMatchArp: '" << inet_ntoa(c) << "' " << (splayLastResult ? "NOT found" : "found"));
return (0 == splayLastResult);
/*
* Address was not found on any interface
*/
- debug(28, 3) ("aclMatchArp: %s NOT found\n", inet_ntoa(c));
+ debugs(28, 3, "aclMatchArp: " << inet_ntoa(c) << " NOT found");
return 0;
}
/*
- * $Id: ACLChecklist.cc,v 1.35 2007/04/20 22:24:07 wessels Exp $
+ * $Id: ACLChecklist.cc,v 1.36 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 28 Access Control
* AUTHOR: Duane Wessels
/* WWW authorization on accelerated requests */
headertype = HDR_AUTHORIZATION;
} else if (request->flags.transparent) {
- debug(28, 1) ("ACHChecklist::authenticated: authentication not applicable on transparently intercepted requests.\n");
+ debugs(28, 1, "ACHChecklist::authenticated: authentication not applicable on transparently intercepted requests.");
return -1;
} else {
/* Proxy authorization on proxy requests */
switch (AuthUserRequest::tryToAuthenticateAndSetAuthUser (&auth_user_request, headertype, request, conn(), src_addr)) {
case AUTH_ACL_CANNOT_AUTHENTICATE:
- debug(28, 4) ("aclMatchAcl: returning 0 user authenticated but not authorised.\n");
+ debugs(28, 4, "aclMatchAcl: returning 0 user authenticated but not authorised.");
return 0;
case AUTH_AUTHENTICATED:
break;
case AUTH_ACL_HELPER:
- debug(28, 4) ("aclMatchAcl: returning 0 sending credentials to helper.\n");
+ debugs(28, 4, "aclMatchAcl: returning 0 sending credentials to helper.");
changeState (ProxyAuthLookup::Instance());
return 0;
case AUTH_ACL_CHALLENGE:
- debug(28, 4) ("aclMatchAcl: returning 0 sending authentication challenge.\n");
+ debugs(28, 4, "aclMatchAcl: returning 0 sending authentication challenge.");
changeState (ProxyAuthNeeded::Instance());
return 0;
if (!cbdataReferenceValid(accessList)) {
cbdataReferenceDone(accessList);
- debug (28,4)("ACLChecklist::check: %p accessList is invalid\n", this);
+ debugs(28, 4, "ACLChecklist::check: " << this << " accessList is invalid");
continue;
}
* We are done. Either the request
* is allowed, denied, requires authentication.
*/
- debug(28, 3) ("ACLChecklist::check: %p match found, calling back with %d\n", this, currentAnswer());
+ debugs(28, 3, "ACLChecklist::check: " << this << " match found, calling back with " << currentAnswer());
cbdataReferenceDone(accessList); /* A */
checkCallback(currentAnswer());
/* From here on in, this may be invalid */
}
/* dropped off the end of the list */
- debug(28, 3) ("ACLChecklist::check: %p NO match found, returning %d\n", this,
- currentAnswer() != ACCESS_DENIED ? ACCESS_DENIED : ACCESS_ALLOWED);
+ debugs(28, 3, "ACLChecklist::check: " << this <<
+ " NO match found, returning " <<
+ (currentAnswer() != ACCESS_DENIED ? ACCESS_DENIED : ACCESS_ALLOWED));
checkCallback(currentAnswer() != ACCESS_DENIED ? ACCESS_DENIED : ACCESS_ALLOWED);
}
{
assert (!finished() && !(asyncInProgress() && newAsync));
async_ = newAsync;
- debug (28,3)("ACLChecklist::asyncInProgress: %p async set to %d\n", this, async_);
+ debugs(28, 3, "ACLChecklist::asyncInProgress: " << this <<
+ " async set to " << async_);
}
void
{
assert (!finished() && !asyncInProgress());
finished_ = true;
- debug (28,3)("ACLChecklist::markFinished: %p checklist processing finished\n", this);
+ debugs(28, 3, "ACLChecklist::markFinished: " << this <<
+ " checklist processing finished");
}
void
ACLChecklist::preCheck()
{
- debug(28, 3) ("ACLChecklist::preCheck: %p checking '%s'\n", this, accessList->cfgline);
+ debugs(28, 3, "ACLChecklist::preCheck: " << this << " checking '" << accessList->cfgline << "'");
/* what is our result on a match? */
currentAnswer(accessList->allow);
}
{
PF *callback_;
void *cbdata_;
- debug(28, 3) ("ACLChecklist::checkCallback: %p answer=%d\n", this, answer);
+ debugs(28, 3, "ACLChecklist::checkCallback: " << this << " answer=" << answer);
+
/* During reconfigure, we can end up not finishing call
* sequences into the auth code */
changeState(NullState::Instance());
if (!nodeMatched || state_ != NullState::Instance()) {
- debug(28, 3) ("aclmatchAclList: %p returning false (AND list entry failed to match)\n", this);
+ debugs(28, 3, "aclmatchAclList: " << this << " returning false (AND list entry failed to match)");
+
bool async = state_ != NullState::Instance();
checkForAsync();
bool async_in_progress = asyncInProgress();
- debug(28,3)("aclmatchAclList: async=%d nodeMatched=%d async_in_progress=%d lastACLResult() = %d\n",
- async ? 1 : 0, nodeMatched ? 1 : 0, async_in_progress ? 1 : 0,
- lastACLResult() ? 1 : 0);
+ debugs(28, 3, "aclmatchAclList: async=" << (async ? 1 : 0) <<
+ " nodeMatched=" << (nodeMatched ? 1 : 0) <<
+ " async_in_progress=" << (async_in_progress ? 1 : 0) <<
+ " lastACLResult() = " << (lastACLResult() ? 1 : 0));
if (async && nodeMatched && !asyncInProgress() && lastACLResult()) {
// async acl, but using cached response, and it was a match
node = node->next;
}
- debug(28, 3) ("aclmatchAclList: %p returning true (AND list satisfied)\n", this);
+ debugs(28, 3, "aclmatchAclList: " << this << " returning true (AND list satisfied)");
+
markFinished();
PROF_stop(aclMatchAclList);
}
cbdataReferenceDone(accessList);
- debug (28,4)("ACLChecklist::~ACLChecklist: destroyed %p\n", this);
+ debugs(28, 4, "ACLChecklist::~ACLChecklist: destroyed " << this);
}
{
PROF_start(aclCheckFast);
currentAnswer(ACCESS_DENIED);
- debug(28, 5) ("aclCheckFast: list: %p\n", accessList);
+ debugs(28, 5, "aclCheckFast: list: " << accessList);
while (accessList) {
preCheck();
cbdataReferenceDone(A);
}
- debug(28, 5) ("aclCheckFast: no matches, returning: %d\n", currentAnswer() == ACCESS_DENIED);
+ debugs(28, 5, "aclCheckFast: no matches, returning: " << (currentAnswer() == ACCESS_DENIED));
+
PROF_stop(aclCheckFast);
return currentAnswer() == ACCESS_DENIED;
}
/*
- * $Id: ACLDestinationDomain.cc,v 1.12 2005/07/07 21:22:52 wessels Exp $
+ * $Id: ACLDestinationDomain.cc,v 1.13 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 28 Access Control
* AUTHOR: Duane Wessels
return data->match(fqdn);
} else if (!checklist->destinationDomainChecked()) {
/* FIXME: Using AclMatchedName here is not OO correct. Should find a way to the current acl */
- debug(28, 3) ("aclMatchAcl: Can't yet compare '%s' ACL for '%s'\n",
- AclMatchedName, checklist->request->host);
+ debugs(28, 3, "aclMatchAcl: Can't yet compare '" << AclMatchedName << "' ACL for '" << checklist->request->host << "'");
checklist->changeState(DestinationDomainLookup::Instance());
return 0;
}
return 0;
} else if (!checklist->request->flags.destinationIPLookedUp()) {
/* No entry in cache, lookup not attempted */
- debug(28, 3) ("aclMatchAcl: Can't yet compare '%s' ACL for '%s'\n",
- name, checklist->request->host);
+ debugs(28, 3, "aclMatchAcl: Can't yet compare '" << name << "' ACL for '" << checklist->request->host << "'");
checklist->changeState (DestinationIPLookup::Instance());
return 0;
} else {
/*
- * $Id: ACLDomainData.cc,v 1.12 2006/04/23 11:10:31 robertc Exp $
+ * $Id: ACLDomainData.cc,v 1.13 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 28 Access Control
* AUTHOR: Duane Wessels
/* FIXME this warning may display d1 and d2 when it should display d3 and d4 */
if (ret == 0) {
- debug(28, 0) ("WARNING: '%s' is a subdomain of '%s'\n", d1, d2);
- debug(28, 0) ("WARNING: because of this '%s' is ignored to keep splay tree searching predictable\n", (char *) a);
- debug(28, 0) ("WARNING: You should probably remove '%s' from the ACL named '%s'\n", d1, AclMatchedName);
+ debugs(28, 0, "WARNING: '" << d1 << "' is a subdomain of '" << d2 << "'");
+ debugs(28, 0, "WARNING: because of this '" << (char *) a << "' is ignored to keep splay tree searching predictable");
+ debugs(28, 0, "WARNING: You should probably remove '" << d1 << "' from the ACL named '" << AclMatchedName << "'");
}
return ret;
if (host == NULL)
return 0;
- debug(28, 3) ("aclMatchDomainList: checking '%s'\n", host);
+ debugs(28, 3, "aclMatchDomainList: checking '" << host << "'");
domains = domains->splay((char *)host, aclHostDomainCompare);
- debug(28, 3) ("aclMatchDomainList: '%s' %s\n",
- host, splayLastResult ? "NOT found" : "found");
+ debugs(28, 3, "aclMatchDomainList: '" << host << "' " << (splayLastResult ? "NOT found" : "found"));
return !splayLastResult;
}
/*
- * $Id: ACLExtUser.cc,v 1.8 2005/05/08 06:53:58 hno Exp $
+ * $Id: ACLExtUser.cc,v 1.9 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 28 Access Control
* AUTHOR: Duane Wessels
void
ACLExtUser::parse()
{
- debug(28, 3) ("aclParseUserList: current is null. Creating\n");
+ debugs(28, 3, "aclParseUserList: current is null. Creating");
data = new ACLUserData;
data->parse();
}
/*
- * $Id: ACLHTTPHeaderData.cc,v 1.2 2006/08/05 12:05:35 robertc Exp $
+ * $Id: ACLHTTPHeaderData.cc,v 1.3 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 28 Access Control
* AUTHOR: Duane Wessels
if (hdr == NULL)
return false;
- debug(28, 3) ("aclHeaderData::match: checking '%s'\n", hdrName.buf());
+ debugs(28, 3, "aclHeaderData::match: checking '" << hdrName.buf() << "'");
String value = hdrId != HDR_BAD_HDR ? hdr->getStrOrList(hdrId) : hdr->getByName(hdrName.buf());
/*
- * $Id: ACLHTTPStatus.cc,v 1.2 2006/04/23 11:10:31 robertc Exp $
+ * $Id: ACLHTTPStatus.cc,v 1.3 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 28 Access Control
* AUTHOR: Duane Wessels
char bufb[8];
a->toStr(bufa, sizeof(bufa));
b->toStr(bufb, sizeof(bufb));
- debug(28, 0) ("WARNING: '%s' is a subrange of '%s'\n", bufa, bufb);
- debug(28, 0) ("WARNING: because of this '%s' is ignored "
- "to keep splay tree searching predictable\n", bufa);
- debug(28, 0) ("WARNING: You should probably remove '%s' "
- "from the ACL named '%s'\n", bufb, AclMatchedName);
+ debugs(28, 0, "WARNING: '" << bufa << "' is a subrange of '" << bufb << "'");
+ debugs(28, 0, "WARNING: because of this '" << bufa << "' is ignored to keep splay tree searching predictable");
+ debugs(28, 0, "WARNING: You should probably remove '" << bufb << "' from the ACL named '" << AclMatchedName << "'");
}
return ret;
SplayNode<acl_httpstatus_data*> **Top = dataptr;
*Top = Top[0]->splay(&X, aclHTTPStatusCompare);
- debug(28, 3) ("aclMatchHTTPStatus: '%d' %s\n", status,
- splayLastResult ? "NOT found" : "found");
+ debugs(28, 3, "aclMatchHTTPStatus: '" << status << "' " << (splayLastResult ? "NOT found" : "found"));
return (0 == splayLastResult);
}
a->toStr(buf_n2, 60);
a->toStr(buf_a, 60);
/* TODO: this warning may display the wrong way around */
- debug(28, 0) ("WARNING: '%s' is a subnetwork of "
- "'%s'\n", buf_n1, buf_n2);
- debug(28, 0) ("WARNING: because of this '%s' is ignored "
- "to keep splay tree searching predictable\n", buf_a);
- debug(28, 0) ("WARNING: You should probably remove '%s' "
- "from the ACL named '%s'\n", buf_n1, AclMatchedName);
+ debugs(28, 0, "WARNING: '" << buf_n1 <<
+ "' is a subnetwork of '" << buf_n2 << "'");
+ debugs(28, 0, "WARNING: because of this '" << buf_a <<
+ "' is ignored to keep splay tree searching predictable");
+ debugs(28, 0, "WARNING: You should probably remove '" << buf_n1 <<
+ "' from the ACL named '" << AclMatchedName << "'");
}
return ret;
acl_ip_data **Q;
char **x;
char c;
- debug(28, 5) ("aclParseIpData: %s\n", t);
+ debugs(28, 5, "aclParseIpData: " << t);
acl_ip_data *q = new acl_ip_data;
if (!strcasecmp(t, "all")) {
struct hostent *hp;
if ((hp = gethostbyname(addr1)) == NULL) {
- debug(28, 0) ("aclParseIpData: Bad host/IP: '%s'\n", t);
+ debugs(28, 0, "aclParseIpData: Bad host/IP: '" << t << "'");
self_destruct();
}
r->addr2.s_addr = 0;
if (!DecodeMask(mask, &r->mask)) {
- debug(28, 0) ("aclParseIpData: unknown netmask '%s' in '%s'\n", mask, t);
+ debugs(28, 0, "aclParseIpData: unknown netmask '" << mask << "' in '" << t << "'");
delete r;
*Q = NULL;
self_destruct();
Q = &r->next;
- debug(28, 3) ("%s --> %s\n", addr1, inet_ntoa(r->addr1));
+ debugs(28, 3, "" << addr1 << " --> " << inet_ntoa(r->addr1));
}
if (*Q != NULL) {
- debug(28, 0) ("aclParseIpData: Bad host/IP: '%s'\n", t);
+ debugs(28, 0, "aclParseIpData: Bad host/IP: '" << t << "'");
self_destruct();
}
/* Decode addr1 */
if (!safe_inet_addr(addr1, &q->addr1)) {
- debug(28, 0) ("aclParseIpData: unknown first address in '%s'\n", t);
+ debugs(28, 0, "aclParseIpData: unknown first address in '" << t << "'");
delete q;
self_destruct();
return NULL;
/* Decode addr2 */
if (!safe_inet_addr(addr2, &q->addr2)) {
- debug(28, 0) ("aclParseIpData: unknown second address in '%s'\n", t);
+ debugs(28, 0, "aclParseIpData: unknown second address in '" << t << "'");
delete q;
self_destruct();
return NULL;
/* Decode mask */
if (!DecodeMask(mask, &q->mask)) {
- debug(28, 0) ("aclParseIpData: unknown netmask '%s' in '%s'\n", mask, t);
+ debugs(28, 0, "aclParseIpData: unknown netmask '" << mask << "' in '" << t << "'");
delete q;
self_destruct();
return NULL;
if ((q->addr1.s_addr & q->mask.s_addr) != q->addr1.s_addr ||
(q->addr2.s_addr & q->mask.s_addr) != q->addr2.s_addr)
- debug(28, 0) ("aclParseIpData: WARNING: Netmask masks away part of the specified IP in '%s'\n", t);
+ debugs(28, 0, "aclParseIpData: WARNING: Netmask masks away part of the specified IP in '" << t << "'");
q->addr1.s_addr &= q->mask.s_addr;
ClientAddress.addr1 = clientip;
acl_ip_data *ClientAddressPointer = &ClientAddress;
data = data->splay(ClientAddressPointer, aclIpAddrNetworkCompare);
- debug(28, 3) ("aclMatchIp: '%s' %s\n",
- inet_ntoa(clientip), splayLastResult ? "NOT found" : "found");
+ debugs(28, 3, "aclMatchIp: '" << inet_ntoa(clientip) << "' " << (splayLastResult ? "NOT found" : "found"));
return !splayLastResult;
}
ACLIdent::parse()
{
if (!data) {
- debug(28, 3) ("aclParseUserList: current is null. Creating\n");
+ debugs(28, 3, "aclParseUserList: current is null. Creating");
data = new ACLUserData;
}
} else if (checklist->conn() != NULL && checklist->conn()->rfc931[0]) {
return data->match(checklist->conn()->rfc931);
} else {
- debug(28, 3) ("ACLIdent::match() - switching to ident lookup state\n");
+ debugs(28, 3, "ACLIdent::match() - switching to ident lookup state");
checklist->changeState(IdentLookup::Instance());
return 0;
}
IdentLookup::checkForAsync(ACLChecklist *checklist)const
{
if (checklist->conn() != NULL) {
- debug(28, 3) ("IdentLookup::checkForAsync: Doing ident lookup\n");
+ debugs(28, 3, "IdentLookup::checkForAsync: Doing ident lookup" );
checklist->asyncInProgress(true);
identStart(&checklist->conn()->me, &checklist->conn()->peer,
LookupDone, checklist);
} else {
- debug(28, 1) ("IdentLookup::checkForAsync: Can't start ident lookup. No client connection\n");
+ debugs(28, 1, "IdentLookup::checkForAsync: Can't start ident lookup. No client connection" );
checklist->currentAnswer(ACCESS_DENIED);
checklist->markFinished();
}
/*
- * $Id: ACLIntRange.cc,v 1.9 2006/10/08 13:10:34 serassio Exp $
+ * $Id: ACLIntRange.cc,v 1.10 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 28 Access Control
* AUTHOR: Robert Collins
temp.end = port2+1;
ranges.push_back(temp);
} else {
- debug(28, 0) ("ACLIntRange::parse: Invalid port value\n");
+ debugs(28, 0, "ACLIntRange::parse: Invalid port value");
self_destruct();
}
}
/*
- * $Id: ACLMaxConnection.cc,v 1.6 2006/04/23 11:10:31 robertc Exp $
+ * $Id: ACLMaxConnection.cc,v 1.7 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 28 Access Control
* AUTHOR: Duane Wessels
if (0 != Config.onoff.client_db)
return;
- debug(22, 0) ("WARNING: 'maxconn' ACL (%s) won't work with client_db disabled\n", name);
+ debugs(22, 0, "WARNING: 'maxconn' ACL (" << name << ") won't work with client_db disabled");
}
/*
- * $Id: ACLMaxUserIP.cc,v 1.11 2006/10/08 13:10:34 serassio Exp $
+ * $Id: ACLMaxUserIP.cc,v 1.12 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 28 Access Control
* AUTHOR: Duane Wessels
ACLMaxUserIP::parse()
{
if (maximum) {
- debug(28, 1) ("Attempting to alter already set User max IP acl\n");
+ debugs(28, 1, "Attempting to alter already set User max IP acl");
return;
}
if (!t)
return;
- debug(28, 5) ("aclParseUserMaxIP: First token is %s\n", t);
+ debugs(28, 5, "aclParseUserMaxIP: First token is " << t);
if (strcmp("-s", t) == 0) {
- debug(28, 5) ("aclParseUserMaxIP: Going strict\n");
+ debugs(28, 5, "aclParseUserMaxIP: Going strict");
flags.strict = 1;
t = ConfigParser::strtokFile();
}
maximum = xatoi(t);
- debug(28, 5) ("aclParseUserMaxIP: Max IP address's %d\n", (int) maximum);
+ debugs(28, 5, "aclParseUserMaxIP: Max IP address's " << (int) maximum);
return;
}
if (authenticateAuthUserRequestIPCount(auth_user_request) <= maximum)
return 0;
- debug(28, 1) ("aclMatchUserMaxIP: user '%s' tries to use too many IP addresses (max %d allowed)!\n", auth_user_request->username(), maximum);
+ debugs(28, 1, "aclMatchUserMaxIP: user '" << auth_user_request->username() << "' tries to use too many IP addresses (max " << maximum << " allowed)!");
/* this is a match */
if (flags.strict)
*/
/* remove _this_ ip, as it is the culprit for going over the limit */
authenticateAuthUserRequestRemoveIp(auth_user_request, src_addr);
- debug(28, 4) ("aclMatchUserMaxIP: Denying access in strict mode\n");
+ debugs(28, 4, "aclMatchUserMaxIP: Denying access in strict mode");
} else
{
/*
* ie to allow the user to move machines easily
*/
authenticateAuthUserRequestClearIp(auth_user_request);
- debug(28, 4) ("aclMatchUserMaxIP: Denying access in non-strict mode - flushing the user ip cache\n");
+ debugs(28, 4, "aclMatchUserMaxIP: Denying access in non-strict mode - flushing the user ip cache");
}
return 1;
ACLProxyAuth::valid () const
{
if (authenticateSchemeCount() == 0) {
- debug(28, 0) ("Can't use proxy auth because no authentication schemes were compiled.\n");
+ debugs(28, 0, "Can't use proxy auth because no authentication schemes were compiled.");
return false;
}
if (authenticateActiveSchemeCount() == 0) {
- debug(28, 0) ("Can't use proxy auth because no authentication schemes are fully configured.\n");
+ debugs(28, 0, "Can't use proxy auth because no authentication schemes are fully configured.");
return false;
}
ProxyAuthLookup::checkForAsync(ACLChecklist *checklist)const
{
checklist->asyncInProgress(true);
- debug(28, 3)
- ("ACLChecklist::checkForAsync: checking password via authenticator\n");
+ debugs(28, 3, "ACLChecklist::checkForAsync: checking password via authenticator");
auth_user_request_t *auth_user_request;
/* make sure someone created auth_user_request for us */
* credentials. (This may be part of a stateful auth protocol.)
* The request is denied.
*/
- debug(28, 6) ("ACLChecklist::checkForAsync: requiring Proxy Auth header.\n");
+ debugs(28, 6, "ACLChecklist::checkForAsync: requiring Proxy Auth header.");
checklist->currentAnswer(ACCESS_REQ_PROXY_AUTH);
checklist->changeState (ACLChecklist::NullState::Instance());
checklist->markFinished();
/*
- * $Id: ACLRegexData.cc,v 1.10 2006/05/29 19:05:26 serassio Exp $
+ * $Id: ACLRegexData.cc,v 1.11 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 28 Access Control
* AUTHOR: Duane Wessels
if (word == NULL)
return 0;
- debug(28, 3) ("aclRegexData::match: checking '%s'\n", word);
+ debugs(28, 3, "aclRegexData::match: checking '" << word << "'");
relist *first, *prev;
relist *current = first;
while (current) {
- debug(28, 3) ("aclRegexData::match: looking for '%s'\n", current->pattern);
+ debugs(28, 3, "aclRegexData::match: looking for '" << current->pattern << "'");
if (regexec(¤t->regex, word, 0, 0, 0) == 0) {
if (prev != NULL) {
first->next = current;
}
- debug(28, 2) ("aclRegexData::match: match '%s' found in '%s'\n", current->pattern, word);
+ debugs(28, 2, "aclRegexData::match: match '" << current->pattern << "' found in '" << word << "'");
return 1;
}
if ((errcode = regcomp(&comp, t, flags)) != 0) {
char errbuf[256];
regerror(errcode, &comp, errbuf, sizeof errbuf);
- debug(28, 0) ("%s line %d: %s\n",
- cfg_filename, config_lineno, config_input_line);
- debug(28, 0) ("aclParseRegexList: Invalid regular expression '%s': %s\n",
- t, errbuf);
+ debugs(28, 0, "" << cfg_filename << " line " << config_lineno << ": " << config_input_line);
+ debugs(28, 0, "aclParseRegexList: Invalid regular expression '" << t << "': " << errbuf);
continue;
}
/*
- * $Id: ACLSourceDomain.cc,v 1.4 2005/05/09 01:41:25 hno Exp $
+ * $Id: ACLSourceDomain.cc,v 1.5 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 28 Access Control
* AUTHOR: Duane Wessels
return data->match(fqdn);
} else if (!checklist->sourceDomainChecked()) {
/* FIXME: Using AclMatchedName here is not OO correct. Should find a way to the current acl */
- debug(28, 3) ("aclMatchAcl: Can't yet compare '%s' ACL for '%s'\n",
- AclMatchedName, inet_ntoa(checklist->src_addr));
+ debugs(28, 3, "aclMatchAcl: Can't yet compare '" << AclMatchedName << "' ACL for '" << inet_ntoa(checklist->src_addr) << "'");
checklist->changeState(SourceDomainLookup::Instance());
return 0;
}
/*
- * $Id: ACLStringData.cc,v 1.8 2006/04/23 11:10:31 robertc Exp $
+ * $Id: ACLStringData.cc,v 1.9 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 28 Access Control
* AUTHOR: Duane Wessels
if (!values || !toFind)
return 0;
- debug(28, 3) ("aclMatchStringList: checking '%s'\n", toFind);
+ debugs(28, 3, "aclMatchStringList: checking '" << toFind << "'");
values = values->splay((char *)toFind, splaystrcmp);
- debug(28, 3) ("aclMatchStringList: '%s' %s\n",
- toFind, splayLastResult ? "NOT found" : "found");
+ debugs(28, 3, "aclMatchStringList: '" << toFind << "' " << (splayLastResult ? "NOT found" : "found"));
return !splayLastResult;
}
/*
- * $Id: ACLTimeData.cc,v 1.13 2006/10/09 12:43:02 hno Exp $
+ * $Id: ACLTimeData.cc,v 1.14 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 28 Access Control
* AUTHOR: Duane Wessels
ACLTimeData *data = this;
while (data) {
- debug(28, 3) ("aclMatchTime: checking %d in %d-%d, weekbits=%x\n",
- (int) t, (int) data->start, (int) data->stop, data->weekbits);
+ debugs(28, 3, "aclMatchTime: checking " << (int) t << " in " <<
+ (int) data->start << "-" << (int) data->stop << ", weekbits=" <<
+ std::hex << data->weekbits);
if (t >= data->start && t <= data->stop && (data->weekbits & (1 << tm.tm_wday)))
return 1;
break;
default:
- debug(28, 0) ("%s line %d: %s\n",
- cfg_filename, config_lineno, config_input_line);
- debug(28, 0) ("aclParseTimeSpec: Bad Day '%c'\n", *t);
+ debugs(28, 0, "" << cfg_filename << " line " << config_lineno <<
+ ": " << config_input_line);
+ debugs(28, 0, "aclParseTimeSpec: Bad Day '" << *t << "'" );
break;
}
}
/* assume its time-of-day spec */
if ((sscanf(t, "%d:%d-%d:%d", &h1, &m1, &h2, &m2) < 4) || (!((h1 >= 0 && h1 < 24) && ((h2 >= 0 && h2 < 24) || (h2 == 24 && m2 == 0)) && (m1 >= 0 && m1 < 60) && (m2 >= 0 && m2 < 60)))) {
- debug(28, 0) ("aclParseTimeSpec: Bad time range '%s'\n", t);
+ debugs(28, 0, "aclParseTimeSpec: Bad time range '" << t << "'");
self_destruct();
if (q != this)
weekbits = 0;
if (q->start > q->stop) {
- debug(28, 0) ("aclParseTimeSpec: Reversed time range\n");
+ debugs(28, 0, "aclParseTimeSpec: Reversed time range");
self_destruct();
if (q != this)
{
SplayNode<char *> *Top = names;
- debug(28, 7) ("aclMatchUser: user is %s, case_insensitive is %d\n",
- user, flags.case_insensitive);
- debug(28, 8) ("Top is %p, Top->data is %s\n", Top,
- (char *) (Top != NULL ? (Top)->data : "Unavailable"));
+ debugs(28, 7, "aclMatchUser: user is " << user << ", case_insensitive is " << flags.case_insensitive);
+ debugs(28, 8, "Top is " << Top << ", Top->data is " << ((char *) (Top != NULL ? (Top)->data : "Unavailable")));
if (user == NULL || strcmp(user, "-") == 0)
return 0;
if (flags.required) {
- debug(28, 7) ("aclMatchUser: user REQUIRED and auth-info present.\n");
+ debugs(28, 7, "aclMatchUser: user REQUIRED and auth-info present.");
return 1;
}
Top = Top->splay((char *)user, splaystrcmp);
/* Top=splay_splay(user,Top,(splayNode::SPLAYCMP *)dumping_strcmp); */
- debug(28, 7) ("aclMatchUser: returning %d,Top is %p, Top->data is %s\n",
- !splayLastResult, Top, (char *) (Top ? Top->data : "Unavailable"));
+ debugs(28, 7, "aclMatchUser: returning " << !splayLastResult << ",Top is " <<
+ Top << ", Top->data is " << ((char *) (Top ? Top->data : "Unavailable")));
names = Top;
void
ACLUserData::parse()
{
- debug(28, 2) ("aclParseUserList: parsing user list\n");
+ debugs(28, 2, "aclParseUserList: parsing user list");
char *t = NULL;
if ((t = ConfigParser::strtokFile())) {
- debug(28, 5) ("aclParseUserList: First token is %s\n", t);
+ debugs(28, 5, "aclParseUserList: First token is " << t);
if (strcmp("-i", t) == 0) {
- debug(28, 5) ("aclParseUserList: Going case-insensitive\n");
+ debugs(28, 5, "aclParseUserList: Going case-insensitive");
flags.case_insensitive = 1;
} else if (strcmp("REQUIRED", t) == 0) {
- debug(28, 5) ("aclParseUserList: REQUIRED-type enabled\n");
+ debugs(28, 5, "aclParseUserList: REQUIRED-type enabled");
flags.required = 1;
} else {
if (flags.case_insensitive)
}
}
- debug(28, 3) ("aclParseUserList: Case-insensitive-switch is %d\n",
- flags.case_insensitive);
+ debugs(28, 3, "aclParseUserList: Case-insensitive-switch is " << flags.case_insensitive);
/* we might inherit from a previous declaration */
- debug(28, 4) ("aclParseUserList: parsing user list\n");
+ debugs(28, 4, "aclParseUserList: parsing user list");
while ((t = ConfigParser::strtokFile())) {
- debug(28, 6) ("aclParseUserList: Got token: %s\n", t);
+ debugs(28, 6, "aclParseUserList: Got token: " << t);
if (flags.case_insensitive)
Tolower(t);
/*
- * $Id: AuthConfig.cc,v 1.2 2006/05/29 00:14:59 robertc Exp $
+ * $Id: AuthConfig.cc,v 1.3 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 29 Authenticator
* AUTHOR: Robert Collins
AuthConfig::CreateAuthUser(const char *proxy_auth)
{
assert(proxy_auth != NULL);
- debug(29, 9) ("AuthConfig::CreateAuthUser: header = '%s'\n", proxy_auth);
+ debugs(29, 9, "AuthConfig::CreateAuthUser: header = '" << proxy_auth << "'");
AuthConfig *config = Find(proxy_auth);
if (config == NULL || !config->active()) {
- debug(29, 1) ("AuthConfig::CreateAuthUser: Unsupported or unconfigured/inactive proxy-auth scheme, '%s'\n", proxy_auth);
+ debugs(29, 1, "AuthConfig::CreateAuthUser: Unsupported or unconfigured/inactive proxy-auth scheme, '" << proxy_auth << "'");
return NULL;
}
/*
- * $Id: AuthUser.cc,v 1.3 2007/01/03 12:40:41 hno Exp $
+ * $Id: AuthUser.cc,v 1.4 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 29 Authenticator
* AUTHOR: Robert Collins
proxy_match_cache.head = proxy_match_cache.tail = NULL;
ip_list.head = ip_list.tail = NULL;
requests.head = requests.tail = NULL;
- debug(29, 5) ("AuthUser::AuthUser: Initialised auth_user '%p' with refcount '%ld'.\n", this, (long int) references);
+ debugs(29, 5, "AuthUser::AuthUser: Initialised auth_user '" << this << "' with refcount '" << (long int) references << "'.");
}
/* Combine two user structs. ONLY to be called from within a scheme
* in hash references too and ask the module to merge in scheme
* data
*/
- debug(29, 5) ("authenticateAuthUserMerge auth_user '%p' into auth_user '%p'.\n", from, this);
+ debugs(29, 5, "authenticateAuthUserMerge auth_user '" << from << "' into auth_user '" << this << "'.");
dlink_node *link = from->requests.head;
while (link) {
{
auth_user_request_t *auth_user_request;
dlink_node *link, *tmplink;
- debug(29, 5) ("AuthUser::~AuthUser: Freeing auth_user '%p' with refcount '%ld'.\n", this, (long int) references);
+ debugs(29, 5, "AuthUser::~AuthUser: Freeing auth_user '" << this << "' with refcount '" << (long int) references << "'.");
assert(references == 0);
/* were they linked in by username ? */
if (usernamehash) {
assert(usernamehash->user() == this);
- debug(29, 5) ("AuthUser::~AuthUser: removing usernamehash entry '%p'\n", usernamehash);
+ debugs(29, 5, "AuthUser::~AuthUser: removing usernamehash entry '" << usernamehash << "'");
hash_remove_link(proxy_auth_username_cache,
(hash_link *) usernamehash);
/* don't free the key as we use the same user string as the auth_user
link = requests.head;
while (link) {
- debug(29, 5) ("AuthUser::~AuthUser: removing request entry '%p'\n", link->data);
+ debugs(29, 5, "AuthUser::~AuthUser: removing request entry '" << link->data << "'");
auth_user_request = static_cast<auth_user_request_t *>(link->data);
tmplink = link;
link = link->next;
AuthUserHashPointer *usernamehash;
auth_user_t *auth_user;
char const *username = NULL;
- debug(29, 3) ("AuthUser::CachedACLsReset: Flushing the ACL caches for all users.\n");
+ debugs(29, 3, "AuthUser::CachedACLsReset: Flushing the ACL caches for all users.");
hash_first(proxy_auth_username_cache);
while ((usernamehash = ((AuthUserHashPointer *) hash_next(proxy_auth_username_cache)))) {
}
- debug(29, 3) ("AuthUser::CachedACLsReset: Finished.\n");
+ debugs(29, 3, "AuthUser::CachedACLsReset: Finished.");
}
void
AuthUserHashPointer *usernamehash;
auth_user_t *auth_user;
char const *username = NULL;
- debug(29, 3) ("AuthUser::cacheCleanup: Cleaning the user cache now\n");
- debug(29, 3) ("AuthUser::cacheCleanup: Current time: %ld\n", (long int) current_time.tv_sec);
+ debugs(29, 3, "AuthUser::cacheCleanup: Cleaning the user cache now");
+ debugs(29, 3, "AuthUser::cacheCleanup: Current time: " << (long int) current_time.tv_sec);
hash_first(proxy_auth_username_cache);
while ((usernamehash = ((AuthUserHashPointer *) hash_next(proxy_auth_username_cache)))) {
/* if we need to have inpedendent expiry clauses, insert a module call
* here */
- debug(29, 4) ("AuthUser::cacheCleanup: Cache entry:\n\tType: %d\n\tUsername: %s\n\texpires: %ld\n\treferences: %ld\n", auth_user->auth_type, username, (long int) (auth_user->expiretime + Config.authenticateTTL), (long int) auth_user->references);
+ debugs(29, 4, "AuthUser::cacheCleanup: Cache entry:\n\tType: " <<
+ auth_user->auth_type << "\n\tUsername: " << username <<
+ "\n\texpires: " <<
+ (long int) (auth_user->expiretime + Config.authenticateTTL) <<
+ "\n\treferences: " << (long int) auth_user->references);
if (auth_user->expiretime + Config.authenticateTTL <= current_time.tv_sec) {
- debug(29, 5) ("AuthUser::cacheCleanup: Removing user %s from cache due to timeout.\n", username);
+ debugs(29, 5, "AuthUser::cacheCleanup: Removing user " << username << " from cache due to timeout.");
/* the minus 1 accounts for the cache lock */
if (!(authenticateAuthUserInuse(auth_user) - 1))
}
}
- debug(29, 3) ("AuthUser::cacheCleanup: Finished cleaning the user cache.\n");
+ debugs(29, 3, "AuthUser::cacheCleanup: Finished cleaning the user cache.");
eventAdd("User Cache Maintenance", cacheCleanup, NULL, Config.authenticateGCInterval, 1);
}
ip1 = xstrdup(inet_ntoa(ipaddr));
- debug(29, 2) ("authenticateAuthUserAddIp: user '%s' has been seen at a new IP address (%s)\n", username(), ip1);
+ debugs(29, 2, "authenticateAuthUserAddIp: user '" << username() << "' has been seen at a new IP address (" << ip1 << ")");
safe_free(ip1);
}
void
AuthUser::lock()
{
- debug(29, 9) ("authenticateAuthUserLock auth_user '%p'.\n", this);
+ debugs(29, 9, "authenticateAuthUserLock auth_user '" << this << "'.");
assert(this != NULL);
references++;
- debug(29, 9) ("authenticateAuthUserLock auth_user '%p' now at '%ld'.\n", this, (long int) references);
+ debugs(29, 9, "authenticateAuthUserLock auth_user '" << this << "' now at '" << (long int) references << "'.");
}
void
AuthUser::unlock()
{
- debug(29, 9) ("authenticateAuthUserUnlock auth_user '%p'.\n", this);
+ debugs(29, 9, "authenticateAuthUserUnlock auth_user '" << this << "'.");
assert(this != NULL);
if (references > 0) {
references--;
} else {
- debug(29, 1) ("Attempt to lower Auth User %p refcount below 0!\n", this);
+ debugs(29, 1, "Attempt to lower Auth User " << this << " refcount below 0!");
}
- debug(29, 9) ("authenticateAuthUserUnlock auth_user '%p' now at '%ld'.\n", this, (long int) references);
+ debugs(29, 9, "authenticateAuthUserUnlock auth_user '" << this << "' now at '" << (long int) references << "'.");
if (references == 0)
delete this;
/*
- * $Id: AuthUserRequest.cc,v 1.12 2007/04/20 22:24:07 wessels Exp $
+ * $Id: AuthUserRequest.cc,v 1.13 2007/04/28 22:26:37 hno Exp $
*
* DO NOT MODIFY NEXT 2 LINES:
* arch-tag: 6803fde1-d5a2-4c29-9034-1c0c9f650eb4
AuthUserRequest::start(RH * handler, void *data)
{
assert(handler);
- debug(29, 9) ("authenticateStart: auth_user_request '%p'\n", this);
+ debugs(29, 9, "authenticateStart: auth_user_request '" << this << "'");
module_start(handler, data);
}
int
authenticateValidateUser(auth_user_request_t * auth_user_request)
{
- debug(29, 9) ("authenticateValidateUser: Validating Auth_user request '%p'.\n", auth_user_request);
+ debugs(29, 9, "authenticateValidateUser: Validating Auth_user request '" << auth_user_request << "'.");
if (auth_user_request == NULL) {
- debug(29, 4) ("authenticateValidateUser: Auth_user_request was NULL!\n");
+ debugs(29, 4, "authenticateValidateUser: Auth_user_request was NULL!");
return 0;
}
if (auth_user_request->user() == NULL) {
- debug(29, 4) ("authenticateValidateUser: No associated auth_user structure\n");
+ debugs(29, 4, "authenticateValidateUser: No associated auth_user structure");
return 0;
}
if (auth_user_request->user()->auth_type == AUTH_UNKNOWN) {
- debug(29, 4) ("authenticateValidateUser: Auth_user '%p' uses unknown scheme.\n", auth_user_request->user());
+ debugs(29, 4, "authenticateValidateUser: Auth_user '" << auth_user_request->user() << "' uses unknown scheme.");
return 0;
}
if (auth_user_request->user()->auth_type == AUTH_BROKEN) {
- debug(29, 4) ("authenticateValidateUser: Auth_user '%p' is broken for it's scheme.\n", auth_user_request->user());
+ debugs(29, 4, "authenticateValidateUser: Auth_user '" << auth_user_request->user() << "' is broken for it's scheme.");
return 0;
}
/* Thus should a module call to something like authValidate */
/* finally return ok */
- debug(29, 5) ("authenticateValidateUser: Validated Auth_user request '%p'.\n", auth_user_request);
+ debugs(29, 5, "authenticateValidateUser: Validated Auth_user request '" << auth_user_request << "'.");
return 1;
AuthUserRequest::AuthUserRequest():_auth_user(NULL), message(NULL),
references (0), lastReply (AUTH_ACL_CANNOT_AUTHENTICATE)
{
- debug(29, 5) ("AuthUserRequest::AuthUserRequest: initialised request %p\n", this);
+ debugs(29, 5, "AuthUserRequest::AuthUserRequest: initialised request " <<
+ this);
}
AuthUserRequest::~AuthUserRequest()
{
dlink_node *link;
- debug(29, 5) ("AuthUserRequest::~AuthUserRequest: freeing request %p\n", this);
+ debugs(29, 5, "AuthUserRequest::~AuthUserRequest: freeing request " <<
+ this);
assert(references == 0);
if (user()) {
|| (conn != NULL && conn->auth_type == AUTH_BROKEN))
{
/* no header or authentication failed/got corrupted - restart */
- debug(29, 4) ("authenticateAuthenticate: broken auth or no proxy_auth header. Requesting auth header.\n");
+ debugs(29, 4, "authenticateAuthenticate: broken auth or no proxy_auth header. Requesting auth header.");
/* something wrong with the AUTH credentials. Force a new attempt */
if (conn != NULL) {
conn->auth_user_request->connLastHeader() != NULL &&
strcmp(proxy_auth, conn->auth_user_request->connLastHeader()))
{
- debug(29, 2) ("authenticateAuthenticate: DUPLICATE AUTH - authentication header on already authenticated connection!. AU %p, Current user '%s' proxy_auth %s\n", conn->auth_user_request, conn->auth_user_request->username(), proxy_auth);
+ debugs(29, 2, "authenticateAuthenticate: DUPLICATE AUTH - authentication header on already authenticated connection!. AU " <<
+ conn->auth_user_request << ", Current user '" <<
+ conn->auth_user_request->username() << "' proxy_auth " <<
+ proxy_auth);
+
/* remove this request struct - the link is already authed and it can't be to
* reauth.
*/
/* we have a proxy auth header and as far as we know this connection has
* not had bungled connection oriented authentication happen on it. */
- debug(29, 9) ("authenticateAuthenticate: header %s.\n", proxy_auth ? proxy_auth : "-");
+ debugs(29, 9, "authenticateAuthenticate: header " << (proxy_auth ? proxy_auth : "-") << ".");
if (*auth_user_request == NULL)
{
- debug(29, 9) ("authenticateAuthenticate: This is a new checklist test on FD:%d\n",
- conn != NULL ? conn->fd : -1);
+ debugs(29, 9, "authenticateAuthenticate: This is a new checklist test on FD:" << (conn != NULL ? conn->fd : -1) );
if (proxy_auth && !request->auth_user_request && conn != NULL && conn->auth_user_request) {
AuthConfig * scheme = AuthConfig::Find(proxy_auth);
if (!conn->auth_user_request->user() || conn->auth_user_request->user()->config != scheme) {
- debug(29, 1) ("authenticateAuthenticate: Unexpected change of authentication scheme from '%s' to '%s' (client %s)\n",
- conn->auth_user_request->user()->config->type(), proxy_auth, inet_ntoa(src_addr));
+ debugs(29, 1, "authenticateAuthenticate: Unexpected change of authentication scheme from '" <<
+ conn->auth_user_request->user()->config->type() <<
+ "' to '" << proxy_auth << "' (client " <<
+ inet_ntoa(src_addr) << ")");
+
conn->auth_user_request->unlock();
conn->auth_user_request = NULL;
conn->auth_type = AUTH_UNKNOWN;
if ((!request->auth_user_request)
&& (conn == NULL || conn->auth_type == AUTH_UNKNOWN)) {
/* beginning of a new request check */
- debug(29, 4) ("authenticateAuthenticate: no connection authentication type\n");
+ debugs(29, 4, "authenticateAuthenticate: no connection authentication type");
if (!authenticateValidateUser(*auth_user_request =
AuthConfig::CreateAuthUser(proxy_auth))) {
;
} else {
/* failed connection based authentication */
- debug(29, 4) ("authenticateAuthenticate: Auth user request %p conn-auth user request %p conn type %d authentication failed.\n",
- *auth_user_request, conn->auth_user_request, conn->auth_type);
+ debugs(29, 4, "authenticateAuthenticate: Auth user request " <<
+ *auth_user_request << " conn-auth user request " <<
+ conn->auth_user_request << " conn type " <<
+ conn->auth_type << " authentication failed.");
+
(*auth_user_request)->unlock();
*auth_user_request = NULL;
return AUTH_ACL_CHALLENGE;
break;
}
- debug(29, 9) ("authenticateFixHeader: headertype:%d authuser:%p\n", type, auth_user_request);
+ debugs(29, 9, "authenticateFixHeader: headertype:" << type << " authuser:" << auth_user_request);
if (((rep->sline.status == HTTP_PROXY_AUTHENTICATION_REQUIRED)
|| (rep->sline.status == HTTP_UNAUTHORIZED)) && internal)
if (scheme->active())
scheme->fixHeader(NULL, rep, type, request);
else
- debug(29, 4) ("authenticateFixHeader: Configured scheme %s not Active\n", scheme->type());
+ debugs(29, 4, "authenticateFixHeader: Configured scheme " << scheme->type() << " not Active");
}
}
AuthUserRequest::lock()
{
- debug(29, 9) ("AuthUserRequest::lock: auth_user request '%p' (%ld references).\n", this, (long int) references);
+ debugs(29, 9, "AuthUserRequest::lock: auth_user request '" << this << "' (" << (long int) references << " references).");
assert(this);
++references;
}
void
AuthUserRequest::unlock()
{
- debug(29, 9) ("AuthUserRequest::unlock: auth_user request '%p' (%ld references) .\n", this, (long int) references);
+ debugs(29, 9, "AuthUserRequest::unlock: auth_user request '" << this << "' (" << (long int) references << " references) .");
assert(this != NULL);
if (references > 0) {
--references;
} else {
- debug(29, 1) ("Attempt to lower Auth User request %p refcount below 0!\n", this);
+ debugs(29, 1, "Attempt to lower Auth User request " << this << " refcount below 0!");
}
if (references == 0) {
- debug(29, 9) ("AuthUserRequest::unlock: deleting auth_user_request '%p'.\n", this);
+ debugs(29, 9, "AuthUserRequest::unlock: deleting auth_user_request '" << this << "'.");
/* not locked anymore */
delete this;
}
/*
- * $Id: CacheDigest.cc,v 1.38 2003/07/07 22:48:22 robertc Exp $
+ * $Id: CacheDigest.cc,v 1.39 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 70 Cache Digest
* AUTHOR: Alex Rousskov
hashed_keys[1] = htonl(tmp_keys[1]) % bit_count;
hashed_keys[2] = htonl(tmp_keys[2]) % bit_count;
hashed_keys[3] = htonl(tmp_keys[3]) % bit_count;
- debug(70, 9) ("cacheDigestHashKey: %s -(%d)-> %d %d %d %d\n",
- storeKeyText(key), bit_count,
- hashed_keys[0], hashed_keys[1], hashed_keys[2], hashed_keys[3]);
+ debugs(70, 9, "cacheDigestHashKey: " << storeKeyText(key) << " -(" <<
+ bit_count << ")-> " << hashed_keys[0] << " " << hashed_keys[1] <<
+ " " << hashed_keys[2] << " " << hashed_keys[3]);
}
#endif
/*
- * $Id: ConfigParser.cc,v 1.2 2006/04/25 12:00:29 robertc Exp $
+ * $Id: ConfigParser.cc,v 1.3 2007/04/28 22:26:37 hno Exp $
*
*
* SQUID Web Proxy Cache http://www.squid-cache.org/
*t = '\0';
if ((wordFile = fopen(fn, "r")) == NULL) {
- debug(28, 0) ("strtokFile: %s not found\n", fn);
+ debugs(28, 0, "strtokFile: " << fn << " not found");
return (NULL);
}
/*
- * $Id: Debug.h,v 1.8 2005/12/19 22:00:47 wessels Exp $
+ * $Id: Debug.h,v 1.9 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 0 Debug Routines
* AUTHOR: Harvest Derived
#include <iostream>
#undef assert
#include <sstream>
+#include <iomanip>
#if defined assert
#undef assert
#endif
/*
- * $Id: DelayConfig.cc,v 1.7 2006/04/25 12:00:29 robertc Exp $
+ * $Id: DelayConfig.cc,v 1.8 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 77 Delay Pools
* AUTHOR: Robert Collins <robertc@squid-cache.org>
ConfigParser::ParseUShort(&pool);
if (pool < 1 || pool > DelayPools::pools()) {
- debug(3, 0) ("parse_delay_pool_class: Ignoring pool %d not in 1 .. %d\n", pool, DelayPools::pools());
+ debugs(3, 0, "parse_delay_pool_class: Ignoring pool " << pool << " not in 1 .. " << DelayPools::pools());
return;
}
ConfigParser::ParseUShort(&delay_class_);
if (delay_class_ < 1 || delay_class_ > 5) {
- debug(3, 0) ("parse_delay_pool_class: Ignoring pool %d class %d not in 1 .. 5\n", pool, delay_class_);
+ debugs(3, 0, "parse_delay_pool_class: Ignoring pool " << pool << " class " << delay_class_ << " not in 1 .. 5");
return;
}
ConfigParser::ParseUShort(&pool);
if (pool < 1 || pool > DelayPools::pools()) {
- debug(3, 0) ("parse_delay_pool_rates: Ignoring pool %d not in 1 .. %d\n", pool, DelayPools::pools());
+ debugs(3, 0, "parse_delay_pool_rates: Ignoring pool " << pool << " not in 1 .. " << DelayPools::pools());
return;
}
pool--;
if (!DelayPools::delay_data[pool].theComposite().getRaw()) {
- debug(3, 0) ("parse_delay_pool_rates: Ignoring pool %d attempt to set rates with class not set\n", pool + 1);
+ debugs(3, 0, "parse_delay_pool_rates: Ignoring pool " << pool + 1 << " attempt to set rates with class not set");
return;
}
ConfigParser::ParseUShort(&pool);
if (pool < 1 || pool > DelayPools::pools()) {
- debug(3, 0) ("parse_delay_pool_rates: Ignoring pool %d not in 1 .. %d\n", pool, DelayPools::pools());
+ debugs(3, 0, "parse_delay_pool_rates: Ignoring pool " << pool << " not in 1 .. " << DelayPools::pools());
return;
}
/*
- * $Id: DelayId.cc,v 1.20 2007/04/20 22:24:07 wessels Exp $
+ * $Id: DelayId.cc,v 1.21 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 77 Delay Pools
* AUTHOR: Robert Collins <robertc@squid-cache.org>
DelayId::DelayId (unsigned short aPool) :
pool_ (aPool), compositeId (NULL), markedAsNoDelay (false)
{
- debug (77,3)("DelayId::DelayId: Pool %du\n", aPool);
+ debugs(77, 3, "DelayId::DelayId: Pool " << aPool << "u");
}
DelayId::~DelayId ()
r = http->request;
if (r->client_addr.s_addr == INADDR_BROADCAST) {
- debug(77, 2) ("delayClient: WARNING: Called with 'allones' address, ignoring\n");
+ debugs(77, 2, "delayClient: WARNING: Called with 'allones' address, ignoring");
return DelayId();
}
/*
- * $Id: DelayTagged.cc,v 1.4 2003/08/04 22:14:40 robertc Exp $
+ * $Id: DelayTagged.cc,v 1.5 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 77 Delay Pools
* AUTHOR: Robert Collins <robertc@squid-cache.org>
DelayTaggedBucket::DelayTaggedBucket(String &aTag) : tag (aTag)
{
- debug (77,3) ("DelayTaggedBucket::DelayTaggedBucket\n");
+ debugs(77, 3, "DelayTaggedBucket::DelayTaggedBucket");
}
DelayTaggedBucket::~DelayTaggedBucket()
{
- debug (77,3) ("DelayTaggedBucket::~DelayTaggedBucket\n");
+ debugs(77, 3, "DelayTaggedBucket::~DelayTaggedBucket");
}
void
DelayTagged::Id::~Id()
{
- debug (77,3) ("DelayTagged::Id::~Id\n");
+ debugs(77, 3, "DelayTagged::Id::~Id");
}
int
/*
- * $Id: DelayUser.cc,v 1.7 2004/08/30 03:28:56 robertc Exp $
+ * $Id: DelayUser.cc,v 1.8 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 77 Delay Pools
* AUTHOR: Robert Collins <robertc@squid-cache.org>
DelayUserBucket::DelayUserBucket(AuthUser *aUser) : authUser (aUser)
{
- debug (77,3) ("DelayUserBucket::DelayUserBucket\n");
+ debugs(77, 3, "DelayUserBucket::DelayUserBucket");
authUser->lock()
DelayUserBucket::~DelayUserBucket()
{
authUser->unlock();
- debug (77,3) ("DelayUserBucket::~DelayUserBucket\n");
+ debugs(77, 3, "DelayUserBucket::~DelayUserBucket");
}
void
DelayUser::Id::~Id()
{
- debug (77,3) ("DelayUser::Id::~Id\n");
+ debugs(77, 3, "DelayUser::Id::~Id");
}
int
/*
- * $Id: DelayVector.cc,v 1.9 2003/08/04 22:14:40 robertc Exp $
+ * $Id: DelayVector.cc,v 1.10 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 77 Delay Pools
* AUTHOR: Robert Collins <robertc@squid-cache.org>
DelayVector::Id::Id(DelayVector::Pointer aDelayVector, CompositeSelectionDetails &details) : theVector(aDelayVector)
{
- debug(77,3)("DelayVector::Id::Id\n");
+ debugs(77, 3, "DelayVector::Id::Id");
DelayVector::iterator pos = theVector->pools.begin();
while (pos != theVector->pools.end()) {
DelayVector::Id::~Id()
{
- debug(77,3)("DelayVector::Id::~Id\n");
+ debugs(77, 3, "DelayVector::Id::~Id");
}
int
/*
- * $Id: AIODiskFile.cc,v 1.3 2006/09/04 20:15:22 serassio Exp $
+ * $Id: AIODiskFile.cc,v 1.4 2007/04/28 22:26:40 hno Exp $
*
* SQUID Web Proxy Cache http://www.squid-cache.org/
* ----------------------------------------------------------
assert (aPath);
path = aPath;
strategy = aStrategy;
- debug (79,3)("AIODiskFile::AIODiskFile: %s\n", aPath);
+ debugs(79, 3, "AIODiskFile::AIODiskFile: " << aPath);
}
AIODiskFile::~AIODiskFile()
ioRequestor = callback;
if (fd < 0) {
- debug(79, 3) ("BlockingFile::open: got failure (%d)\n", errno);
+ debugs(79, 3, "BlockingFile::open: got failure (" << errno << ")");
error(true);
} else {
closed = false;
store_open_disk_fd++;
- debug(79, 3) ("BlockingFile::open: opened FD %d\n", fd);
+ debugs(79, 3, "BlockingFile::open: opened FD " << fd);
}
callback->ioCompletedNotification();
if (slot < 0) {
/* No free slot? Callback error, and return */
fatal("Aiee! out of aiocb slots! - FIXME and wrap file_read\n");
- debug(79, 1) ("WARNING: out of aiocb slots!\n");
+ debugs(79, 1, "WARNING: out of aiocb slots!");
/* fall back to blocking method */
// file_read(fd, request->buf, request->len, request->offset, callback, data);
return;
/* Initiate aio */
if (aio_read(&qe->aq_e_aiocb) < 0) {
fatalf("Aiee! aio_read() returned error (%d) FIXME and wrap file_read !\n", errno);
- debug(79, 1) ("WARNING: aio_read() returned error: %s\n", xstrerror());
+ debugs(79, 1, "WARNING: aio_read() returned error: " << xstrerror());
/* fall back to blocking method */
// file_read(fd, request->buf, request->len, request->offset, callback, data);
}
if (slot < 0) {
/* No free slot? Callback error, and return */
fatal("Aiee! out of aiocb slots FIXME and wrap file_write !\n");
- debug(79, 1) ("WARNING: out of aiocb slots!\n");
+ debugs(79, 1, "WARNING: out of aiocb slots!");
/* fall back to blocking method */
// file_write(fd, offset, buf, len, callback, data, freefunc);
return;
/* Initiate aio */
if (aio_write(&qe->aq_e_aiocb) < 0) {
fatalf("Aiee! aio_write() returned error (%d) FIXME and wrap file_write !\n", errno);
- debug(79, 1) ("WARNING: aio_write() returned error: %s\n", xstrerror());
+ debugs(79, 1, "WARNING: aio_write() returned error: " << xstrerror());
/* fall back to blocking method */
// file_write(fd, offset, buf, len, callback, data, freefunc);
}
/*
- * $Id: aio_win32.cc,v 1.2 2006/09/09 15:29:59 serassio Exp $
+ * $Id: aio_win32.cc,v 1.3 2007/04/28 22:26:40 hno Exp $
*
* DEBUG: section 81 aio_xxx() POSIX emulation on Windows
* AUTHOR: Guido Serassio <serassio@squid-cache.org>
aiocbp->aio_sigevent.sigev_notify = dwErrorCode;
aiocbp->aio_sigevent.sigev_signo = dwNumberOfBytesTransfered;
- debug(81,7) ("AIO operation complete: errorcode=%ld nbytes=%ld\n", dwErrorCode, dwNumberOfBytesTransfered);
+ debugs(81, 7, "AIO operation complete: errorcode=" << dwErrorCode << " nbytes=" << dwNumberOfBytesTransfered);
xfree(lpOverlapped);
}
if (!IoOperationStatus)
{
errno = GetLastError();
- debug(81,1) ("aio_read: GetLastError=%i\n", errno);
+ debugs(81,1, "aio_read: GetLastError=" << errno );
return -1;
}
if (!IoOperationStatus)
{
errno = GetLastError();
- debug(81,1) ("aio_read: GetLastError=%i\n", errno);
+ debugs(81, 1, "aio_read: GetLastError=" << errno );
return -1;
}
if (!IoOperationStatus)
{
errno = GetLastError();
- debug(81,1) ("aio_write: GetLastError=%i\n", errno);
+ debugs(81, 1, "aio_write: GetLastError=" << errno );
return -1;
}
if (!IoOperationStatus)
{
errno = GetLastError();
- debug(81,1) ("aio_write: GetLastError=%i\n", errno);
+ debugs(81, 1, "aio_write: GetLastError=" << errno );
return -1;
}
/*
- * $Id: BlockingFile.cc,v 1.2 2004/12/21 17:28:29 robertc Exp $
+ * $Id: BlockingFile.cc,v 1.3 2007/04/28 22:26:44 hno Exp $
*
* DEBUG: section 47 Store Directory Routines
* AUTHOR: Robert Collins
BlockingFile::BlockingFile (char const *aPath) : fd (-1), closed (true), error_(false)
{
assert (aPath);
- debug (79,3)("BlockingFile::BlockingFile: %s\n", aPath);
+ debugs(79, 3, "BlockingFile::BlockingFile: " << aPath);
path_ = xstrdup (aPath);
}
ioRequestor = callback;
if (fd < 0) {
- debug(79, 3) ("BlockingFile::open: got failure (%d)\n", errno);
+ debugs(79, 3, "BlockingFile::open: got failure (" << errno << ")");
error(true);
} else {
closed = false;
store_open_disk_fd++;
- debug(79, 3) ("BlockingFile::open: opened FD %d\n", fd);
+ debugs(79, 3, "BlockingFile::open: opened FD " << fd);
}
callback->ioCompletedNotification();
void
BlockingFile::close ()
{
- debug (79,3)("BlockingFile::close: %p closing for %p\n", this, ioRequestor.getRaw());
+ debugs(79, 3, "BlockingFile::close: " << this << " closing for " << ioRequestor.getRaw());
doClose();
assert (ioRequestor.getRaw());
ioRequestor->closeCompleted();
void
BlockingFile::write(WriteRequest *aRequest)
{
- debug(79, 3) ("storeUfsWrite: FD %d\n",fd);
+ debugs(79, 3, "storeUfsWrite: FD " << fd);
writeRequest = aRequest;
file_write(fd,
aRequest->offset,
void
BlockingFile::readDone(int rvfd, const char *buf, int len, int errflag)
{
- debug (79,3)("BlockingFile::readDone: FD %d\n",rvfd);
+ debugs(79, 3, "BlockingFile::readDone: FD " << rvfd);
assert (fd == rvfd);
ssize_t rlen;
if (errflag) {
- debug(79, 3) ("BlockingFile::readDone: got failure (%d)\n", errflag);
+ debugs(79, 3, "BlockingFile::readDone: got failure (" << errflag << ")");
rlen = -1;
} else {
rlen = (ssize_t) len;
BlockingFile::writeDone(int rvfd, int errflag, size_t len)
{
assert (rvfd == fd);
- debug(79, 3) ("storeUfsWriteDone: FD %d, len %ld\n",
- fd, (long int) len);
+ debugs(79, 3, "storeUfsWriteDone: FD " << fd << ", len " << (long int) len);
WriteRequest::Pointer result = writeRequest;
writeRequest = NULL;
if (errflag) {
- debug(79, 0) ("storeUfsWriteDone: got failure (%d)\n", errflag);
+ debugs(79, 0, "storeUfsWriteDone: got failure (" << errflag << ")");
doClose();
ioRequestor->writeCompleted (DISK_ERROR,0, result);
return;
/*
- * $Id: DiskdFile.cc,v 1.2 2004/12/21 17:28:29 robertc Exp $
+ * $Id: DiskdFile.cc,v 1.3 2007/04/28 22:26:45 hno Exp $
*
* DEBUG: section 79 Squid-side DISKD I/O functions.
* AUTHOR: Duane Wessels
DiskdFile *result = cbdataAlloc(DiskdFile);
/* Mark result as being owned - we want the refcounter to do the delete
* call */
- debug (79,3)("diskdFile with base %p allocating\n", result);
+ debugs(79, 3, "diskdFile with base " << result << " allocating");
return result;
}
DiskdFile::operator delete (void *address)
{
DiskdFile *t = static_cast<DiskdFile *>(address);
- debug (79,3)("diskdFile with base %p deleting\n",t);
+ debugs(79, 3, "diskdFile with base " << t << " deleting");
cbdataFree(t);
}
inProgressIOs (0)
{
assert (aPath);
- debug (79,3)("DiskdFile::DiskdFile: %s\n", aPath);
+ debugs(79, 3, "DiskdFile::DiskdFile: " << aPath);
path_ = xstrdup (aPath);
id = diskd_stats.sio_id++;
}
void
DiskdFile::open (int flags, mode_t aMode, IORequestor::Pointer callback)
{
- debug (79,3)("DiskdFile::open: %p opening for %p\n", this, callback.getRaw());
+ debugs(79, 3, "DiskdFile::open: " << this << " opening for " << callback.getRaw());
assert (ioRequestor.getRaw() == NULL);
ioRequestor = callback;
assert (callback.getRaw());
void
DiskdFile::create (int flags, mode_t aMode, IORequestor::Pointer callback)
{
- debug (79,3)("DiskdFile::create: %p creating for %p\n", this, callback.getRaw());
+ debugs(79, 3, "DiskdFile::create: " << this << " creating for " << callback.getRaw());
assert (ioRequestor.getRaw() == NULL);
ioRequestor = callback;
assert (callback.getRaw());
ioCompleted();
errorOccured = true;
// IO->shm.put (shm_offset);
- debug(79, 1) ("storeDiskdSend CREATE: %s\n", xstrerror());
+ debugs(79, 1, "storeDiskdSend CREATE: " << xstrerror());
notifyClient();
ioRequestor = NULL;
return;
ioCompleted();
errorOccured = true;
// IO->shm.put (shm_offset);
- debug(79, 1) ("storeDiskdSend READ: %s\n", xstrerror());
+ debugs(79, 1, "storeDiskdSend READ: " << xstrerror());
notifyClient();
ioRequestor = NULL;
return;
void
DiskdFile::close()
{
- debug (79,3)("DiskdFile::close: %p closing for %p\n", this, ioRequestor.getRaw());
+ debugs(79, 3, "DiskdFile::close: " << this << " closing for " << ioRequestor.getRaw());
assert (ioRequestor.getRaw());
ioAway();
int x = IO->send(_MQD_CLOSE,
if (x < 0) {
ioCompleted();
errorOccured = true;
- debug(79, 1) ("storeDiskdSend CLOSE: %s\n", xstrerror());
+ debugs(79, 1, "storeDiskdSend CLOSE: " << xstrerror());
notifyClient();
ioRequestor = NULL;
return;
DiskdFile::canNotifyClient() const
{
if (!ioRequestor.getRaw()) {
- debug (79,3)("DiskdFile::canNotifyClient: No ioRequestor to notify\n");
+ debugs(79, 3, "DiskdFile::canNotifyClient: No ioRequestor to notify");
return false;
}
DiskdFile::openDone(diomsg *M)
{
statCounter.syscalls.disk.opens++;
- debug(79, 3) ("storeDiskdOpenDone: status %d\n", M->status);
+ debugs(79, 3, "storeDiskdOpenDone: status " << M->status);
if (M->status < 0) {
diskd_stats.open.fail++;
DiskdFile::createDone(diomsg *M)
{
statCounter.syscalls.disk.opens++;
- debug(79, 3) ("storeDiskdCreateDone: status %d\n", M->status);
+ debugs(79, 3, "storeDiskdCreateDone: status " << M->status);
if (M->status < 0) {
diskd_stats.create.fail++;
ioCompleted()
;
errorOccured = true;
- debug(79, 1) ("storeDiskdSend WRITE: %s\n", xstrerror());
+ debugs(79, 1, "storeDiskdSend WRITE: " << xstrerror());
// IO->shm.put (shm_offset);
notifyClient();
ioRequestor = NULL;
DiskdFile::closeDone(diomsg * M)
{
statCounter.syscalls.disk.closes++;
- debug(79, 3) ("DiskdFile::closeDone: status %d\n", M->status);
+ debugs(79, 3, "DiskdFile::closeDone: status " << M->status);
if (M->status < 0) {
diskd_stats.close.fail++;
DiskdFile::readDone(diomsg * M)
{
statCounter.syscalls.disk.reads++;
- debug(79, 3) ("DiskdFile::readDone: status %d\n", M->status);
+ debugs(79, 3, "DiskdFile::readDone: status " << M->status);
assert (M->requestor);
ReadRequest::Pointer readRequest = dynamic_cast<ReadRequest *>(M->requestor);
/* remove the free protection */
DiskdFile::writeDone(diomsg *M)
{
statCounter.syscalls.disk.writes++;
- debug(79, 3) ("storeDiskdWriteDone: status %d\n", M->status);
+ debugs(79, 3, "storeDiskdWriteDone: status " << M->status);
assert (M->requestor);
WriteRequest::Pointer writeRequest = dynamic_cast<WriteRequest *>(M->requestor);
/* remove the free protection */
/*
- * $Id: DiskdIOStrategy.cc,v 1.9 2007/04/12 23:51:57 wessels Exp $
+ * $Id: DiskdIOStrategy.cc,v 1.10 2007/04/28 22:26:45 hno Exp $
*
* DEBUG: section 79 Squid-side DISKD I/O functions.
* AUTHOR: Duane Wessels
*/
if (away > magic1) {
- debug(79, 3) ("storeDiskdIO::shedLoad: Shedding, too many requests away\n");
+ debugs(79, 3, "storeDiskdIO::shedLoad: Shedding, too many requests away");
return true;
}
{
if (shedLoad()) {
/* Damn, we need to issue a sync unlink here :( */
- debug(79, 2) ("storeDiskUnlink: Out of queue space, sync unlink\n");
+ debugs(79, 2, "storeDiskUnlink: Out of queue space, sync unlink");
#if USE_UNLINKD
unlinkdUnlink(path);
shm_offset);
if (x < 0) {
- debug(79, 1) ("storeDiskdSend UNLINK: %s\n", xstrerror());
+ debugs(79, 1, "storeDiskdSend UNLINK: " << xstrerror());
::unlink(buf); /* XXX EWW! */
// shm.put (shm_offset);
}
smsgid = msgget((key_t) ikey, 0700 | IPC_CREAT);
if (smsgid < 0) {
- debug(50, 0) ("storeDiskdInit: msgget: %s\n", xstrerror());
+ debugs(50, 0, "storeDiskdInit: msgget: " << xstrerror());
fatal("msgget failed");
}
rmsgid = msgget((key_t) (ikey + 1), 0700 | IPC_CREAT);
if (rmsgid < 0) {
- debug(50, 0) ("storeDiskdInit: msgget: %s\n", xstrerror());
+ debugs(50, 0, "storeDiskdInit: msgget: " << xstrerror());
fatal("msgget failed");
}
nbufs * SHMBUF_BLKSZ, 0600 | IPC_CREAT);
if (id < 0) {
- debug(50, 0) ("storeDiskdInit: shmget: %s\n", xstrerror());
+ debugs(50, 0, "storeDiskdInit: shmget: " << xstrerror());
fatal("shmget failed");
}
buf = (char *)shmat(id, NULL, 0);
if (buf == (void *) -1) {
- debug(50, 0) ("storeDiskdInit: shmat: %s\n", xstrerror());
+ debugs(50, 0, "storeDiskdInit: shmat: " << xstrerror());
fatal("shmat failed");
}
void
DiskdIOStrategy::unlinkDone(diomsg * M)
{
- debug(79, 3) ("storeDiskdUnlinkDone: file %s status %d\n",shm.buf + M->shm_offset,
- M->status);
+ debugs(79, 3, "storeDiskdUnlinkDone: file " << shm.buf + M->shm_offset << " status " << M->status);
statCounter.syscalls.disk.unlinks++;
if (M->status < 0)
* - say when we have a error opening after
* a read was already queued
*/
- debug(79, 3) ("storeDiskdHandle: Invalid callback_data %p\n",
- M->callback_data);
+ debugs(79, 3, "storeDiskdHandle: Invalid callback_data " << M->callback_data);
cbdataReferenceDone (M->callback_data);
return;
}
M->seq_no = ++seq_no;
if (M->seq_no < last_seq_no)
- debug(79, 1) ("WARNING: sequencing out of order\n");
+ debugs(79, 1, "WARNING: sequencing out of order");
x = msgsnd(smsgid, M, diomsg::msg_snd_rcv_sz, IPC_NOWAIT);
diskd_stats.sent_count++;
away++;
} else {
- debug(79, 1) ("storeDiskdSend: msgsnd: %s\n", xstrerror());
+ debugs(79, 1, "storeDiskdSend: msgsnd: " << xstrerror());
cbdataReferenceDone(M->callback_data);
assert(++send_errors < 100);
if (shm_offset > -1)
* will cause an assertion in storeDiskdShmGet().
*/
/* TODO: have DiskdIO hold a link to the swapdir, to allow detailed reporting again */
- debug(3, 1) ("WARNING: cannot increase cache_dir Q1 value while Squid is running.\n");
+ debugs(3, 1, "WARNING: cannot increase cache_dir Q1 value while Squid is running.");
magic1 = old_magic1;
return true;
}
if (old_magic1 != magic1)
- debug(3, 1) ("cache_dir new Q1 value '%d'\n",
- magic1);
+ debugs(3, 1, "cache_dir new Q1 value '" << magic1 << "'");
return true;
}
if (old_magic2 < magic2) {
/* See comments in Q1 function above */
- debug(3, 1) ("WARNING: cannot increase cache_dir Q2 value while Squid is running.\n");
+ debugs(3, 1, "WARNING: cannot increase cache_dir Q2 value while Squid is running.");
magic2 = old_magic2;
return true;
}
if (old_magic2 != magic2)
- debug(3, 1) ("cache_dir new Q2 value '%d'\n",
- magic2);
+ debugs(3, 1, "cache_dir new Q2 value '" << magic2 << "'");
return true;
}
while (away > 0) {
if (squid_curtime > lastmsg) {
- debug(47, 1) ("storeDiskdDirSync: %d messages away\n",
- away);
+ debugs(47, 1, "storeDiskdDirSync: " << away << " messages away");
lastmsg = squid_curtime;
}
if (x < 0)
break;
else if (x != diomsg::msg_snd_rcv_sz) {
- debug(47, 1) ("storeDiskdDirCallback: msgget returns %d\n",
- x);
+ debugs(47, 1, "storeDiskdDirCallback: msgget returns " << x);
break;
}
/*
- * $Id: DiskThreadsDiskFile.cc,v 1.8 2006/06/17 16:36:15 serassio Exp $
+ * $Id: DiskThreadsDiskFile.cc,v 1.9 2007/04/28 22:26:47 hno Exp $
*
* DEBUG: section 79 Disk IO Routines
* AUTHOR: Robert Collins
inProgressIOs (0)
{
assert (aPath);
- debug (79,3)("UFSFile::UFSFile: %s\n", aPath);
+ debugs(79, 3, "UFSFile::UFSFile: " << aPath);
path_ = xstrdup (aPath);
}
fd = file_open(path_, flags);
if (fd < 0) {
- debug(79, 3) ("DiskThreadsDiskFile::open: got failure (%d)\n", errno);
+ debugs(79, 3, "DiskThreadsDiskFile::open: got failure (" << errno << ")");
errorOccured = true;
return;
}
int fd = file_open(path_, flags);
if (fd < 0) {
- debug(79, 3) ("DiskThreadsDiskFile::create: got failure (%d)\n", errno);
+ debugs(79, 3, "DiskThreadsDiskFile::create: got failure (" << errno << ")");
errorOccured = true;
return;
}
void
DiskThreadsDiskFile::openDone(int unused, const char *unused2, int anFD, int errflag)
{
- debug(79, 3) ("DiskThreadsDiskFile::openDone: FD %d, errflag %d\n", anFD, errflag);
+ debugs(79, 3, "DiskThreadsDiskFile::openDone: FD " << anFD << ", errflag " << errflag);
Opening_FD--;
fd = anFD;
if (errflag || fd < 0) {
errno = errflag;
- debug(79, 0) ("DiskThreadsDiskFile::openDone: %s\n", xstrerror());
- debug(79, 1) ("\t%s\n", path_);
+ debugs(79, 0, "DiskThreadsDiskFile::openDone: " << xstrerror());
+ debugs(79, 1, "\t" << path_);
errorOccured = true;
} else {
store_open_disk_fd++;
--inProgressIOs;
t->ioCompletedNotification();
- debug(79, 3) ("DiskThreadsDiskFile::openDone: exiting\n");
+ debugs(79, 3, "DiskThreadsDiskFile::openDone: exiting");
}
void DiskThreadsDiskFile::doClose()
void
DiskThreadsDiskFile::close ()
{
- debug (79,3)("DiskThreadsDiskFile::close: %p closing for %p\n", this, ioRequestor.getRaw());
+ debugs(79, 3, "DiskThreadsDiskFile::close: " << this << " closing for " << ioRequestor.getRaw());
if (!ioInProgress()) {
doClose();
bool
DiskThreadsDiskFile::canRead() const
{
- debug (79,3)("DiskThreadsDiskFile::canRead: fd is %d\n",fd);
+ debugs(79, 3, "DiskThreadsDiskFile::canRead: fd is " << fd);
return fd > -1;
}
void
DiskThreadsDiskFile::write(WriteRequest * writeRequest)
{
- debug(79, 3) ("DiskThreadsDiskFile::write: FD %d\n", fd);
+ debugs(79, 3, "DiskThreadsDiskFile::write: FD " << fd);
statCounter.syscalls.disk.writes++;
++inProgressIOs;
#if ASYNC_WRITE
void
DiskThreadsDiskFile::readDone(int rvfd, const char *buf, int len, int errflag, ReadRequest::Pointer request)
{
- debug (79,3)("DiskThreadsDiskFile::readDone: FD %d\n",rvfd);
+ debugs(79, 3, "DiskThreadsDiskFile::readDone: FD " << rvfd);
assert (fd == rvfd);
ssize_t rlen;
if (errflag) {
- debug(79, 3) ("DiskThreadsDiskFile::readDone: got failure (%d)\n", errflag);
+ debugs(79, 3, "DiskThreadsDiskFile::readDone: got failure (" << errflag << ")");
rlen = -1;
} else {
rlen = (ssize_t) len;
#endif
- debug(79, 3) ("DiskThreadsDiskFile::writeDone: FD %d, len %ld, err=%d\n",
- fd, (long int) len, errflag);
+ debugs(79, 3, "DiskThreadsDiskFile::writeDone: FD " << fd << ", len " << (long int) len << ", err=" << errflag);
assert(++loop_detect < 10);
/*
- * $Id: DiskThreadsIOStrategy.cc,v 1.11 2007/04/12 23:51:57 wessels Exp $
+ * $Id: DiskThreadsIOStrategy.cc,v 1.12 2007/04/28 22:26:47 hno Exp $
*
* DEBUG: section 79 Squid-side Disk I/O functions.
* AUTHOR: Robert Collins
return; /* nothing to do then */
/* Flush all pending operations */
- debug(32, 1) ("aioSync: flushing pending I/O operations\n");
+ debugs(32, 1, "aioSync: flushing pending I/O operations");
do {
callback();
} while (squidaio_sync());
- debug(32, 1) ("aioSync: done\n");
+ debugs(32, 1, "aioSync: done");
}
DiskThreadsIOStrategy::DiskThreadsIOStrategy() : initialised (false) {}
loadav = ql * 1000 / MAGIC1;
- debug(47, 9) ("DiskThreadsIOStrategy::load: load=%d\n", loadav);
+ debugs(47, 9, "DiskThreadsIOStrategy::load: load=" << loadav);
return loadav;
}
/*
- * $Id: aiops.cc,v 1.13 2007/04/12 23:51:57 wessels Exp $
+ * $Id: aiops.cc,v 1.14 2007/04/28 22:26:47 hno Exp $
*
* DEBUG: section 43 AIOPS
* AUTHOR: Stewart Forster <slf@connect.com.au>
squidaio_queue_request(squidaio_request_t * request)
{
static int high_start = 0;
- debug(43, 9) ("squidaio_queue_request: %p type=%d result=%p\n",
- request, request->request_type, request->resultp);
+ debugs(43, 9, "squidaio_queue_request: " << request << " type=" << request->request_type << " result=" << request->resultp);
/* Mark it as not executed (failing result, no error) */
request->ret = -1;
request->err = 0;
if (++filter >= filter_limit) {
filter_limit += filter;
filter = 0;
- debug(43, 1) ("squidaio_queue_request: WARNING - Queue congestion\n");
+ debugs(43, 1, "squidaio_queue_request: WARNING - Queue congestion");
}
}
if (squid_curtime >= (last_warn + 15) &&
squid_curtime >= (high_start + 5)) {
- debug(43, 1) ("squidaio_queue_request: WARNING - Disk I/O overloading\n");
+ debugs(43, 1, "squidaio_queue_request: WARNING - Disk I/O overloading");
if (squid_curtime >= (high_start + 15))
- debug(43, 1) ("squidaio_queue_request: Queue Length: current=%d, high=%d, low=%d, duration=%ld\n",
- request_queue_len, queue_high, queue_low, (long int) (squid_curtime - high_start));
+ debugs(43, 1, "squidaio_queue_request: Queue Length: current=" <<
+ request_queue_len << ", high=" << queue_high <<
+ ", low=" << queue_low << ", duration=" <<
+ (long int) (squid_curtime - high_start));
last_warn = squid_curtime;
}
/* Warn if seriously overloaded */
if (request_queue_len > RIDICULOUS_LENGTH) {
- debug(43, 0) ("squidaio_queue_request: Async request queue growing uncontrollably!\n");
- debug(43, 0) ("squidaio_queue_request: Syncing pending I/O operations.. (blocking)\n");
+ debugs(43, 0, "squidaio_queue_request: Async request queue growing uncontrollably!");
+ debugs(43, 0, "squidaio_queue_request: Syncing pending I/O operations.. (blocking)");
squidaio_sync();
- debug(43, 0) ("squidaio_queue_request: Synced\n");
+ debugs(43, 0, "squidaio_queue_request: Synced");
}
} /* squidaio_queue_request */
squidaio_request_t *request = (squidaio_request_t *)resultp->_data;
if (request && request->resultp == resultp) {
- debug(43, 9) ("squidaio_cancel: %p type=%d result=%p\n",
- request, request->request_type, request->resultp);
+ debugs(43, 9, "squidaio_cancel: " << request << " type=" << request->request_type << " result=" << request->resultp);
request->cancelled = 1;
request->resultp = NULL;
resultp->_data = NULL;
return NULL;
}
- debug(43, 9) ("squidaio_poll_done: %p type=%d result=%p\n",
- request, request->request_type, request->resultp);
+ debugs(43, 9, "squidaio_poll_done: " << request << " type=" << request->request_type << " result=" << request->resultp);
done_requests.head = request->next;
if (!done_requests.head)
squidaio_debug(request);
- debug(43, 5) ("DONE: %d -> %d\n", request->ret, request->err);
+ debugs(43, 5, "DONE: " << request->ret << " -> " << request->err);
squidaio_cleanup_request(request);
switch (request->request_type) {
case _AIO_OP_OPEN:
- debug(43, 5) ("OPEN of %s to FD %d\n", request->path, request->ret);
+ debugs(43, 5, "OPEN of " << request->path << " to FD " << request->ret);
break;
case _AIO_OP_READ:
- debug(43, 5) ("READ on fd: %d\n", request->fd);
+ debugs(43, 5, "READ on fd: " << request->fd);
break;
case _AIO_OP_WRITE:
- debug(43, 5) ("WRITE on fd: %d\n", request->fd);
+ debugs(43, 5, "WRITE on fd: " << request->fd);
break;
case _AIO_OP_CLOSE:
- debug(43, 5) ("CLOSE of fd: %d\n", request->fd);
+ debugs(43, 5, "CLOSE of fd: " << request->fd);
break;
case _AIO_OP_UNLINK:
- debug(43, 5) ("UNLINK of %s\n", request->path);
+ debugs(43, 5, "UNLINK of " << request->path);
break;
default:
/*
- * $Id: aiops_win32.cc,v 1.3 2007/04/12 23:51:57 wessels Exp $
+ * $Id: aiops_win32.cc,v 1.4 2007/04/28 22:26:47 hno Exp $
*
* DEBUG: section 43 Windows AIOPS
* AUTHOR: Stewart Forster <slf@connect.com.au>
squidaio_queue_request(squidaio_request_t * request)
{
static int high_start = 0;
- debug(43, 9) ("squidaio_queue_request: %p type=%d result=%p\n",
- request, request->request_type, request->resultp);
+ debugs(43, 9, "squidaio_queue_request: " << request << " type=" << request->request_type << " result=" << request->resultp);
/* Mark it as not executed (failing result, no error) */
request->ret = -1;
request->err = 0;
if (++filter >= filter_limit) {
filter_limit += filter;
filter = 0;
- debug(43, 1) ("squidaio_queue_request: WARNING - Queue congestion\n");
+ debugs(43, 1, "squidaio_queue_request: WARNING - Queue congestion");
}
}
if (squid_curtime >= (last_warn + 15) &&
squid_curtime >= (high_start + 5)) {
- debug(43, 1) ("squidaio_queue_request: WARNING - Disk I/O overloading\n");
+ debugs(43, 1, "squidaio_queue_request: WARNING - Disk I/O overloading");
if (squid_curtime >= (high_start + 15))
- debug(43, 1) ("squidaio_queue_request: Queue Length: current=%d, high=%d, low=%d, duration=%ld\n",
- request_queue_len, queue_high, queue_low, (long int) (squid_curtime - high_start));
+ debugs(43, 1, "squidaio_queue_request: Queue Length: current=" <<
+ request_queue_len << ", high=" << queue_high <<
+ ", low=" << queue_low << ", duration=" <<
+ (long int) (squid_curtime - high_start));
last_warn = (int)squid_curtime;
}
/* Warn if seriously overloaded */
if (request_queue_len > RIDICULOUS_LENGTH) {
- debug(43, 0) ("squidaio_queue_request: Async request queue growing uncontrollably!\n");
- debug(43, 0) ("squidaio_queue_request: Syncing pending I/O operations.. (blocking)\n");
+ debugs(43, 0, "squidaio_queue_request: Async request queue growing uncontrollably!");
+ debugs(43, 0, "squidaio_queue_request: Syncing pending I/O operations.. (blocking)");
squidaio_sync();
- debug(43, 0) ("squidaio_queue_request: Synced\n");
+ debugs(43, 0, "squidaio_queue_request: Synced");
}
} /* squidaio_queue_request */
squidaio_request_t *request = (squidaio_request_t *)resultp->_data;
if (request && request->resultp == resultp) {
- debug(43, 9) ("squidaio_cancel: %p type=%d result=%p\n",
- request, request->request_type, request->resultp);
+ debugs(43, 9, "squidaio_cancel: " << request << " type=" << request->request_type << " result=" << request->resultp);
request->cancelled = 1;
request->resultp = NULL;
resultp->_data = NULL;
squidaio_do_close(squidaio_request_t * requestp)
{
if((requestp->ret = close(requestp->fd)) < 0) {
- debug(43, 0) ("squidaio_do_close: FD %d, errno %d\n", requestp->fd, errno);
+ debugs(43, 0, "squidaio_do_close: FD " << requestp->fd << ", errno " << errno);
close(requestp->fd);
}
return NULL;
}
- debug(43, 9) ("squidaio_poll_done: %p type=%d result=%p\n",
- request, request->request_type, request->resultp);
+ debugs(43, 9, "squidaio_poll_done: " << request << " type=" << request->request_type << " result=" << request->resultp);
done_requests.head = request->next;
if (!done_requests.head)
squidaio_debug(request);
- debug(43, 5) ("DONE: %d -> %d\n", request->ret, request->err);
+ debugs(43, 5, "DONE: " << request->ret << " -> " << request->err);
squidaio_cleanup_request(request);
switch (request->request_type) {
case _AIO_OP_OPEN:
- debug(43, 5) ("OPEN of %s to FD %d\n", request->path, request->ret);
+ debugs(43, 5, "OPEN of " << request->path << " to FD " << request->ret);
break;
case _AIO_OP_READ:
- debug(43, 5) ("READ on fd: %d\n", request->fd);
+ debugs(43, 5, "READ on fd: " << request->fd);
break;
case _AIO_OP_WRITE:
- debug(43, 5) ("WRITE on fd: %d\n", request->fd);
+ debugs(43, 5, "WRITE on fd: " << request->fd);
break;
case _AIO_OP_CLOSE:
- debug(43, 5) ("CLOSE of fd: %d\n", request->fd);
+ debugs(43, 5, "CLOSE of fd: " << request->fd);
break;
case _AIO_OP_UNLINK:
- debug(43, 5) ("UNLINK of %s\n", request->path);
+ debugs(43, 5, "UNLINK of " << request->path);
break;
default:
/*
- * $Id: async_io.cc,v 1.3 2007/04/12 23:51:57 wessels Exp $
+ * $Id: async_io.cc,v 1.4 2007/04/28 22:26:47 hno Exp $
*
* DEBUG: section 32 Asynchronous Disk I/O
* AUTHOR: Pete Bentley <pete@demon.net>
AIOCB *callback = ctrlp->done_handler;
void *cbdata;
ctrlp->done_handler = NULL;
- debug(32, 1) ("this be aioCancel. Danger ahead!\n");
+ debugs(32, 1, "this be aioCancel. Danger ahead!");
if (cbdataReferenceValidDone(ctrlp->done_handler_data, &cbdata))
callback(fd, cbdata, NULL, -2, -2);
/*
- * $Id: ESI.cc,v 1.22 2006/08/21 00:50:40 robertc Exp $
+ * $Id: ESI.cc,v 1.23 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 86 ESI processing
* AUTHOR: Robert Collins
}
fixupOutboundTail();
- debug (86,9)("ESIContext::appendOutboundData: outbound %p\n", outbound.getRaw());
+ debugs(86, 9, "ESIContext::appendOutboundData: outbound " << outbound.getRaw());
}
void
ESIContext::provideData (ESISegment::Pointer theData, ESIElement * source)
{
- debug (86,5)("ESIContext::provideData: %p %p %p\n",this, theData.getRaw(), source);
+ debugs(86, 5, "ESIContext::provideData: " << this << " " << theData.getRaw() << " " << source);
/* No callbacks permitted after finish() called on the tree */
assert (tree.getRaw());
assert (source == tree);
assert (this);
if (flags.kicked) {
- debug (86,5)("esiKick: Re-entered whilst in progress\n");
+ debugs(86, 5, "esiKick: Re-entered whilst in progress");
// return ESI_KICK_INPROGRESS;
} else
++flags.kicked;
switch (process ()) {
case ESI_PROCESS_COMPLETE:
- debug (86,5)("esiKick: esiProcess OK\n");
+ debugs(86, 5, "esiKick: esiProcess OK");
break;
case ESI_PROCESS_PENDING_WONTFAIL:
- debug (86,5)("esiKick: esiProcess PENDING OK\n");
+ debugs(86, 5, "esiKick: esiProcess PENDING OK");
break;
case ESI_PROCESS_PENDING_MAYFAIL:
- debug (86,5)("esiKick: esiProcess PENDING UNKNOWN\n");
+ debugs(86, 5, "esiKick: esiProcess PENDING UNKNOWN");
break;
case ESI_PROCESS_FAILED:
- debug (86,2)("esiKick: esiProcess %p FAILED\n", this);
+ debugs(86, 2, "esiKick: esiProcess " << this << " FAILED");
/* this can not happen - processing can't fail until we have data,
* and when we come here we have sent data to the client
*/
}
context->flags.clientwantsdata = 1;
- debug (86,5)("esiStreamRead: Client now wants data\n");
+ debugs(86, 5, "esiStreamRead: Client now wants data");
/* Ok, not passing through */
* processing. stop here, a callback will resume the stream
* flow
*/
- debug (86,5) ("esiStreamRead: Waiting for async resume of esi processing\n");
+ debugs(86, 5, "esiStreamRead: Waiting for async resume of esi processing");
return;
}
if (context->flags.oktosend && context->flags.finished && context->outbound.getRaw()) {
- debug (86,5)("all processing complete, but outbound data still buffered\n");
+ debugs(86, 5, "all processing complete, but outbound data still buffered");
assert (!context->flags.clientwantsdata);
/* client MUST be processing the last reply */
return;
StoreIOBuffer tempBuffer;
assert (!context->outbound.getRaw());
/* We've finished processing, and there is no more data buffered */
- debug (86,5)("Telling recipient EOF on READ\n");
+ debugs(86, 5, "Telling recipient EOF on READ");
clientStreamCallback (thisNode, http, NULL, tempBuffer);
return;
}
if (context->flags.oktosend && context->flags.finished &&
!(context->outbound.getRaw() && context->outbound_offset < context->outbound->len)) {
- debug (86,5) ("Telling recipient EOF on STATUS\n");
+ debugs(86, 5, "Telling recipient EOF on STATUS");
return STREAM_UNPLANNED_COMPLETE; /* we don't know lengths in advance */
}
/* trim leading empty buffers ? */
while (outbound.getRaw() && outbound->next.getRaw() && !outbound->len) {
- debug(86,5)("ESIContext::trimBlanks: %p skipping segment %p\n", this, outbound.getRaw());
+ debugs(86, 5, "ESIContext::trimBlanks: " << this <<
+ " skipping segment " << outbound.getRaw());
outbound = outbound->next;
}
size_t
ESIContext::send ()
{
- debug (86,5)("ESIContext::send: this=%p\n",this);
+ debugs(86, 5, "ESIContext::send: this=" << this);
/* send any processed data */
trimBlanks();
if (!flags.clientwantsdata) {
- debug (86,5)("ESIContext::send: Client does not want data - not sending anything\n");
+ debugs(86, 5, "ESIContext::send: Client does not want data - not sending anything");
return 0;
}
if (tree.getRaw() && tree->mayFail()) {
- debug (86, 5)("ESIContext::send: Tree may fail. Not sending.\n");
+ debugs(86, 5, "ESIContext::send: Tree may fail. Not sending.");
return 0;
} else
flags.oktosend = 1;
if (!(rep || (outbound.getRaw() &&
outbound->len && (outbound_offset <= outbound->len)))) {
- debug (86,5)("ESIContext::send: Nothing to send.\n");
+ debugs(86, 5, "ESIContext::send: Nothing to send.");
return 0;
}
- debug (86,5)("ESIContext::send: Sending something...\n");
+ debugs(86, 5, "ESIContext::send: Sending something...");
/* Yes! Send it without asking for more upstream */
/* memcopying because the client provided the buffer */
/* TODO: skip data until pos == next->readoff; */
}
flags.clientwantsdata = 0;
- debug (86,5)("ESIContext::send: this=%p Client no longer wants data \n",this);
+ debugs(86, 5, "ESIContext::send: this=" << this << " Client no longer wants data ");
/* Deal with re-entrancy */
HttpReply *temprep = rep;
rep = NULL; /* freed downstream */
return;
}
- debug (86, 3)("esiProcessStream: Processing thisNode %p context %p offset %d length %u\n",thisNode, context.getRaw(), (int) recievedData.offset, (unsigned int)recievedData.length);
+ debugs(86, 3, "esiProcessStream: Processing thisNode " << thisNode <<
+ " context " << context.getRaw() << " offset " <<
+ (int) recievedData.offset << " length " <<
+ (unsigned int)recievedData.length);
/* once we finish the template, we *cannot* return here */
assert (!context->flags.finishedtemplate);
if (!context->incoming.getRaw()) {
/* create a new buffer segment */
- debug (86,5) ("esiProcessStream: Setting up incoming buffer\n");
+ debugs(86, 5, "esiProcessStream: Setting up incoming buffer");
context->buffered = new ESISegment;
context->incoming = context->buffered;
}
/* We have to copy the data out because we didn't supply thisNode buffer */
size_t space = HTTP_REQBUF_SZ - context->incoming->len;
size_t len = min (space, recievedData.length);
- debug (86,5)("Copying data from %p to %p because our buffer was not used\n", recievedData.data,
- &context->incoming->buf[context->incoming->len]);
+ debugs(86, 5, "Copying data from " << recievedData.data << " to " <<
+ &context->incoming->buf[context->incoming->len] <<
+ " because our buffer was not used");
+
xmemcpy (&context->incoming->buf[context->incoming->len], recievedData.data, len);
context->incoming->len += len;
if (rep == NULL && recievedData.data == NULL && recievedData.length == 0 && !context->flags.finishedtemplate) {
/* TODO: get stream status to test the entry for aborts */
/* else flush the esi processor */
- debug (86,5)("esiProcess: %p Finished reading upstream data\n", context.getRaw());
+ debugs(86, 5, "esiProcess: " << context.getRaw() << " Finished reading upstream data");
/* This is correct */
context->flags.finishedtemplate = 1;
}
return;
}
- debug (86,3)("esiProcessStream: no data to send, no data to read, awaiting a callback\n");
+ debugs(86, 3, "esiProcessStream: no data to send, no data to read, awaiting a callback");
}
ESIContext::~ESIContext()
freeResources ();
/* Not freed by freeresources because esi::fail needs it */
safe_free (errormessage);
- debug (86,3)("ESIContext::~ESIContext: Freed %p\n", this);
+ debugs(86, 3, "ESIContext::~ESIContext: Freed " << this);
}
ESIContext *
rv->http = http;
rv->flags.clientwantsdata = 1;
rv->varState = new ESIVarState (&http->request->header, http->uri);
- debug (86,5)("ESIContextNew: Client wants data (always created during reply cycle\n");
+ debugs(86, 5, "ESIContextNew: Client wants data (always created during reply cycle");
}
- debug (86,5)("ESIContextNew: Create context %p\n",rv);
+ debugs(86, 5, "ESIContextNew: Create context " << rv);
return rv;
}
/* Put on the stack to allow skipping of 'invalid' markup */
assert (parserState.stackdepth <11);
assert (!failed());
- debug (86,5)("ESIContext::addStackElement: About to add ESI Node %p\n", element.getRaw());
+ debugs(86, 5, "ESIContext::addStackElement: About to add ESI Node " << element.getRaw());
if (!parserState.top()->addElement(element)) {
- debug (86,1)("ESIContext::addStackElement: failed to add esi node, probable error in ESI template\n");
+ debugs(86, 1, "ESIContext::addStackElement: failed to add esi node, probable error in ESI template");
flags.error = 1;
} else {
/* added ok, push onto the stack */
char *pos;
assert (ellen < sizeof (localbuf)); /* prevent unexpected overruns. */
- debug (86, 5)("ESIContext::Start: element '%s' with %d tags\n", el, specifiedattcount);
+ debugs(86, 5, "ESIContext::Start: element '" << el << "' with " << specifiedattcount << " tags");
if (failed())
/* waiting for expat to finish the buffer we gave it */
*pos = '\0';
addLiteral (localbuf, pos - localbuf);
- debug (86,5)("esi stack depth %d\n",parserState.stackdepth);
+ debugs(86, 5, "esi stack depth " << parserState.stackdepth);
return;
break;
addStackElement(element);
- debug (86,5)("esi stack depth %d\n",parserState.stackdepth);
+ debugs(86, 5, "esi stack depth " << parserState.stackdepth);
} /* End of start handler */
return;
if (!strncmp(s, "esi",3)) {
- debug (86,5)("ESIContext::parserComment: ESI <!-- block encountered\n");
+ debugs(86, 5, "ESIContext::parserComment: ESI <!-- block encountered");
ESIParser::Pointer tempParser = ESIParser::NewParser (this);
/* wrap the comment in some tags */
if (!tempParser->parse("<div>", 5,0) ||
!tempParser->parse(s + 3, strlen(s) - 3, 0) ||
!tempParser->parse("</div>",6,1)) {
- debug (86,0)("ESIContext::parserComment: Parsing fragment '%s' failed.\n", s + 3);
+ debugs(86, 0, "ESIContext::parserComment: Parsing fragment '" << s + 3 << "' failed.");
setError();
char tempstr[1024];
snprintf(tempstr, 1023, "ESIContext::parserComment: Parse error at line %ld:\n%s\n",
tempParser->lineNumber(),
tempParser->errorString());
- debug (86,0)("%s",tempstr);
+ debugs(86, 0, "" << tempstr << "");
setErrorMessage(tempstr);
}
- debug (86,5)("ESIContext::parserComment: ESI <!-- block parsed\n");
+ debugs(86, 5, "ESIContext::parserComment: ESI <!-- block parsed");
return;
} else {
char localbuf [HTTP_REQBUF_SZ];
unsigned int len;
- debug (86,5)("ESIContext::parserComment: Regenerating comment block\n");
+ debugs(86, 5, "ESIContext::parserComment: Regenerating comment block");
len = strlen (s);
if (len > sizeof (localbuf) - 9) {
- debug (86,0)("ESIContext::parserComment: Truncating long comment\n");
+ debugs(86, 0, "ESIContext::parserComment: Truncating long comment");
len = sizeof (localbuf) - 9;
}
{
/* handle any skipped data */
assert (len);
- debug (86,5)("literal length is %d\n", len);
+ debugs(86, 5, "literal length is " << len);
/* give a literal to the current element */
assert (parserState.stackdepth <11);
ESIElement::Pointer element (new esiLiteral (this, s, len));
if (!parserState.top()->addElement(element)) {
- debug (86,1)("ESIContext::addLiteral: failed to add esi node, probable error in ESI template\n");
+ debugs(86, 1, "ESIContext::addLiteral: failed to add esi node, probable error in ESI template");
flags.error = 1;
}
}
snprintf (tempstr, 1023, "esiProcess: Parse error at line %ld:\n%s\n",
parserState.theParser->lineNumber(),
parserState.theParser->errorString());
- debug (86,0)("%s", tempstr);
+ debugs(86, 0, "" << tempstr << "");
setErrorMessage(tempstr);
ESIContext::parse()
{
if (!parserState.stackdepth) {
- debug (86,5)("empty parser stack, inserting the top level node\n");
+ debugs(86, 5, "empty parser stack, inserting the top level node");
assert (tree.getRaw());
parserState.stack[parserState.stackdepth++] = tree;
}
getCachedAST();
if (flags.error) {
- debug (86,5) ("ESIContext::process: Parsing failed\n");
+ debugs(86, 5, "ESIContext::process: Parsing failed");
finishChildren ();
parserState.popAll();
return ESI_PROCESS_FAILED;
{
case ESI_PROCESS_COMPLETE:
- debug (86,5)("esiProcess: tree Processed OK\n");
+ debugs(86, 5, "esiProcess: tree Processed OK");
break;
case ESI_PROCESS_PENDING_WONTFAIL:
- debug (86,5)("esiProcess: tree Processed PENDING OK\n");
+ debugs(86, 5, "esiProcess: tree Processed PENDING OK");
break;
case ESI_PROCESS_PENDING_MAYFAIL:
- debug (86,5)("esiProcess: tree Processed PENDING UNKNOWN\n");
+ debugs(86, 5, "esiProcess: tree Processed PENDING UNKNOWN");
break;
case ESI_PROCESS_FAILED:
- debug (86,0)("esiProcess: tree Processed FAILED\n");
+ debugs(86, 0, "esiProcess: tree Processed FAILED");
setError();
setErrorMessage("esiProcess: ESI template Processing failed.");
/* We've read the entire template, and no nodes will
* return failure
*/
- debug (86,5)("esiProcess, request will succeed\n");
+ debugs(86, 5, "esiProcess, request will succeed");
flags.oktosend = 1;
}
&& (flags.finishedtemplate || cachedASTInUse))
{
/* we've finished all processing. Render and send. */
- debug (86,5)("esiProcess, processing complete\n");
+ debugs(86, 5, "esiProcess, processing complete");
flags.finished = 1;
}
void
ESIContext::freeResources ()
{
- debug (86,5)("ESIContext::freeResources: Freeing for this=%p\n",this);
+ debugs(86, 5, "ESIContext::freeResources: Freeing for this=" << this);
if (rep) {
delete rep;
void
ESIContext::fail ()
{
- debug (86,5)("ESIContext::fail: this=%p\n",this);
+ debugs(86, 5, "ESIContext::fail: this=" << this);
/* check preconditions */
assert (pos == 0);
/* cleanup current state */
/* esiComment */
esiComment::~esiComment()
{
- debug (86,5)("esiComment::~esiComment %p\n", this);
+ debugs(86, 5, "esiComment::~esiComment " << this);
}
esiComment::esiComment()
esiComment::render(ESISegment::Pointer output)
{
/* Comments do nothing dude */
- debug (86, 5)("esiCommentRender: Rendering comment %p into %p\n", this, output.getRaw());
+ debugs(86, 5, "esiCommentRender: Rendering comment " << this << " into " << output.getRaw());
}
ESIElement::Pointer
esiComment::makeCacheable() const
{
- debug (86, 5) ("esiComment::makeCacheable: returning NULL\n");
+ debugs(86, 5, "esiComment::makeCacheable: returning NULL");
return NULL;
}
/* esiLiteral */
esiLiteral::~esiLiteral()
{
- debug (86, 5) ("esiLiteral::~esiLiteral: %p\n", this);
+ debugs(86, 5, "esiLiteral::~esiLiteral: " << this);
ESISegmentFreeList (buffer);
cbdataReferenceDone (varState);
}
void
esiLiteral::render (ESISegment::Pointer output)
{
- debug (86,9)("esiLiteral::render: Rendering %p\n",this);
+ debugs(86, 9, "esiLiteral::render: Rendering " << this);
/* append the entire chain */
assert (output->next.getRaw() == NULL);
output->next = buffer;
ESIElement::Pointer
esiLiteral::makeUsable(esiTreeParentPtr , ESIVarState &newVarState) const
{
- debug (86,5)("esiLiteral::makeUsable: Creating usable literal\n");
+ debugs(86, 5, "esiLiteral::makeUsable: Creating usable literal");
esiLiteral * result = new esiLiteral (*this);
result->varState = cbdataReference (&newVarState);
return result;
esiRemoveFree (void *data)
{
esiRemove *thisNode = (esiRemove *)data;
- debug (86,5)("esiRemoveFree %p\n", thisNode);
+ debugs(86, 5, "esiRemoveFree " << thisNode);
}
void *
esiRemove::render(ESISegment::Pointer output)
{
/* Removes do nothing dude */
- debug (86, 5)("esiRemoveRender: Rendering remove %p\n", this);
+ debugs(86, 5, "esiRemoveRender: Rendering remove " << this);
}
/* Accept non-ESI children */
esiRemove::addElement (ESIElement::Pointer element)
{
if (!dynamic_cast<esiLiteral*>(element.getRaw())) {
- debug (86,5)("esiRemoveAdd: Failed for %p\n",this);
+ debugs(86, 5, "esiRemoveAdd: Failed for " << this);
return false;
}
ESIElement::Pointer
esiRemove::makeCacheable() const
{
- debug (86,5)("esiRemove::makeCacheable: Returning NULL\n");
+ debugs(86, 5, "esiRemove::makeCacheable: Returning NULL");
return NULL;
}
/* esiTry */
esiTry::~esiTry()
{
- debug (86,5)("esiTry::~esiTry %p\n", this);
+ debugs(86, 5, "esiTry::~esiTry " << this);
}
esiTry::esiTry(esiTreeParentPtr aParent) : parent (aParent) , exceptbuffer(NULL)
assert (this);
assert (attempt.getRaw());
assert (except.getRaw());
- debug (86, 5)("esiTryRender: Rendering Try %p\n", this);
+ debugs(86, 5, "esiTryRender: Rendering Try " << this);
if (flags.attemptok) {
attempt->render(output);
else
except->render(output);
} else
- debug (86,5)("esiTryRender: Neither except nor attempt succeeded?!?\n");
+ debugs(86, 5, "esiTryRender: Neither except nor attempt succeeded?!?");
}
/* Accept attempt and except only */
bool
esiTry::addElement(ESIElement::Pointer element)
{
- debug (86,5)("esiTryAdd: Try %p adding element %p\n",this, element.getRaw());
+ debugs(86, 5, "esiTryAdd: Try " << this << " adding element " <<
+ element.getRaw());
if (dynamic_cast<esiLiteral*>(element.getRaw())) {
/* Swallow whitespace */
- debug (86,5)("esiTryAdd: Try %p skipping whitespace %p\n",this, element.getRaw());
+ debugs(86, 5, "esiTryAdd: Try " << this << " skipping whitespace " << element.getRaw());
return true;
}
if (dynamic_cast<esiAttempt*>(element.getRaw())) {
if (attempt.getRaw()) {
- debug (86,1)("esiTryAdd: Failed for %p - try allready has an attempt node (section 3.4)\n",this);
+ debugs(86, 1, "esiTryAdd: Failed for " << this << " - try allready has an attempt node (section 3.4)");
return false;
}
if (dynamic_cast<esiExcept*>(element.getRaw())) {
if (except.getRaw()) {
- debug (86,1)("esiTryAdd: Failed for %p - try already has an except node (section 3.4)\n",this);
+ debugs(86, 1, "esiTryAdd: Failed for " << this << " - try already has an except node (section 3.4)");
return false;
}
return true;
}
- debug (86,1)("esiTryAdd: Failed to add element %p to try %p, incorrect element type (see section 3.4)\n", element.getRaw(), this);
+ debugs(86, 1, "esiTryAdd: Failed to add element " << element.getRaw() << " to try " << this << ", incorrect element type (see section 3.4)");
return false;
}
assert (this);
if (!attempt.getRaw()) {
- debug (86,0)("esiTryProcess: Try has no attempt element - ESI template is invalid (section 3.4)\n");
+ debugs(86, 0, "esiTryProcess: Try has no attempt element - ESI template is invalid (section 3.4)");
return ESI_PROCESS_FAILED;
}
if (!except.getRaw()) {
- debug (86,0)("esiTryProcess: Try has no except element - ESI template is invalid (section 3.4)\n");
+ debugs(86, 0, "esiTryProcess: Try has no except element - ESI template is invalid (section 3.4)");
return ESI_PROCESS_FAILED;
}
switch ((rv = attempt->process(dovars))) {
case ESI_PROCESS_COMPLETE:
- debug (86,5)("esiTryProcess: attempt Processed OK\n");
+ debugs(86, 5, "esiTryProcess: attempt Processed OK");
flags.attemptok = 1;
return ESI_PROCESS_COMPLETE;
case ESI_PROCESS_PENDING_WONTFAIL:
- debug (86,5)("esiTryProcess: attempt Processed PENDING OK\n");
+ debugs(86, 5, "esiTryProcess: attempt Processed PENDING OK");
/* We're not done yet, but don't need to test except */
return ESI_PROCESS_PENDING_WONTFAIL;
case ESI_PROCESS_PENDING_MAYFAIL:
- debug (86,5)("eseSequenceProcess: element Processed PENDING UNKNOWN\n");
+ debugs(86, 5, "eseSequenceProcess: element Processed PENDING UNKNOWN");
break;
case ESI_PROCESS_FAILED:
- debug (86,5)("esiSequenceProcess: element Processed FAILED\n");
+ debugs(86, 5, "esiSequenceProcess: element Processed FAILED");
flags.attemptfailed = 1;
break;
}
switch (except->process(dovars)) {
case ESI_PROCESS_COMPLETE:
- debug (86,5)("esiTryProcess: except Processed OK\n");
+ debugs(86, 5, "esiTryProcess: except Processed OK");
flags.exceptok = 1;
return bestAttemptRV();
case ESI_PROCESS_PENDING_WONTFAIL:
- debug (86,5)("esiTryProcess: attempt Processed PENDING OK\n");
+ debugs(86, 5, "esiTryProcess: attempt Processed PENDING OK");
/* We're not done yet, but can't fail */
return ESI_PROCESS_PENDING_WONTFAIL;
case ESI_PROCESS_PENDING_MAYFAIL:
- debug (86,5)("eseSequenceProcess: element Processed PENDING UNKNOWN\n");
+ debugs(86, 5, "eseSequenceProcess: element Processed PENDING UNKNOWN");
/* The except branch fail fail */
return ESI_PROCESS_PENDING_MAYFAIL;
case ESI_PROCESS_FAILED:
- debug (86,5)("esiSequenceProcess: element Processed FAILED\n");
+ debugs(86, 5, "esiSequenceProcess: element Processed FAILED");
flags.exceptfailed = 1;
break;
}
{
assert (source);
assert (source == attempt || source == except);
- debug (86,5) ("esiTry::fail: this=%p, source=%p, message=%s\n", this, source, anError);
+ debugs(86, 5, "esiTry::fail: this=" << this << ", source=" << source << ", message=" << anError);
if (source == except) {
flags.exceptfailed = 1;
ESIElement::Pointer
esiTry::makeCacheable() const
{
- debug (86,5)("esiTry::makeCacheable: making cachable Try from %p\n",this);
+ debugs(86, 5, "esiTry::makeCacheable: making cachable Try from " << this);
esiTry *resultT = new esiTry (*this);
ESIElement::Pointer result = resultT;
ESIElement::Pointer
esiTry::makeUsable(esiTreeParentPtr newParent, ESIVarState &newVarState) const
{
- debug (86,5)("esiTry::makeUsable: making usable Try from %p\n",this);
+ debugs(86, 5, "esiTry::makeUsable: making usable Try from " << this);
esiTry *resultT = new esiTry (*this);
ESIElement::Pointer result = resultT;
/* esiChoose */
esiChoose::~esiChoose()
{
- debug (86,5)("esiChoose::~esiChoose %p\n", this);
+ debugs(86, 5, "esiChoose::~esiChoose " << this);
}
esiChoose::esiChoose(esiTreeParentPtr aParent) : elements (), chosenelement (-1),parent (aParent)
/* append all processed elements, and trim processed and rendered elements */
assert (output->next == NULL);
assert (elements.size() || otherwise.getRaw());
- debug (86,5)("esiChooseRender: rendering\n");
+ debugs(86, 5, "esiChooseRender: rendering");
if (chosenelement >= 0)
elements[chosenelement]->render(output);
if (dynamic_cast<esiLiteral*>(element.getRaw())) {
/* Swallow whitespace */
- debug (86,5)("esiChooseAdd: Choose %p skipping whitespace %p\n",this, element.getRaw());
+ debugs(86, 5, "esiChooseAdd: Choose " << this << " skipping whitespace " << element.getRaw());
return true;
}
/* Some elements require specific parents */
if (!(dynamic_cast<esiWhen*>(element.getRaw()) || dynamic_cast<esiOtherwise*>(element.getRaw()))) {
- debug (86,0)("esiChooseAdd: invalid child node for esi:choose (section 3.3)\n");
+ debugs(86, 0, "esiChooseAdd: invalid child node for esi:choose (section 3.3)");
return false;
}
if (dynamic_cast<esiOtherwise*>(element.getRaw())) {
if (otherwise.getRaw()) {
- debug (86,0)("esiChooseAdd: only one otherwise node allowed for esi:choose (section 3.3)\n");
+ debugs(86, 0, "esiChooseAdd: only one otherwise node allowed for esi:choose (section 3.3)");
return false;
}
if (elements[loopPosition].getRaw())
elements[loopPosition]->finish();
- debug (86,5)("esiSequence::NULLElements: Setting index %d, pointer %p to NULL\n", loopPosition, elements[loopPosition].getRaw());
+ debugs(86, 5, "esiSequence::NULLElements: Setting index " <<
+ loopPosition << ", pointer " <<
+ elements[loopPosition].getRaw() << " to NULL");
elements[loopPosition] = NULL;
}
ElementList::~ElementList()
{
- debug (86,5)("ElementList::~ElementList %p\n", this);
+ debugs(86, 5, "ElementList::~ElementList " << this);
setNULL(0, elementcount);
if (elements)
for (int loopCounter = 0; loopCounter < attrcount && attr[loopCounter]; loopCounter += 2) {
if (!strcmp(attr[loopCounter],"test")) {
/* evaluate test */
- debug (86,5)("esiWhen::esiWhen: Evaluating '%s'\n",attr[loopCounter+1]);
+ debugs(86, 5, "esiWhen::esiWhen: Evaluating '" << attr[loopCounter+1] << "'");
/* TODO: warn the user instead of asserting */
assert (expression == NULL);
expression = attr[loopCounter+1];
/* ignore mistyped attributes.
* TODO:? error on these for user feedback - config parameter needed
*/
- debug (86,1)("Found misttyped attribute on ESI When clause\n");
+ debugs(86, 1, "Found misttyped attribute on ESI When clause");
}
}
/*
- * $Id: ESIAssign.cc,v 1.3 2004/08/30 05:12:31 robertc Exp $
+ * $Id: ESIAssign.cc,v 1.4 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 86 ESI processing
* AUTHOR: Robert Collins
for (int i = 0; i < attrcount && attr[i]; i += 2) {
if (!strcmp(attr[i],"name")) {
/* the variables name is ... */
- debug (86,5)("ESIAssign::ESIAssign: Variable name '%s'\n",attr[i+1]);
+ debugs(86, 5, "ESIAssign::ESIAssign: Variable name '" << attr[i+1] << "'");
/* If there are duplicate name attributes, we simply use the
* last one
*/
name = attr[i+1];
} else if (!strcmp(attr[i],"value")) {
/* short form assignment: */
- debug (86,5)("ESIAssign::ESIAssign: Unevaluated variable '%s'\n",attr[i+1]);
+ debugs(86, 5, "ESIAssign::ESIAssign: Unevaluated variable '" << attr[i+1] << "'");
/* Again, if there are duplicate attributes, we use the last */
unevaluatedVariable = attr[i+1];
} else {
value = NULL;
- debug (86,5) ("ESIAssign: Processed %p\n",this);
+ debugs(86, 5, "ESIAssign: Processed " << this);
return ESI_PROCESS_COMPLETE;
}
/*
- * $Id: ESIContext.cc,v 1.2 2003/07/14 14:15:56 robertc Exp $
+ * $Id: ESIContext.cc,v 1.3 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 86 ESI processing
* AUTHOR: Robert Collins
assert (http->storeEntry());
if (hasCachedAST()) {
- debug (86,5)("ESIContext::updateCachedAST: not updating AST cache for entry %p from ESI Context %p as there is already a cached AST.\n", http->storeEntry(), this);
+ debugs(86, 5, "ESIContext::updateCachedAST: not updating AST cache for entry " <<
+ http->storeEntry() << " from ESI Context " << this <<
+ " as there is already a cached AST.");
+
return;
}
ESIElement::Pointer treeToCache = tree->makeCacheable();
- debug (86,5)("ESIContext::updateCachedAST: Updating AST cache for entry %p with current value %p to new value %p\n", http->storeEntry(), http->storeEntry()->cachedESITree.getRaw(), treeToCache.getRaw());
+ debugs(86, 5, "ESIContext::updateCachedAST: Updating AST cache for entry " <<
+ http->storeEntry() << " with current value " <<
+ http->storeEntry()->cachedESITree.getRaw() << " to new value " <<
+ treeToCache.getRaw());
if (http->storeEntry()->cachedESITree.getRaw())
http->storeEntry()->cachedESITree->finish();
assert (http->storeEntry());
if (http->storeEntry()->cachedESITree.getRaw()) {
- debug (86,5)("ESIContext::hasCachedAST: %p - Cached AST present in store entry %p.\n", this, http->storeEntry());
+ debugs(86, 5, "ESIContext::hasCachedAST: " << this <<
+ " - Cached AST present in store entry " << http->storeEntry() << ".");
return true;
} else {
- debug (86,5)("ESIContext::hasCachedAST: %p - Cached AST not present in store entry %p.\n", this, http->storeEntry());
+ debugs(86, 5, "ESIContext::hasCachedAST: " << this <<
+ " - Cached AST not present in store entry " << http->storeEntry() << ".");
return false;
}
}
/*
- * $Id: ESICustomParser.cc,v 1.7 2005/07/03 15:25:08 serassio Exp $
+ * $Id: ESICustomParser.cc,v 1.8 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 86 ESI processing
* AUTHOR: Robert Collins
if (myOffset == bufferLength)
return NULL;
- debug (86,9)("ESICustomParser::findTag: found %d\n", *resulttype);
+ debugs(86, 9, "ESICustomParser::findTag: found " << *resulttype);
lastTag = *resulttype;
bool
ESICustomParser::parse(char const *dataToParse, size_t const lengthOfData, bool const endOfStream)
{
- debug (86,9)("ESICustomParser::parse: Appending data to internal buffer\n");
+ debugs(86, 9, "ESICustomParser::parse: Appending data to internal buffer");
content.append (dataToParse, lengthOfData);
if (!endOfStream) {
if (remainingCount)
theClient->parserDefault (currentPos,remainingCount);
- debug (86,5)("ESICustomParser::parse: Finished parsing, will return %d\n", !openESITags);
+ debugs(86, 5, "ESICustomParser::parse: Finished parsing, will return " << !openESITags);
if (openESITags)
error = "ESI Tags still open";
/*
- * $Id: ESIExpression.cc,v 1.4 2005/07/03 15:25:08 serassio Exp $
+ * $Id: ESIExpression.cc,v 1.5 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 86 ESI processing
* AUTHOR: Robert Collins
return 0;
} else {
/* TODO: numeric to string conversion ? */
- debug (86,1) ("strcmp with non-string\n");
+ debugs(86, 1, "strcmp with non-string");
return -2;
}
} else if (a.valuestored == ESI_LITERAL_FLOAT) {
return 1;
} else {
/* TODO: attempt numeric converson again? */
- debug (86,1) ("floatcomp with non float or int\n");
+ debugs(86, 1, "floatcomp with non float or int");
return -2;
}
} else if (a.valuestored == ESI_LITERAL_INT) {
return 1;
} else {
/* TODO: attempt numeric converson again? */
- debug (86,1) ("intcomp vs non float non int\n");
+ debugs(86, 1, "intcomp vs non float non int");
return -2;
}
}
int evalliteral
(stackmember * stack, int *depth, int whereAmI, stackmember * candidate)
{
- debug (86,1) ("attempt to evaluate a literal\n");
+ debugs(86, 1, "attempt to evaluate a literal");
/* literals can't be evaluated */
return 1;
}
int evalexpr
(stackmember * stack, int *depth, int whereAmI, stackmember * candidate)
{
- debug (86,1) ("attempt to evaluate a sub-expression result\n");
+ debugs(86, 1, "attempt to evaluate a sub-expression result");
/* sub-scpr's can't be evaluated */
return 1;
}
/* Something wrong upstream */
return 1;
- /* debug (86,1) ("?= %d \n", srv.value.integral); */
+ /* debugs(86, 1, "?= " << srv.value.integral << " "); */
return 0;
/* Something wrong upstream */
return 1;
- /* debug (86,1) ("?= %d \n", srv.value.integral); */
+ /* debugs(86, 1, "?= " << srv.value.integral << " "); */
return 0;
/* Something wrong upstream */
return 1;
- /* debug (86,1) ("?= %d \n", srv.value.integral); */
+ /* debugs(86, 1, "?= " << srv.value.integral << " "); */
return 0;
/* Something wrong upstream */
return 1;
- /* debug (86,1) ("?= %d \n", srv.value.integral); */
+ /* debugs(86, 1, "?= " << srv.value.integral << " "); */
return 0;
}
/* Something wrong upstream */
return 1;
- /* debug (86,1) ("?= %d \n", srv.value.integral); */
+ /* debugs(86, 1, "?= " << srv.value.integral << " "); */
return 0;
}
/* Something wrong upstream */
return 1;
- /* debug (86,1) ("?= %d \n", srv.value.integral); */
+ /* debugs(86, 1, "?= " << srv.value.integral << " "); */
return 0;
}
int evalstartexpr
(stackmember * stack, int *depth, int whereAmI, stackmember * candidate)
{
- /* debug (86,1) ("?(\n"); */
+ /* debugs(86, 1, "?("); */
if (whereAmI != *depth - 2)
/* invalid stack */
if (s == end || errno) {
/* Couldn't convert to float */
- debug (86,1) ("failed to convert '%s' to float \n", s);
+ debugs(86, 1, "failed to convert '" << s << "' to float ");
*endptr = origs;
} else {
debugs (86,6, "found " << rv.value.floating << " of length " << end - s);
if (s == end || errno) {
/* Couldn't convert to int */
- debug (86,1) ("failed to convert '%s' to int \n", s);
+ debugs(86, 1, "failed to convert '" << s << "' to int ");
*endptr = origs;
} else {
debugs (86,6, "found " << rv.value.integral << " of length " << end - s);
}
} else if ('!' == *s) {
if ('=' == *(s + 1)) {
- debug (86,6) ("found !=\n");
+ debugs(86, 6, "found !=");
*endptr = s + 2;
rv.eval = evalnotequals;
rv.valuetype = ESI_EXPR_NOTEQ;
rv.precedence = 5;
} else {
- debug (86,6) ("found !\n");
+ debugs(86, 6, "found !");
*endptr = s + 1;
rv.valuetype = ESI_EXPR_NOT;
rv.precedence = 4;
}
} else if ('\'' == *s) {
char const *t = s + 1;
- debug (86,6) ("found \'\n");
+ debugs(86, 6, "found \'");
while (*t != '\'' && *t)
++t;
if (!*t) {
- debug (86,1) ("missing end \' in '%s'\n", s);
+ debugs(86, 1, "missing end \' in '" << s << "'");
*endptr = origs;
} else {
*endptr = t + 1;
rv.precedence = 1;
- debug (86,6) ("found string '%s'\n", rv.value.string);
+ debugs(86, 6, "found string '" << rv.value.string << "'");
}
} else if ('(' == *s) {
- debug (86,6)("found subexpr start\n");
+ debugs(86, 6, "found subexpr start");
*endptr = s + 1;
rv.valuetype = ESI_EXPR_START;
rv.precedence = 5;
rv.eval = evalstartexpr;
} else if (')' == *s) {
- debug (86,6)("found subexpr end\n");
+ debugs(86, 6, "found subexpr end");
*endptr = s + 1;
rv.valuetype = ESI_EXPR_END;
rv.precedence = 0;
rv.eval = evalendexpr;
} else if ('&' == *s) {
- debug (86,6) ("found AND\n");
+ debugs(86, 6, "found AND");
*endptr = s + 1;
rv.valuetype = ESI_EXPR_AND;
rv.precedence = 3;
rv.eval = evaland;
} else if ('|' == *s) {
- debug (86,6) ("found OR\n");
+ debugs(86, 6, "found OR");
*endptr = s + 1;
rv.valuetype = ESI_EXPR_OR;
rv.precedence = 2;
rv.eval = evalor;
} else if ('=' == *s) {
if ('=' == *(s + 1)) {
- debug (86,6) ("found equals\n");
+ debugs(86, 6, "found equals");
*endptr = s + 2;
rv.valuetype = ESI_EXPR_EQ;
rv.precedence = 5;
rv.eval = evalequals;
} else {
- debug (86,1) ("invalid expr '%s'\n", s);
+ debugs(86, 1, "invalid expr '" << s << "'");
*endptr = origs;
}
} else if ('<' == *s) {
if ('=' == *(s + 1)) {
- debug (86,6) ("found less-equals\n");
+ debugs(86, 6, "found less-equals");
*endptr = s + 2;
rv.valuetype = ESI_EXPR_LESSEQ;
rv.precedence = 5;
rv.eval = evallesseq;
} else {
- debug (86,6) ("found less than\n");
+ debugs(86, 6, "found less than");
*endptr = s + 1;
rv.valuetype = ESI_EXPR_LESS;
rv.precedence = 5;
}
} else if ('>' == *s) {
if ('=' == *(s + 1)) {
- debug (86,6) ("found more-equals\n");
+ debugs(86, 6, "found more-equals");
*endptr = s + 2;
rv.valuetype = ESI_EXPR_MOREEQ;
rv.precedence = 5;
rv.eval = evalmoreeq;
} else {
- debug (86,6) ("found more than\n");
+ debugs(86, 6, "found more than");
*endptr = s + 1;
rv.valuetype = ESI_EXPR_MORE;
rv.precedence = 5;
rv.eval = evalmorethan;
}
} else if (!strncmp (s, "false", 5)) {
- debug (86,5)("getsymbol: found variable result 'false'\n");
+ debugs(86, 5, "getsymbol: found variable result 'false'");
*endptr = s + 5;
rv.valuetype = ESI_EXPR_EXPR;
rv.valuestored = ESI_LITERAL_BOOL;
rv.precedence = 1;
rv.eval = evalexpr;
} else if (!strncmp (s, "true", 4)) {
- debug (86,5)("getsymbol: found variable result 'true'\n");
+ debugs(86, 5, "getsymbol: found variable result 'true'");
*endptr = s + 4;
rv.valuetype = ESI_EXPR_EXPR;
rv.valuestored = ESI_LITERAL_BOOL;
rv.precedence = 1;
rv.eval = evalexpr;
} else {
- debug (86,1) ("invalid expr '%s'\n", s);
+ debugs(86, 1, "invalid expr '" << s << "'");
*endptr = origs;
}
switch (s.valuestored) {
case ESI_LITERAL_INVALID:
- debug (86,1) (" Invalid ");
+ debug(86, 1) ( " Invalid " );
break;
case ESI_LITERAL_FLOAT:
break;
case ESI_LITERAL_INT:
- debug (86,1) ("%d", s.value.integral);
+ debug (86,1) ("%d", s.value.integral);
break;
case ESI_LITERAL_BOOL:
/* cleanup candidate and stack */
dumpstack (stack, *stackdepth);
cleanmember (candidate);
- debug (86,1) ("invalid expression\n");
+ debugs(86, 1, "invalid expression");
return 0;
}
} else {
s = end;
} else {
assert (s == end);
- debug (86,1) ("failed parsing expression\n");
+ debugs(86, 1, "failed parsing expression");
PROF_stop(esiExpressionEval);
return 0;
}
if (stack[stackdepth - 2].
eval (stack, &stackdepth, stackdepth - 2, &rv)) {
/* special case - leading operator failed */
- debug (86,1) ("invalid expression\n");
+ debugs(86, 1, "invalid expression");
PROF_stop(esiExpressionEval);
return 0;
}
/*
- * $Id: ESIInclude.cc,v 1.11 2006/09/03 04:15:54 robertc Exp $
+ * $Id: ESIInclude.cc,v 1.12 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 86 ESI processing
* AUTHOR: Robert Collins
/* EOF / Read error / aborted entry */
if (rep == NULL && recievedData.data == NULL && recievedData.length == 0) {
/* TODO: get stream status to test the entry for aborts */
- debug (86,5)("Finished reading upstream data in subrequest\n");
+ debugs(86, 5, "Finished reading upstream data in subrequest");
esiStream->include->subRequestDone (esiStream, true);
esiStream->finished = 1;
httpRequestFree (http);
case STREAM_UNPLANNED_COMPLETE: /* fallthru ok */
case STREAM_COMPLETE: /* ok */
- debug (86,3)("ESI subrequest finished OK\n");
+ debugs(86, 3, "ESI subrequest finished OK");
esiStream->include->subRequestDone (esiStream, true);
esiStream->finished = 1;
httpRequestFree (http);
return;
case STREAM_FAILED:
- debug (86,1)("ESI subrequest failed transfer\n");
+ debugs(86, 1, "ESI subrequest failed transfer");
esiStream->include->fail (esiStream);
esiStream->finished = 1;
httpRequestFree (http);
/* now just read into 'buffer' */
clientStreamRead (node,
http, tempBuffer);
- debug (86,5)("esiBufferRecipient: Requested more data for ESI subrequest\n");
+ debugs(86, 5, "esiBufferRecipient: Requested more data for ESI subrequest");
}
break;
void
ESIStreamContext::freeResources()
{
- debug (86,5)("Freeing stream context resources.\n");
+ debugs(86, 5, "Freeing stream context resources.");
buffer = NULL;
localbuffer = NULL;
include = NULL;
/* ESIInclude */
ESIInclude::~ESIInclude()
{
- debug (86,5)("ESIInclude::Free %p\n", this);
+ debugs(86, 5, "ESIInclude::Free " << this);
ESISegmentFreeList (srccontent);
ESISegmentFreeList (altcontent);
cbdataReferenceDone (varState);
/* tempUrl is eaten by the request */
char const *tempUrl = vars->extractChar ();
- debug (86,5)("ESIIncludeStart: Starting subrequest with url '%s'\n", tempUrl);
+ debugs(86, 5, "ESIIncludeStart: Starting subrequest with url '" << tempUrl <<
+ "'");
if (clientBeginRequest(METHOD_GET, tempUrl, esiBufferRecipient, esiBufferDetach, stream.getRaw(), &tempheaders, stream->localbuffer->buf, HTTP_REQBUF_SZ)) {
- debug (86,0) ("starting new ESI subrequest failed\n");
+ debugs(86, 0, "starting new ESI subrequest failed");
}
tempheaders.clean();
for (i = 0; i < attrcount && attr[i]; i += 2) {
if (!strcmp(attr[i],"src")) {
/* Start a request for thisNode url */
- debug (86,5)("ESIIncludeNew: Requesting source '%s'\n",attr[i+1]);
+ debugs(86, 5, "ESIIncludeNew: Requesting source '" << attr[i+1] << "'");
+
/* TODO: don't assert on thisNode, ignore the duplicate */
assert (src.getRaw() == NULL);
src = ESIStreamContextNew (this);
/* TODO: make a config parameter to wait on requesting alt's
* for the src to fail
*/
- debug (86,5)("ESIIncludeNew: Requesting alternate '%s'\n",attr[i+1]);
+ debugs(86, 5, "ESIIncludeNew: Requesting alternate '" << attr[i+1] << "'");
+
assert (alt.getRaw() == NULL); /* TODO: FIXME */
alt = ESIStreamContextNew (this);
assert (alt.getRaw() != NULL);
flags.onerrorcontinue = 1;
} else {
/* ignore mistyped attributes */
- debug (86, 1)("invalid value for onerror='%s'\n", attr[i+1]);
+ debugs(86, 1, "invalid value for onerror='" << attr[i+1] << "'");
}
} else {
/* ignore mistyped attributes. TODO:? error on these for user feedback - config parameter needed
} else {
alt = NULL;
- debug (86,1)("ESIIncludeNew: esi:include with no src attributes\n");
+ debugs(86, 1, "ESIIncludeNew: esi:include with no src attributes");
flags.failed = 1;
}
ESISegment::Pointer myout;
- debug (86, 5)("ESIIncludeRender: Rendering include %p\n", this);
+ debugs(86, 5, "ESIIncludeRender: Rendering include " << this);
assert (flags.finished || (flags.failed && flags.onerrorcontinue));
/* Prevent refcount race leading to free */
Pointer me (this);
start();
- debug (86, 5)("ESIIncludeRender: Processing include %p\n", this);
+ debugs(86, 5, "ESIIncludeRender: Processing include " << this);
if (flags.failed) {
if (flags.onerrorcontinue)
return;
if (stream == src) {
- debug (86,3)("ESIInclude::subRequestDone: %s\n", srcurl);
+ debugs(86, 3, "ESIInclude::subRequestDone: " << srcurl);
if (success) {
/* copy the lead segment */
- debug (86,3)("ESIIncludeSubRequestDone: Src OK - include PASSED.\n");
+ debugs(86, 3, "ESIIncludeSubRequestDone: Src OK - include PASSED.");
assert (!srccontent.getRaw());
ESISegment::ListTransfer (stream->localbuffer, srccontent);
/* we're done! */
flags.finished = 1;
} else {
/* Fail if there is no alt being retrieved */
- debug (86,3)("ESIIncludeSubRequestDone: Src FAILED\n");
+ debugs(86, 3, "ESIIncludeSubRequestDone: Src FAILED");
if (!(alt.getRaw() || altcontent.getRaw())) {
- debug (86,3)("ESIIncludeSubRequestDone: Include FAILED - No ALT\n");
+ debugs(86, 3, "ESIIncludeSubRequestDone: Include FAILED - No ALT");
flags.failed = 1;
} else if (altcontent.getRaw()) {
- debug (86,3)("ESIIncludeSubRequestDone: Include PASSED - ALT already Complete\n");
+ debugs(86, 3, "ESIIncludeSubRequestDone: Include PASSED - ALT already Complete");
/* ALT was already retrieved, we are done */
flags.finished = 1;
}
src = NULL;
} else if (stream == alt) {
- debug (86,3)("ESIInclude::subRequestDone: %s\n", alturl);
+ debugs(86, 3, "ESIInclude::subRequestDone: " << alturl);
if (success) {
- debug (86,3)("ESIIncludeSubRequestDone: ALT OK.\n");
+ debugs(86, 3, "ESIIncludeSubRequestDone: ALT OK.");
/* copy the lead segment */
assert (!altcontent.getRaw());
ESISegment::ListTransfer (stream->localbuffer, altcontent);
if (!(src.getRaw() || srccontent.getRaw())) {
/* src already failed, kick ESI processor */
- debug (86,3)("ESIIncludeSubRequestDone: Include PASSED - SRC already failed.\n");
+ debugs(86, 3, "ESIIncludeSubRequestDone: Include PASSED - SRC already failed.");
flags.finished = 1;
}
} else {
if (!(src.getRaw() || srccontent.getRaw())) {
- debug (86,3)("ESIIncludeSubRequestDone: ALT FAILED, Include FAILED - SRC already failed\n");
+ debugs(86, 3, "ESIIncludeSubRequestDone: ALT FAILED, Include FAILED - SRC already failed");
/* src already failed */
flags.failed = 1;
}
/*
- * $Id: ESISegment.cc,v 1.3 2003/08/04 22:14:40 robertc Exp $
+ * $Id: ESISegment.cc,v 1.4 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 86 ESI processing
* AUTHOR: Robert Collins
{
String temp;
temp.limitInit(buf, len);
- debug (86, 9) ("ESISegment::dumpOne: \"%s\"\n", temp.buf());
+ debugs(86, 9, "ESISegment::dumpOne: \"" << temp.buf() << "\"");
}
/*
- * $Id: ESISequence.cc,v 1.5 2005/07/03 15:25:08 serassio Exp $
+ * $Id: ESISequence.cc,v 1.6 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 86 ESI processing
* AUTHOR: Robert Collins
esiSequence::~esiSequence ()
{
- debug (86,5)("esiSequence::~esiSequence %p\n", this);
+ debugs(86, 5, "esiSequence::~esiSequence " << this);
}
esiSequence::esiSequence(esiTreeParentPtr aParent, bool incrementalFlag) : elements(), parent (aParent), mayFail_(true), failed (false), provideIncrementalData (incrementalFlag), processing (false), processingResult (ESI_PROCESS_COMPLETE), nextElementToProcess_ (0)
void
esiSequence::finish()
{
- debug (86,5) ("esiSequence::finish: %p is finished\n", this);
+ debugs(86, 5, "esiSequence::finish: " << this << " is finished");
elements.setNULL(0, elements.size());
parent = NULL;
}
ESIElement::Pointer lockthis = this;
if (processing)
- debug (86,5) ("esiSequence::provideData: %p data provided during processing\n", this);
+ debugs(86, 5, "esiSequence::provideData: " << this << " data provided during processing");
+ debugs(86, 5, "esiSequence::provideData " << this << " " << data.getRaw() << " " << source);
- debug (86,5) ("esiSequence::provideData %p %p %p\n", this, data.getRaw(), source);
/* when data is provided, the element *must* be completed */
/* XXX: when the callback model is complete,
if (dynamic_cast<esiAttempt*>(element.getRaw()) ||
dynamic_cast<esiExcept*>(element.getRaw())) {
- debug (86,0)("esiSequenceAdd: misparented Attempt or Except element (section 3.4)\n");
+ debugs(86, 0, "esiSequenceAdd: misparented Attempt or Except element (section 3.4)");
return false;
}
/* Tie literals together for efficiency */
if (elements.size() && dynamic_cast<esiLiteral*>(element.getRaw()) &&
dynamic_cast<esiLiteral*>(elements[elements.size() - 1].getRaw())) {
- debug (86,5)("esiSequenceAdd: tying Literals %p and %p together\n", elements[elements.size() - 1].getRaw(),
- element.getRaw());
+ debugs(86, 5, "esiSequenceAdd: tying Literals " <<
+ elements[elements.size() - 1].getRaw() << " and " <<
+ element.getRaw() << " together");
+
ESISegment::ListTransfer (((esiLiteral *)element.getRaw())->buffer,
((esiLiteral *)elements[elements.size() - 1].getRaw())->buffer);
return true;
esiProcessResult_t tempResult = processOne(dovars, elementToProcess);
if (processingResult < tempResult) {
- debug (86,5)("esiSequence::process: processingResult was %d, increasing to %d\n", processingResult, tempResult);
+ debugs(86, 5, "esiSequence::process: processingResult was " << processingResult << ", increasing to " << tempResult);
processingResult = tempResult;
}
}
switch (elements[index]->process(dovars)) {
case ESI_PROCESS_COMPLETE:
- debug (86,5)("esiSequenceProcess: %p element %p Processed OK\n",
- this, elements[index].getRaw());
+ debugs(86, 5, "esiSequenceProcess: " << this << " element " << elements[index].getRaw() << " Processed OK");
if (index == processedcount)
/* another completely ready */
return ESI_PROCESS_COMPLETE;
case ESI_PROCESS_PENDING_WONTFAIL:
- debug (86,5)("esiSequenceProcess: element Processed PENDING OK\n");
+ debugs(86, 5, "esiSequenceProcess: element Processed PENDING OK");
return ESI_PROCESS_PENDING_WONTFAIL;
case ESI_PROCESS_PENDING_MAYFAIL:
- debug (86,5)("eseSequenceProcess: element Processed PENDING UNKNOWN\n");
+ debugs(86, 5, "eseSequenceProcess: element Processed PENDING UNKNOWN");
return ESI_PROCESS_PENDING_MAYFAIL;
case ESI_PROCESS_FAILED:
- debug (86,5)("esiSequenceProcess: element Processed FAILED\n");
+ debugs(86, 5, "esiSequenceProcess: element Processed FAILED");
return ESI_PROCESS_FAILED;
esiProcessResult_t
esiSequence::process (int inheritedVarsFlag)
{
- debug (86,5) ("esiSequence::process: %p processing\n", this);
+ debugs(86, 5, "esiSequence::process: " << this << " processing");
if (processing) {
- debug (86,5)("esiSequence::process: %p reentry attempt during processing\n", this);
+ debugs(86, 5, "esiSequence::process: " << this <<
+ " reentry attempt during processing");
}
/* process as much of the list as we can, stopping only on
if (flags.dovars)
dovars = 1;
- debug (86,5)("esiSequence::process: Processing %p with%s variable processing\n", this, dovars ? "" : "out");
+ debugs(86, 5, "esiSequence::process: Processing " << this << " with" <<
+ (dovars ? "" : "out") << " variable processing");
processing = true;
if (processedcount == elements.size())
parent = NULL;
- debug (86,5)("esiSequence::process: %p completed\n", this);
+ debugs(86, 5, "esiSequence::process: " << this << " completed");
processing = false;
failed = true;
if (processing) {
- debug (86,5) ("esiSequence::fail: %p failure callback during processing\n", this);
+ debugs(86, 5, "esiSequence::fail: " << this << " failure callback during processing");
return;
}
- debug (86,5)("esiSequence::fail: %p has failed.\n", this);
+ debugs(86, 5, "esiSequence::fail: " << this << " has failed.");
parent->fail (this, anError);
elements.setNULL(0, elements.size());
parent = NULL;
ESIElement::Pointer
esiSequence::makeCacheable() const
{
- debug (86,5)("esiSequence::makeCacheable: Making cachable sequence from %p\n", this);
+ debugs(86, 5, "esiSequence::makeCacheable: Making cachable sequence from " << this);
assert (processedcount == 0);
assert (!failed);
if (elements.size() == 0) {
- debug (86,5)("esiSequence::makeCacheable: No elements in sequence %p, returning NULL\n", this);
+ debugs(86, 5, "esiSequence::makeCacheable: No elements in sequence " << this << ", returning NULL");
return NULL;
}
esiSequence * resultS = new esiSequence (*this);
ESIElement::Pointer result = resultS;
resultS->makeCachableElements(*this);
- debug (86,5)("esiSequence::makeCacheable: %p created %p\n", this, result.getRaw());
+ debugs(86, 5, "esiSequence::makeCacheable: " << this << " created " << result.getRaw());
return result;
}
ESIElement::Pointer
esiSequence::makeUsable(esiTreeParentPtr newParent, ESIVarState &newVarState) const
{
- debug (86,5)("esiSequence::makeUsable: Creating usable Sequence\n");
+ debugs(86, 5, "esiSequence::makeUsable: Creating usable Sequence");
assert (processedcount == 0);
assert (!failed);
if (elements.size() == 0) {
- debug (86,5)("esiSequence::makeUsable: No elements in sequence %p, returning NULL\n", this);
+ debugs(86, 5, "esiSequence::makeUsable: No elements in sequence " << this << ", returning NULL");
return NULL;
}
/*
- * $Id: ESIVarState.cc,v 1.7 2006/05/06 22:23:44 wessels Exp $
+ * $Id: ESIVarState.cc,v 1.8 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 86 ESI processing
* AUTHOR: Robert Collins
doIt();
ESISegment::Pointer rv = output;
output = NULL;
- debug (86,6)("ESIVarStateExtractList: Extracted list\n");
+ debugs(86, 6, "ESIVarStateExtractList: Extracted list");
return rv;
}
ESISegmentFreeList (output);
- debug (86,6)("ESIVarStateExtractList: Extracted char\n");
+ debugs(86, 6, "ESIVarStateExtractList: Extracted char");
return rv;
}
if (query) {
unsigned int n = 0;
- debug (86,6)("esiVarStateNew: Parsed Query string: '%s'\n",uri);
+ debugs(86, 6, "esiVarStateNew: Parsed Query string: '" << uri << "'");
while (n < query_elements) {
- debug (86,6)("esiVarStateNew: Parsed Query element %d '%s'='%s'\n",n + 1, query[n].var, query[n].val);
+ debugs(86, 6, "esiVarStateNew: Parsed Query element " << n + 1 << " '" << query[n].var << "'='" << query[n].val << "'");
++n;
}
}
safe_free(found_default);
state = LOOKFORSTART;
} else if (!found_subref && !found_default && string[pos] == '{') {
- debug (86,6)("ESIVarStateDoIt: Subref of some sort\n");
+ debugs(86, 6, "ESIVarStateDoIt: Subref of some sort");
/* subreference of some sort */
/* look for the entry name */
var_pos = ++pos;
state = 4;
} else if (!found_default && string[pos] == '|') {
- debug (86,6)("esiVarStateDoIt: Default present\n");
+ debugs(86, 6, "esiVarStateDoIt: Default present");
/* extract default value */
state = 5;
var_pos = ++pos;
} else {
/* unexpected char, not a variable after all */
- debug (86,6)("esiVarStateDoIt: unexpected char after varname\n");
+ debugs(86, 6, "esiVarStateDoIt: unexpected char after varname");
state = LOOKFORSTART;
pos = done_pos + 2;
}
if (string[pos] == '}') {
/* end of subref */
found_subref = xstrndup (&string[var_pos], pos - var_pos + 1);
- debug (86,6)("esiVarStateDoIt: found end of variable subref '%s'\n", found_subref);
+ debugs(86, 6, "esiVarStateDoIt: found end of variable subref '" << found_subref << "'");
state = 3;
++pos;
} else if (!validChar (string[pos])) {
- debug (86,6)("esiVarStateDoIt: found invalid char in variable subref\n");
+ debugs(86, 6, "esiVarStateDoIt: found invalid char in variable subref");
/* not a valid subref */
safe_free(found_subref);
state = LOOKFORSTART;
if (string[pos] == '\'') {
/* begins with a quote */
- debug (86,6)("esiVarStateDoIt: found quoted default\n");
+ debugs(86, 6, "esiVarStateDoIt: found quoted default");
state = 6;
var_pos = ++pos;
} else {
/* doesn't */
- debug (86,6)("esiVarStateDoIt: found unquoted default\n");
+ debugs(86, 6, "esiVarStateDoIt: found unquoted default");
state = 7;
++pos;
}
if (string[pos] == '\'') {
/* end of default */
found_default = xstrndup (&string[var_pos], pos - var_pos + 1);
- debug (86,6)("esiVarStateDoIt: found end of quoted default '%s'\n", found_default);
+ debugs(86, 6, "esiVarStateDoIt: found end of quoted default '" << found_default << "'");
state = 3;
}
if (string[pos] == ')') {
/* end of default - end of variable*/
found_default = xstrndup (&string[var_pos], pos - var_pos + 1);
- debug (86,6)("esiVarStateDoIt: found end of variable (w/ unquoted default) '%s'\n",found_default);
+ debugs(86, 6, "esiVarStateDoIt: found end of variable (w/ unquoted default) '" << found_default << "'");
eval(vartype,found_subref, found_default);
done_pos = ++pos;
safe_free(found_default);
/*
- * $Id: HttpHdrCc.cc,v 1.28 2005/09/15 19:04:56 wessels Exp $
+ * $Id: HttpHdrCc.cc,v 1.29 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 65 HTTP Cache Control Header
* AUTHOR: Alex Rousskov
CcFieldsInfo, CC_ENUM_END);
if (type < 0) {
- debug(65, 2) ("hdr cc: unknown cache-directive: near '%s' in '%s'\n", item, str->buf());
+ debugs(65, 2, "hdr cc: unknown cache-directive: near '" << item << "' in '" << str->buf() << "'");
type = CC_OTHER;
}
if (EBIT_TEST(cc->mask, type)) {
if (type != CC_OTHER)
- debug(65, 2) ("hdr cc: ignoring duplicate cache-directive: near '%s' in '%s'\n", item, str->buf());
+ debugs(65, 2, "hdr cc: ignoring duplicate cache-directive: near '" << item << "' in '" << str->buf() << "'");
CcFieldsInfo[type].stat.repCount++;
case CC_MAX_AGE:
if (!p || !httpHeaderParseInt(p, &cc->max_age)) {
- debug(65, 2) ("cc: invalid max-age specs near '%s'\n", item);
+ debugs(65, 2, "cc: invalid max-age specs near '" << item << "'");
cc->max_age = -1;
EBIT_CLR(cc->mask, type);
}
case CC_S_MAXAGE:
if (!p || !httpHeaderParseInt(p, &cc->s_maxage)) {
- debug(65, 2) ("cc: invalid s-maxage specs near '%s'\n", item);
+ debugs(65, 2, "cc: invalid s-maxage specs near '" << item << "'");
cc->s_maxage = -1;
EBIT_CLR(cc->mask, type);
}
case CC_MAX_STALE:
if (!p || !httpHeaderParseInt(p, &cc->max_stale)) {
- debug(65, 2) ("cc: max-stale directive is valid without value\n");
+ debugs(65, 2, "cc: max-stale directive is valid without value");
cc->max_stale = -1;
}
/*
- * $Id: HttpHdrContRange.cc,v 1.17 2003/02/21 22:50:05 robertc Exp $
+ * $Id: HttpHdrContRange.cc,v 1.18 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 68 HTTP Content-Range Header
* AUTHOR: Alex Rousskov
/* check format, must be %d-%d */
if (!((p = strchr(field, '-')) && (p - field < flen))) {
- debug(68, 2) ("invalid (no '-') resp-range-spec near: '%s'\n", field);
+ debugs(68, 2, "invalid (no '-') resp-range-spec near: '" << field << "'");
return 0;
}
/* we managed to parse, check if the result makes sence */
if (known_spec((size_t)spec->length) && spec->length == 0) {
- debug(68, 2) ("invalid range (%ld += %ld) in resp-range-spec near: '%s'\n",
- (long int) spec->offset, (long int) spec->length, field);
+ debugs(68, 2, "invalid range (" << (long int) spec->offset << " += " <<
+ (long int) spec->length << ") in resp-range-spec near: '" << field << "'");
return 0;
}
{
const char *p;
assert(range && str);
- debug(68, 8) ("parsing content-range field: '%s'\n", str);
+ debugs(68, 8, "parsing content-range field: '" << str << "'");
/* check range type */
if (strncasecmp(str, "bytes ", 6))
else if (!httpHeaderParseSize(p, &range->elength))
return 0;
- debug(68, 8) ("parsed content-range field: %ld-%ld / %ld\n",
- (long int) range->spec.offset, (long int) range->spec.offset + range->spec.length - 1,
- (long int) range->elength);
+ debugs(68, 8, "parsed content-range field: " <<
+ (long int) range->spec.offset << "-" <<
+ (long int) range->spec.offset + range->spec.length - 1 << " / " <<
+ (long int) range->elength);
return 1;
}
/*
- * $Id: HttpHdrRange.cc,v 1.40 2006/06/06 19:22:13 hno Exp $
+ * $Id: HttpHdrRange.cc,v 1.41 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 64 HTTP Range Header
* AUTHOR: Alex Rousskov
} else
/* must have a '-' somewhere in _this_ field */
if (!((p = strchr(field, '-')) || (p - field >= flen))) {
- debug(64, 2) ("ignoring invalid (missing '-') range-spec near: '%s'\n", field);
+ debugs(64, 2, "ignoring invalid (missing '-') range-spec near: '" << field << "'");
return false;
} else {
if (!httpHeaderParseSize(field, &offset))
/* we managed to parse, check if the result makes sence */
if (length == 0) {
- debug(64, 2) ("ignoring invalid (zero length) range-spec near: '%s'\n", field);
+ debugs(64, 2, "ignoring invalid (zero length) range-spec near: '" << field << "'");
return false;
}
void
HttpHdrRangeSpec::outputInfo( char const *note) const
{
- debug(64, 5) ("HttpHdrRangeSpec::canonize: %s: [%ld, %ld) len: %ld\n",
- note, (long int) offset, (long int) offset + length, (long int) length);
+ debugs(64, 5, "HttpHdrRangeSpec::canonize: " << note << ": [" <<
+ (long int) offset << ", " << (long int) offset + length <<
+ ") len: " << (long int) length);
}
/* fills "absent" positions in range specification based on response body size
int count = 0;
assert(this && range_spec);
++ParsedCount;
- debug(64, 8) ("parsing range field: '%s'\n", range_spec->buf());
+ debugs(64, 8, "parsing range field: '" << range_spec->buf() << "'");
/* check range type */
if (range_spec->caseCmp("bytes=", 6))
ssize_t
HttpHdrRangeIter::debt() const
{
- debug(64, 3) ("HttpHdrRangeIter::debt: debt is %d\n",
- (int)debt_size);
+ debugs(64, 3, "HttpHdrRangeIter::debt: debt is " << (int)debt_size);
return debt_size;
}
void HttpHdrRangeIter::debt(ssize_t newDebt)
{
- debug(64, 3) ("HttpHdrRangeIter::debt: was %d now %d\n",
- (int)debt_size, (int)newDebt);
+ debugs(64, 3, "HttpHdrRangeIter::debt: was " << (int)debt_size << " now " << (int)newDebt);
debt_size = newDebt;
}
/*
- * $Id: HttpHdrSc.cc,v 1.3 2006/04/22 05:29:17 robertc Exp $
+ * $Id: HttpHdrSc.cc,v 1.4 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 90 HTTP Cache Control Header
* AUTHOR: Alex Rousskov
ScFieldsInfo, SC_ENUM_END);
if (type < 0) {
- debug(90, 2) ("hdr sc: unknown control-directive: near '%s' in '%s'\n", item, str->buf());
+ debugs(90, 2, "hdr sc: unknown control-directive: near '" << item << "' in '" << str->buf() << "'");
type = SC_OTHER;
}
if (EBIT_TEST(sct->mask, type)) {
if (type != SC_OTHER)
- debug(90, 2) ("hdr sc: ignoring duplicate control-directive: near '%s' in '%s'\n", item, str->buf());
+ debugs(90, 2, "hdr sc: ignoring duplicate control-directive: near '" << item << "' in '" << str->buf() << "'");
ScFieldsInfo[type].stat.repCount++;
case SC_MAX_AGE:
if (!p || !httpHeaderParseInt(p, &sct->max_age)) {
- debug(90, 2) ("sc: invalid max-age specs near '%s'\n", item);
+ debugs(90, 2, "sc: invalid max-age specs near '" << item << "'");
sct->max_age = -1;
EBIT_CLR(sct->mask, type);
}
if ((p = strchr (p, '+')))
if (!httpHeaderParseInt(++p, &sct->max_stale)) {
- debug(90, 2) ("sc: invalid max-stale specs near '%s'\n", item);
+ debugs(90, 2, "sc: invalid max-stale specs near '" << item << "'");
sct->max_stale = 0;
/* leave the max-age alone */
}
case SC_CONTENT:
if (!p || !httpHeaderParseQuotedString(p, &sct->content)) {
- debug (90, 2) ("sc: invalid content= quoted string near '%s'\n",item);
+ debugs(90, 2, "sc: invalid content= quoted string near '" << item << "'");
sct->content.clean();
EBIT_CLR(sct->mask, type);
}
/*
- * $Id: HttpHeader.cc,v 1.128 2007/04/21 13:34:42 adrian Exp $
+ * $Id: HttpHeader.cc,v 1.129 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 55 HTTP Header
* AUTHOR: Alex Rousskov
}
if (e->id == HDR_OTHER && stringHasWhitespace(e->name.buf())) {
- debug(55, Config.onoff.relaxed_header_parser <= 0 ? 1 : 2)
- ("WARNING: found whitespace in HTTP header name {%s}\n", getStringPrefix(field_start, field_end));
+ debugs(55, Config.onoff.relaxed_header_parser <= 0 ? 1 : 2,
+ "WARNING: found whitespace in HTTP header name {" <<
+ getStringPrefix(field_start, field_end) << "}");
if (!Config.onoff.relaxed_header_parser) {
delete e;
HttpHeaderEntry::~HttpHeaderEntry()
{
assert_eid(id);
- debug(55, 9) ("destroying entry %p: '%s: %s'\n", this, name.buf(), value.buf());
+ debugs(55, 9, "destroying entry " << this << ": '" << name.buf() << ": " << value.buf() << "'");
/* clean name if needed */
if (id == HDR_OTHER)
}
if (Config.onoff.relaxed_header_parser && xisspace(field_start[name_len - 1])) {
- debug(55, Config.onoff.relaxed_header_parser <= 0 ? 1 : 2)
- ("NOTICE: Whitespace after header name in '%s'\n", getStringPrefix(field_start, field_end));
+ debugs(55, Config.onoff.relaxed_header_parser <= 0 ? 1 : 2,
+ "NOTICE: Whitespace after header name in '" << getStringPrefix(field_start, field_end) << "'");
while (name_len > 0 && xisspace(field_start[name_len - 1]))
name_len--;
/* now we know we can parse it */
- debug(55, 9) ("parsing HttpHeaderEntry: near '%s'\n", getStringPrefix(field_start, field_end));
+ debugs(55, 9, "parsing HttpHeaderEntry: near '" << getStringPrefix(field_start, field_end) << "'");
/* is it a "known" field? */
http_hdr_type id = httpHeaderIdByName(field_start, name_len, Headers, HDR_ENUM_END);
if (field_end - value_start > 65534) {
/* String must be LESS THAN 64K and it adds a terminating NULL */
- debug(55, 1) ("WARNING: ignoring '%s' header of %d bytes\n",
- name.buf(), (int) (field_end - value_start));
+ debugs(55, 1, "WARNING: ignoring '" << name.buf() << "' header of " << (int) (field_end - value_start) << " bytes");
if (id == HDR_OTHER)
name.clean();
Headers[id].stat.aliveCount++;
- debug(55, 9) ("parsed HttpHeaderEntry: '%s: %s'\n", name.buf(), value.buf());
+ debugs(55, 9, "parsed HttpHeaderEntry: '" << name.buf() << ": " << value.buf() << "'");
return new HttpHeaderEntry(id, name.buf(), value.buf());
}
if (error) {
Headers[id].stat.errCount++;
- debug(55, 2) ("cannot parse hdr field: '%s: %s'\n",
- Headers[id].name.buf(), context.buf());
+ debugs(55, 2, "cannot parse hdr field: '" << Headers[id].name.buf() << ": " << context.buf() << "'");
}
}
/*
- * $Id: HttpHeaderTools.cc,v 1.57 2007/04/20 07:29:47 wessels Exp $
+ * $Id: HttpHeaderTools.cc,v 1.58 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 66 HTTP Header Tools
* AUTHOR: Alex Rousskov
*value = atoi(start);
if (!*value && !xisdigit(*start)) {
- debug(66, 2) ("failed to parse an int header field near '%s'\n", start);
+ debugs(66, 2, "failed to parse an int header field near '" << start << "'");
return 0;
}
while (1) {
if (!(end = index (pos,'"'))) {
- debug (66, 2) ("failed to parse a quoted-string header field near '%s'\n", start);
+ debugs(66, 2, "failed to parse a quoted-string header field near '" << start << "'");
return 0;
}
/*
- * $Id: HttpMsg.cc,v 1.41 2007/04/06 12:15:51 serassio Exp $
+ * $Id: HttpMsg.cc,v 1.42 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 74 HTTP Message
* AUTHOR: Alex Rousskov
hdr->bufsiz = bufsiz;
hdr->req_start = hdr->req_end = -1;
hdr->hdr_start = hdr->hdr_end = -1;
- debug(74, 5)("httpParseInit: Request buffer is %s\n", buf);
+ debugs(74, 5, "httpParseInit: Request buffer is " << buf);
}
#if MSGDODEBUG
int maj = -1, min = -1;
int last_whitespace = -1, line_end = -1;
- debug(74, 5)("httpParserParseReqLine: parsing %s\n", hmsg->buf);
+ debugs(74, 5, "httpParserParseReqLine: parsing " << hmsg->buf);
PROF_start(HttpParserParseReqLine);
/* Find \r\n - end of URL+Version (and the request) */
hmsg->v_maj = maj;
hmsg->v_min = min;
PROF_stop(HttpParserParseReqLine);
- debug(74, 5) ("Parser: retval %d: from %d->%d: method %d->%d; url %d->%d; version %d->%d (%d/%d)\n",
- retcode, hmsg->req_start, hmsg->req_end,
- hmsg->m_start, hmsg->m_end,
- hmsg->u_start, hmsg->u_end,
- hmsg->v_start, hmsg->v_end, maj, min);
+ debugs(74, 5, "Parser: retval " << retcode << ": from " << hmsg->req_start <<
+ "->" << hmsg->req_end << ": method " << hmsg->m_start << "->" <<
+ hmsg->m_end << "; url " << hmsg->u_start << "->" << hmsg->u_end <<
+ "; version " << hmsg->v_start << "->" << hmsg->v_end << " (" << maj <<
+ "/" << min << ")");
+
return retcode;
}
/*
- * $Id: HttpRequest.cc,v 1.72 2007/04/16 17:43:27 rousskov Exp $
+ * $Id: HttpRequest.cc,v 1.73 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 73 HTTP Request
* AUTHOR: Duane Wessels
*/
if (METHOD_NONE == HttpRequestMethod(buf->content())) {
- debug(73, 3)("HttpRequest::sanityCheckStartLine: did not find HTTP request method\n");
+ debugs(73, 3, "HttpRequest::sanityCheckStartLine: did not find HTTP request method");
return false;
}
end++; // back to space
if (2 != sscanf(ver + 5, "%d.%d", &http_ver.major, &http_ver.minor)) {
- debug(73, 1) ("parseRequestLine: Invalid HTTP identifier.\n");
+ debugs(73, 1, "parseRequestLine: Invalid HTTP identifier.");
return false;
}
} else {
void
request_flags::setResetTCP()
{
- debug (73, 9) ("request_flags::setResetTCP\n");
+ debugs(73, 9, "request_flags::setResetTCP");
reset_tcp = 1;
}
void
request_flags::clearResetTCP()
{
- debug(73, 9) ("request_flags::clearResetTCP\n");
+ debugs(73, 9, "request_flags::clearResetTCP");
reset_tcp = 0;
}
/*
- * $Id: HttpRequestMethod.cc,v 1.2 2007/03/03 18:25:05 hno Exp $
+ * $Id: HttpRequestMethod.cc,v 1.3 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 73 HTTP Request
* AUTHOR: Duane Wessels
for (++method; method < METHOD_ENUM_END; ++method) {
if (0 == strcmp(mstr, RequestMethodStr[method])) {
- debug(23, 2) ("Extension method '%s' already exists\n", mstr);
+ debugs(23, 2, "Extension method '" << mstr << "' already exists");
return;
}
/* Don't free statically allocated "%EXTnn" string */
RequestMethodStr[method] = xstrdup(mstr);
- debug(23, 1) ("Extension method '%s' added, enum=%d\n", mstr, (int) method);
+ debugs(23, 1, "Extension method '" << mstr << "' added, enum=" << (int) method);
return;
}
- debug(23, 1) ("WARNING: Could not add new extension method '%s' due to lack of array space\n", mstr);
+ debugs(23, 1, "WARNING: Could not add new extension method '" << mstr << "' due to lack of array space");
}
void
/*
- * $Id: HttpStatusLine.cc,v 1.30 2005/09/14 20:56:33 wessels Exp $
+ * $Id: HttpStatusLine.cc,v 1.31 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 57 HTTP Status-line
* AUTHOR: Alex Rousskov
httpStatusLinePackInto(const HttpStatusLine * sline, Packer * p)
{
assert(sline && p);
- debug(57, 9) ("packing sline %p using %p:\n", sline, p);
+ debugs(57, 9, "packing sline " << sline << " using " << p << ":");
debug(57, 9) (HttpStatusLineFormat, sline->version.major,
sline->version.minor, sline->status,
sline->reason ? sline->reason : httpStatusString(sline->status));
return 0;
if (sscanf(start, "%d.%d", &sline->version.major, &sline->version.minor) != 2) {
- debug(57, 7) ("httpStatusLineParse: Invalid HTTP identifier.\n");
+ debugs(57, 7, "httpStatusLineParse: Invalid HTTP identifier.");
}
if (!(start = strchr(start, ' ')))
default:
p = "Unknown";
- debug(57, 3) ("Unknown HTTP status code: %d\n", status);
+ debugs(57, 3, "Unknown HTTP status code: " << status);
break;
}
assert (thisNode != NULL);
assert (cbdataReferenceValid (thisNode));
- debug(0,0)("This is icapclientProcessStream\n");
- debug(0,0)("\tthisNode=%p\n", thisNode);
- debug(0,0)("\thttp=%p\n", http);
- debug(0,0)("\trep=%p\n", rep);
- //debug(0,0)("\trep->content_length=%d\n", rep->content_length);
+ debugs(0, 0, "This is icapclientProcessStream");
+ debugs(0, 0, "\tthisNode=" << thisNode);
+ debugs(0, 0, "\thttp=" << http);
+ debugs(0, 0, "\trep=" << rep);
+ debugs(0, 0, "\trep->content_length=" << rep->content_length);
char *foo;
foo = new char[receivedData.length+1];
xstrncpy(foo, receivedData.data, receivedData.length+1);
*(foo+receivedData.length) = '\0';
- debug(0,0)("{%s}\n", foo);
+ debugs(0, 0, "{" << foo << "}");
struct _junk *j = (struct _junk *) xcalloc(1, sizeof(*j));
j->node = thisNode;
void
icapclientStreamRead(clientStreamNode *thisNode, clientHttpRequest *http)
{
- debug(0,0)("This is icapclientStreamRead\n");
+ debugs(0, 0, "This is icapclientStreamRead");
/* pass data through untouched */
clientStreamNode *next = thisNode->next();
void
icapclientStreamDetach(clientStreamNode *thisNode, clientHttpRequest *http)
{
- debug(0,0)("This is icapclientStreamDetach\n");
+ debugs(0, 0, "This is icapclientStreamDetach");
}
clientStream_status_t
icapclientStreamStatus(clientStreamNode *thisNode, clientHttpRequest *http)
{
- debug(0,0)("This is icapclientStreamStatus\n");
+ debugs(0, 0, "This is icapclientStreamStatus");
/* pass data through untouched */
return clientStreamStatus (thisNode, http);
static void
someEvent(void *foo)
{
- debug(0,0)("this is someEvent\n");
+ debugs(0, 0, "this is someEvent");
struct _junk *j = (struct _junk *) foo;
/*
- * $Id: ICAPConfig.cc,v 1.13 2007/04/06 04:50:07 rousskov Exp $
+ * $Id: ICAPConfig.cc,v 1.14 2007/04/28 22:26:48 hno Exp $
*
* SQUID Web Proxy Cache http://www.squid-cache.org/
* ----------------------------------------------------------
acl_checklist = NULL;
- debug(93,5)("ICAPAccessCheck constructed for %s %s\n",
- ICAP::methodStr(method),
- ICAP::vectPointStr(point));
+ debugs(93, 5, "ICAPAccessCheck constructed for " << ICAP::methodStr(method) << " " << ICAP::vectPointStr(point));
}
ICAPAccessCheck::~ICAPAccessCheck()
void
ICAPAccessCheck::check()
{
- debug(93,3)("ICAPAccessCheck::check\n");
+ debugs(93, 3, "ICAPAccessCheck::check");
Vector<ICAPClass*>::iterator ci;
for (ci = TheICAPConfig.classes.begin(); ci != TheICAPConfig.classes.end(); ++ci) {
ICAPClass *c = *ci;
ICAPServiceRep::Pointer service = findBestService(c, false);
if (service != NULL) {
- debug(93,3)("ICAPAccessCheck::check: class '%s' has candidate service '%s'\n", c->key.buf(), service->key.buf());
+ debugs(93, 3, "ICAPAccessCheck::check: class '" << c->key.buf() << "' has candidate service '" << service->key.buf() << "'");
candidateClasses += c->key;
}
}
* when there are no canidates, set matchedClass to NULL string
* and call the wrapper with answer = 1
*/
- debug(93,3)("ICAPAccessCheck::check: NO candidates or matches found\n");
+ debugs(93, 3, "ICAPAccessCheck::check: NO candidates or matches found");
matchedClass.clean();
void
ICAPAccessCheck::ICAPAccessCheckCallbackWrapper(int answer, void *data)
{
- debug(93,5)("ICAPAccessCheckCallbackWrapper: answer=%d\n", answer);
+ debugs(93, 5, "ICAPAccessCheckCallbackWrapper: answer=" << answer);
ICAPAccessCheck *ac = (ICAPAccessCheck*)data;
if (ac->matchedClass.size()) {
- debug(93,5)("ICAPAccessCheckCallbackWrapper matchedClass = %s\n",
- ac->matchedClass.buf());
+ debugs(93, 5, "ICAPAccessCheckCallbackWrapper matchedClass = " << ac->matchedClass.buf());
}
if (!answer) {
void
ICAPAccessCheck::ICAPAccessCheckCallbackEvent(void *data)
{
- debug(93,5)("ICAPAccessCheckCallbackEvent\n");
+ debugs(93, 5, "ICAPAccessCheckCallbackEvent");
ICAPAccessCheck *ac = (ICAPAccessCheck*)data;
ac->do_callback();
delete ac;
void
ICAPAccessCheck::do_callback()
{
- debug(93,3)("ICAPAccessCheck::do_callback\n");
+ debugs(93, 3, "ICAPAccessCheck::do_callback");
if (matchedClass.size()) {
- debug(93,3)("ICAPAccessCheck::do_callback matchedClass = %s\n", matchedClass.buf());
+ debugs(93, 3, "ICAPAccessCheck::do_callback matchedClass = " << matchedClass.buf());
}
void *validated_cbdata;
debugs(93, 5, HERE << "swan sings" << status());
if (initiator) {
-debugs(93, 2, HERE << "swan sings for " << stopReason << status());
+ debugs(93, 2, HERE << "swan sings for " << stopReason << status());
AsyncCall(93,5, initiator, ICAPInitiator::noteIcapHeadersAborted);
cbdataReferenceDone(initiator);
}
ConfigParser::ParseBool(&bypass);
ConfigParser::ParseString(&uri);
- debug(3, 5) ("ICAPService::parseConfigLine (line %d): %s %s %d\n", config_lineno, key.buf(), service_type, bypass);
+ debugs(3, 5, "ICAPService::parseConfigLine (line " << config_lineno << "): " << key.buf() << " " << service_type << " " << bypass);
method = parseMethod(service_type);
point = parseVectPoint(service_type);
- debug(3, 5) ("ICAPService::parseConfigLine (line %d): service is %s_%s\n", config_lineno, methodStr(), vectPointStr());
+ debugs(3, 5, "ICAPService::parseConfigLine (line " << config_lineno << "): service is " << methodStr() << "_" << vectPointStr());
if (uri.cmp("icap://", 7) != 0) {
- debug(3, 0) ("ICAPService::parseConfigLine (line %d): wrong uri: %s\n", config_lineno, uri.buf());
+ debugs(3, 0, "ICAPService::parseConfigLine (line " << config_lineno << "): wrong uri: " << uri.buf());
return false;
}
len = e - s;
if (len > 1024) {
- debug(3, 0) ("icap_service_process (line %d): long resource name (>1024), probably wrong\n", config_lineno);
+ debugs(3, 0, "icap_service_process (line " << config_lineno << "): long resource name (>1024), probably wrong");
}
resource.limitInit(s, len + 1);
void
ICAPXaction::reusedConnection(void *data)
{
- debug(93,5)("ICAPXaction::reusedConnection\n");
+ debugs(93, 5, "ICAPXaction::reusedConnection");
ICAPXaction *x = (ICAPXaction*)data;
x->noteCommConnected(COMM_OK);
}
/*
- * $Id: IPInterception.cc,v 1.15 2006/05/10 20:17:12 hno Exp $
+ * $Id: IPInterception.cc,v 1.16 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 89 NAT / IP Interception
* AUTHOR: Robert Collins
if (natfd < 0)
{
if (squid_curtime - last_reported > 60) {
- debug(89, 1) ("clientNatLookup: NAT open failed: %s\n",
- xstrerror());
+ debugs(89, 1, "clientNatLookup: NAT open failed: " << xstrerror());
last_reported = squid_curtime;
return -1;
}
{
if (errno != ESRCH) {
if (squid_curtime - last_reported > 60) {
- debug(89, 1) ("clientNatLookup: NAT lookup failed: ioctl(SIOCGNATL)\n");
+ debugs(89, 1, "clientNatLookup: NAT lookup failed: ioctl(SIOCGNATL)");
last_reported = squid_curtime;
}
if (getsockopt(fd, SOL_IP, SO_ORIGINAL_DST, dst, &sock_sz) != 0)
{
if (squid_curtime - last_reported > 60) {
- debug(89, 1) ("clientNatLookup: NF getsockopt(SO_ORIGINAL_DST) failed: %s\n", xstrerror());
+ debugs(89, 1, "clientNatLookup: NF getsockopt(SO_ORIGINAL_DST) failed: " << xstrerror());
last_reported = squid_curtime;
}
return -1;
}
- debug(89, 5) ("clientNatLookup: addr = %s", inet_ntoa(dst->sin_addr));
+ debugs(89, 5, "clientNatLookup: addr = " << inet_ntoa(dst->sin_addr) << "");
if (me.sin_addr.s_addr != dst->sin_addr.s_addr)
return 0;
if (pffd < 0)
{
if (squid_curtime - last_reported > 60) {
- debug(89, 1) ("clientNatLookup: PF open failed: %s\n",
- xstrerror());
+ debugs(89, 1, "clientNatLookup: PF open failed: " << xstrerror());
last_reported = squid_curtime;
}
{
if (errno != ENOENT) {
if (squid_curtime - last_reported > 60) {
- debug(89, 1) ("clientNatLookup: PF lookup failed: ioctl(DIOCNATLOOK)\n");
+ debugs(89, 1, "clientNatLookup: PF lookup failed: ioctl(DIOCNATLOOK)");
last_reported = squid_curtime;
}
clientNatLookup(int fd, struct sockaddr_in me, struct sockaddr_in peer, struct sockaddr_in *dst)
{
- debug(89, 1) ("WARNING: transparent proxying not supported\n");
+ debugs(89, 1, "WARNING: transparent proxying not supported");
return -1;
}
/*
- * $Id: LeakFinder.cc,v 1.4 2006/05/29 00:15:00 robertc Exp $
+ * $Id: LeakFinder.cc,v 1.5 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 45 Callback Data Registry
* AUTHOR: Duane Wessels
LeakFinder::LeakFinder()
{
- debug(45, 3) ("LeakFinder constructed\n");
+ debugs(45, 3, "LeakFinder constructed");
table = hash_create(cmp, 1 << 8, hash);
#if 0
/* if this is desired to reinstate, add a
last_dump = squid_curtime;
- debug(45,1)("Tracking %d pointers\n", count);
+ debugs(45, 1, "Tracking " << count << " pointers");
hash_first(table);
LeakFinderPtr *c;
while ((c = (LeakFinderPtr *)hash_next(table))) {
- debug(45,1)("%20p last used %9d seconds ago by %s:%d\n",
- c->key, (int)(squid_curtime - c->when), c->file, c->line);
+ debugs(45, 1, std::setw(20) << c->key << " last used " << std::setw(9) << (int)(squid_curtime - c->when) <<
+ " seconds ago by " << c->file << ":" << c->line);
}
}
/*
- * $Id: MemObject.cc,v 1.24 2006/09/20 00:59:26 adrian Exp $
+ * $Id: MemObject.cc,v 1.25 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 19 Store Memory Primitives
* AUTHOR: Robert Collins
MemObject::write ( StoreIOBuffer writeBuffer, STMCB *callback, void *callbackData)
{
PROF_start(MemObject_write);
- debug(19, 6) ("memWrite: offset %lu len %ld\n", (unsigned long)writeBuffer.offset, (long)writeBuffer.length);
+ debugs(19, 6, "memWrite: offset " << (unsigned long)writeBuffer.offset << " len " << (long)writeBuffer.length);
/* the offset is into the content, not the headers */
writeBuffer.offset += (_reply ? _reply->hdr_sz : 0);
data_hdr.dump();
#if 0
/* do we want this one? */
- debug(20, 1) ("MemObject->data.origin_offset: %d\n",
- data_hdr.head ? data_hdr.head->nodeBuffer.offset : 0);
+ debugs(20, 1, "MemObject->data.origin_offset: " << (data_hdr.head ? data_hdr.head->nodeBuffer.offset : 0));
#endif
- debug(20, 1) ("MemObject->start_ping: %d.%06d\n",
- (int) start_ping.tv_sec,
- (int) start_ping.tv_usec);
- debug(20, 1) ("MemObject->inmem_hi: %d\n",
- (int) data_hdr.endOffset());
- debug(20, 1) ("MemObject->inmem_lo: %d\n",
- (int) inmem_lo);
- debug(20, 1) ("MemObject->nclients: %d\n",
- nclients);
- debug(20, 1) ("MemObject->reply: %p\n",
- _reply);
- debug(20, 1) ("MemObject->request: %p\n",
- request);
- debug(20, 1) ("MemObject->log_url: %p %s\n",
- log_url,
- checkNullString(log_url));
+ debugs(20, 1, "MemObject->start_ping: " << (int) start_ping.tv_sec << "."<< std::setfill('0') << std::setw(6) << (int) start_ping.tv_usec);
+ debugs(20, 1, "MemObject->inmem_hi: " << (int) data_hdr.endOffset());
+ debugs(20, 1, "MemObject->inmem_lo: " << (int) inmem_lo);
+ debugs(20, 1, "MemObject->nclients: " << nclients);
+ debugs(20, 1, "MemObject->reply: " << _reply);
+ debugs(20, 1, "MemObject->request: " << request);
+ debugs(20, 1, "MemObject->log_url: " << log_url << " " << checkNullString(log_url));
}
HttpReply const *
{
bool result = data_hdr.hasContigousContentRange (Range<size_t>(inmem_lo, endOffset()));
/* XXX : make this higher level */
- debug (19, result ? 4 :3) ("MemObject::isContiguous: Returning %s\n",
- result ? "true" : "false");
+ debugs (19, result ? 4 :3, "MemObject::isContiguous: Returning " << (result ? "true" : "false"));
return result;
}
/*
- * $Id: Server.cc,v 1.8 2007/04/06 04:50:05 rousskov Exp $
+ * $Id: Server.cc,v 1.9 2007/04/28 22:26:37 hno Exp $
*
* DEBUG:
* AUTHOR: Duane Wessels
void
ServerStateData::sentRequestBody(int fd, size_t size, comm_err_t errflag)
{
- debug(11, 5) ("sentRequestBody: FD %d: size %d: errflag %d.\n",
- fd, (int) size, errflag);
+ debugs(11, 5, "sentRequestBody: FD " << fd << ": size " << (int) size << ": errflag " << errflag << ".");
debugs(32,3,HERE << "sentRequestBody called");
requestSender = NULL;
}
if (errflag) {
- debug(11, 1) ("sentRequestBody error: FD %d: %s\n", fd, xstrerr(errno));
+ debugs(11, 1, "sentRequestBody error: FD " << fd << ": " << xstrerr(errno));
ErrorState *err;
err = errorCon(ERR_WRITE_ERROR, HTTP_BAD_GATEWAY, fwd->request);
err->xerrno = errno;
bool
ServerStateData::startIcap(ICAPServiceRep::Pointer service, HttpRequest *cause)
{
- debug(11,5)("ServerStateData::startIcap() called\n");
+ debugs(11, 5, "ServerStateData::startIcap() called");
if (!service) {
- debug(11,3)("ServerStateData::startIcap fails: lack of service\n");
+ debugs(11, 3, "ServerStateData::startIcap fails: lack of service");
return false;
}
if (service->broken()) {
- debug(11,3)("ServerStateData::startIcap fails: broken service\n");
+ debugs(11, 3, "ServerStateData::startIcap fails: broken service");
return false;
}
/*
- * $Id: StatHist.cc,v 1.33 2007/04/13 22:46:03 wessels Exp $
+ * $Id: StatHist.cc,v 1.34 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 62 Generic Histogram
* AUTHOR: Duane Wessels
{
assert(Dest);
assert(Orig);
- debug(62, 3) ("statHistCopy: Dest=%p, Orig=%p\n", Dest, Orig);
+ debugs(62, 3, "statHistCopy: Dest=" << Dest << ", Orig=" << Orig);
assert(Dest->bins);
/* better be safe than sorry */
- debug(62, 3) ("statHistCopy: capacity %d %d\n",
- Dest->capacity, Orig->capacity);
+ debugs(62, 3, "statHistCopy: capacity " << Dest->capacity << " " << Orig->capacity);
assert(Dest->capacity == Orig->capacity);
- debug(62, 3) ("statHistCopy: min %f %f\n", Dest->min, Orig->min);
+ debugs(62, 3, "statHistCopy: min " << Dest->min << " " << Orig->min );
assert(Dest->min == Orig->min);
- debug(62, 3) ("statHistCopy: max %f %f\n", Dest->max, Orig->max);
+ debugs(62, 3, "statHistCopy: max " << Dest->max << " " << Orig->max );
assert(Dest->max == Orig->max);
- debug(62, 3) ("statHistCopy: scale %f %f\n", Dest->scale, Orig->scale);
+ debugs(62, 3, "statHistCopy: scale " << Dest->scale << " " << Orig->scale );
assert(fabs(Dest->scale - Orig->scale) < 0.0000001);
assert(Dest->val_in == Orig->val_in);
assert(Dest->val_out == Orig->val_out);
/* actual copy */
- debug(62, 3) ("statHistCopy: copying %ld bytes to %p from %p\n",
- (long int) (Dest->capacity * sizeof(*Dest->bins)),
- Dest->bins,
- Orig->bins);
+ debugs(62, 3, "statHistCopy: copying " <<
+ (long int) (Dest->capacity * sizeof(*Dest->bins)) << " bytes to " <<
+ Dest->bins << " from " << Orig->bins);
+
xmemcpy(Dest->bins, Orig->bins, Dest->capacity * sizeof(*Dest->bins));
}
/*
- * $Id: StoreMeta.cc,v 1.3 2003/08/04 22:14:41 robertc Exp $
+ * $Id: StoreMeta.cc,v 1.4 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 20 Storage Manager Swapfile Metadata
* AUTHOR: Kostas Anagnostakis
/* VOID is reserved, and new types have to be added as classes */
if (type <= STORE_META_VOID || type >= STORE_META_END) {
- debug(20, 0) ("storeSwapMetaUnpack: bad type (%d)!\n", type);
+ debugs(20, 0, "storeSwapMetaUnpack: bad type (" << type << ")!");
return false;
}
type == STORE_META_KEY_SHA ||
type == STORE_META_HITMETERING ||
type == STORE_META_VALID) {
- debug (20,0)("Obsolete and unused type (%d) in disk metadata\n", type);
+ debugs(20, 0, "Obsolete and unused type (" << type << ") in disk metadata");
return false;
}
StoreMeta::validLength(int length) const
{
if (!IntRange (MinimumTLVLength, MaximumTLVLength).includes(length)) {
- debug(20, 0) ("storeSwapMetaUnpack: insane length (%d)!\n", length);
+ debugs(20, 0, "storeSwapMetaUnpack: insane length (" << length << ")!");
return false;
}
break;
default:
- debug (20,0)("Attempt to create unknown concrete StoreMeta\n");
+ debugs(20, 0, "Attempt to create unknown concrete StoreMeta");
return NULL;
}
break;
default:
- debug(20, 1) ("WARNING: got unused STORE_META type %d\n", getType());
+ debugs(20, 1, "WARNING: got unused STORE_META type " << getType());
break;
}
/*
- * $Id: StoreMetaMD5.cc,v 1.4 2004/08/30 05:12:31 robertc Exp $
+ * $Id: StoreMetaMD5.cc,v 1.5 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 20 Storage Manager Swapfile Metadata
* AUTHOR: Kostas Anagnostakis
if (!EBIT_TEST(e->flags, KEY_PRIVATE) &&
memcmp(value, e->key, MD5_DIGEST_CHARS)) {
- debug(20, 2) ("storeClientReadHeader: swapin MD5 mismatch\n");
- // debug(20, 2) ("\t%s\n", storeKeyText((const cache_key *)value));
- debug(20, 2) ("\t%s\n", e->getMD5Text());
+ debugs(20, 2, "storeClientReadHeader: swapin MD5 mismatch");
+ // debugs(20, 2, "\t" << storeKeyText((const cache_key *)value));
+ debugs(20, 2, "\t" << e->getMD5Text());
if (isPowTen(++md5_mismatches))
- debug(20, 1) ("WARNING: %d swapin MD5 mismatches\n",
- md5_mismatches);
+ debugs(20, 1, "WARNING: " << md5_mismatches << " swapin MD5 mismatches");
return false;
}
/*
- * $Id: StoreMetaURL.cc,v 1.4 2004/08/30 05:12:31 robertc Exp $
+ * $Id: StoreMetaURL.cc,v 1.5 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 20 Storage Manager Swapfile Metadata
* AUTHOR: Kostas Anagnostakis
return true;
if (strcasecmp(e->mem_obj->url, (char *)value)) {
- debug(20, 1) ("storeClientReadHeader: URL mismatch\n");
- debug(20, 1) ("\t{%s} != {%s}\n", (char *) value, e->mem_obj->url);
+ debugs(20, 1, "storeClientReadHeader: URL mismatch");
+ debugs(20, 1, "\t{" << (char *) value << "} != {" << e->mem_obj->url << "}");
return false;
}
/*
- * $Id: StoreMetaUnpacker.cc,v 1.3 2006/05/20 13:15:14 hno Exp $
+ * $Id: StoreMetaUnpacker.cc,v 1.4 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 20 Storage Manager Swapfile Unpacker
* AUTHOR: Robert Collins
getLength();
if (position + length > *hdr_len) {
- debug(20, 0) ("storeSwapMetaUnpack: overflow!\n");
- debug(20, 0) ("\ttype=%d, length=%d, *hdr_len=%d, offset=%d\n",
- type, length, *hdr_len, (int) position);
+ debugs(20, 0, "storeSwapMetaUnpack: overflow!");
+ debugs(20, 0, "\ttype=" << type << ", length=" << length << ", *hdr_len=" << *hdr_len << ", offset=" << (int) position);
return false;
}
/*
- * $Id: SwapDir.cc,v 1.9 2007/04/25 11:30:18 adrian Exp $
+ * $Id: SwapDir.cc,v 1.10 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 20 Swap Dir base object
* AUTHOR: Robert Collins
if (reconfiguring) {
if (old_read_only != flags.read_only) {
- debug(3, 1) ("Cache dir '%s' now %s\n",
- path, flags.read_only ? "No-Store" : "Read-Write");
+ debugs(3, 1, "Cache dir '" << path << "' now " << (flags.read_only ? "No-Store" : "Read-Write"));
}
}
}
ssize_t size = xatoi(value);
if (reconfiguring && max_objsize != size)
- debug(3, 1) ("Cache dir '%s' max object size now %ld\n", path, (long int) size);
+ debugs(3, 1, "Cache dir '" << path << "' max object size now " << (long int) size);
max_objsize = size;
/*
- * $Id: WinSvc.cc,v 1.2 2006/10/29 18:14:52 serassio Exp $
+ * $Id: WinSvc.cc,v 1.3 2007/04/28 22:26:37 hno Exp $
*
* Windows support
* AUTHOR: Guido Serassio <serassio@squid-cache.org>
if (!SetServiceStatus(svcHandle, &svcStatus)) {
status = GetLastError();
- debug(1, 1) ("SetServiceStatus error %ld\n", status);
+ debugs(1, 1, "SetServiceStatus error " << status);
}
- debug(1, 1) ("Leaving Squid service\n");
+ debugs(1, 1, "Leaving Squid service");
return;
case _WIN_SQUID_SERVICE_CONTROL_INTERROGATE:
if (!SetServiceStatus(svcHandle, &svcStatus)) {
status = GetLastError();
- debug(1, 1) ("SetServiceStatus error %ld\n", status);
+ debugs(1, 1, "SetServiceStatus error " << status);
}
break;
if (!SetServiceStatus(svcHandle, &svcStatus)) {
status = GetLastError();
- debug(1, 1) ("SetServiceStatus error %ld\n", status);
+ debugs(1, 1, "SetServiceStatus error " << status);
}
- debug(1, 1) ("Leaving Squid service\n");
+ debugs(1, 1, "Leaving Squid service");
break;
default:
- debug(1, 1) ("Unrecognized opcode %ld\n", Opcode);
+ debugs(1, 1, "Unrecognized opcode " << Opcode);
}
return;
/*
- * $Id: access_log.cc,v 1.121 2007/04/24 15:01:55 hno Exp $
+ * $Id: access_log.cc,v 1.122 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 46 Access Log
* AUTHOR: Duane Wessels
logformat_token *new_lt, *last_lt;
enum log_quote quote = LOG_QUOTE_NONE;
- debug(46, 2) ("accessLogParseLogFormat: got definition '%s'\n", def);
+ debugs(46, 2, "accessLogParseLogFormat: got definition '" << def << "'");
/* very inefficent parser, but who cares, this needs to be simple */
/* First off, let's tokenize, we'll optimize in a second pass.
logformat *format;
struct logformat_token_table_entry *te;
- debug(46, 0) ("accessLogDumpLogFormat called\n");
+ debugs(46, 0, "accessLogDumpLogFormat called");
for (format = definitions; format; format = format->next) {
- debug(46, 0) ("Dumping logformat definition for %s\n", format->name);
+ debugs(46, 0, "Dumping logformat definition for " << format->name);
storeAppendPrintf(entry, "logformat %s ", format->name);
for (t = format->format; t; t = t->next) {
if (mcast_miss_fd < 0)
fatal("Cannot open Multicast Miss Stream Socket");
- debug(46, 1) ("Multicast Miss Stream Socket opened on FD %d\n",
- mcast_miss_fd);
+ debugs(46, 1, "Multicast Miss Stream Socket opened on FD " << mcast_miss_fd);
mcastSetTtl(mcast_miss_fd, Config.mcast_miss.ttl);
/*
- * $Id: acl.cc,v 1.321 2006/07/29 13:46:05 hno Exp $
+ * $Id: acl.cc,v 1.322 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 28 Access Control
* AUTHOR: Duane Wessels
ACL::FindByName(const char *name)
{
ACL *a;
- debug(28, 9) ("ACL::FindByName '%s'\n",name);
+ debugs(28, 9, "ACL::FindByName '" << name << "'");
for (a = Config.aclList; a; a = a->next)
if (!strcasecmp(a->name, name))
return a;
- debug(28,9) ("ACL::FindByName found no match\n");
+ debugs(28, 9, "ACL::FindByName found no match");
return NULL;
}
/* snarf the ACL name */
if ((t = strtok(NULL, w_space)) == NULL) {
- debug(28, 0) ("aclParseAclLine: missing ACL name.\n");
+ debugs(28, 0, "aclParseAclLine: missing ACL name.");
parser.destruct();
return;
}
if (strlen(t) >= ACL_NAME_SZ) {
- debug(28, 0) ("aclParseAclLine: aclParseAclLine: ACL name '%s' too long, max %d characters supported\n", t, ACL_NAME_SZ - 1);
+ debugs(28, 0, "aclParseAclLine: aclParseAclLine: ACL name '" << t <<
+ "' too long, max " << ACL_NAME_SZ - 1 << " characters supported");
parser.destruct();
return;
}
char *theType;
if ((theType = strtok(NULL, w_space)) == NULL) {
- debug(28, 0) ("aclParseAclLine: missing ACL type.\n");
+ debugs(28, 0, "aclParseAclLine: missing ACL type.");
parser.destruct();
return;
}
if (!Prototype::Registered (theType)) {
- debug(28, 0) ("aclParseAclLine: Invalid ACL type '%s'\n", theType);
+ debugs(28, 0, "aclParseAclLine: Invalid ACL type '" << theType << "'");
parser.destruct();
return;
}
if ((A = FindByName(aclname)) == NULL) {
- debug(28, 3) ("aclParseAclLine: Creating ACL '%s'\n", aclname);
+ debugs(28, 3, "aclParseAclLine: Creating ACL '" << aclname << "'");
A = ACL::Factory(theType);
xstrncpy(A->name, aclname, ACL_NAME_SZ);
A->cfgline = xstrdup(config_input_line);
new_acl = 1;
} else {
if (strcmp (A->typeString(),theType) ) {
- debug(28, 0) ("aclParseAclLine: ACL '%s' already exists with different type.\n", A->name);
+ debugs(28, 0, "aclParseAclLine: ACL '" << A->name << "' already exists with different type.");
parser.destruct();
return;
}
- debug(28, 3) ("aclParseAclLine: Appending to '%s'\n", aclname);
+ debugs(28, 3, "aclParseAclLine: Appending to '" << aclname << "'");
new_acl = 0;
}
return;
if (A->empty()) {
- debug(28, 0) ("Warning: empty ACL: %s\n",
- A->cfgline);
+ debugs(28, 0, "Warning: empty ACL: " << A->cfgline);
}
if (!A->valid()) {
auth_match = (acl_proxy_auth_match_cache *)link->data;
if (auth_match->acl_data == this) {
- debug(28, 4) ("ACL::cacheMatchAcl: cache hit on acl '%s' (%p)\n", name, this);
+ debugs(28, 4, "ACL::cacheMatchAcl: cache hit on acl '" << name << "' (" << this << ")");
return auth_match->matchrv;
}
auth_match->matchrv = matchForCache (checklist);
auth_match->acl_data = this;
dlinkAddTail(auth_match, &auth_match->link, cache);
- debug(28,4)("ACL::cacheMatchAcl: miss for '%s'. Adding result %d\n",name,auth_match->matchrv);
+ debugs(28, 4, "ACL::cacheMatchAcl: miss for '" << name << "'. Adding result " << auth_match->matchrv);
return auth_match->matchrv;
}
dlink_node *link, *tmplink;
link = cache->head;
- debug(28,8)("aclCacheMatchFlush called for cache %p\n",cache);
+ debugs(28, 8, "aclCacheMatchFlush called for cache " << cache);
while (link) {
auth_match = (acl_proxy_auth_match_cache *)link->data;
int rv;
if (NULL == checklist->request && requiresRequest()) {
- debug(28, 1) ( "ACL::checklistMatches "
- "WARNING: '%s' ACL is used but there is no"
- " HTTP request -- not matching.\n", name);
+ debugs(28, 1, "ACL::checklistMatches WARNING: '" << name << "' ACL is used but there is no HTTP request -- not matching.");
return 0;
}
if (NULL == checklist->reply && requiresReply()) {
- debug(28, 1) ( "ACL::checklistMatches "
- "WARNING: '%s' ACL is used but there is no"
- " HTTP reply -- not matching.\n", name);
+ debugs(28, 1, "ACL::checklistMatches WARNING: '" << name << "' ACL is used but there is no HTTP reply -- not matching.");
return 0;
}
- debug(28, 3) ("ACL::checklistMatches: checking '%s'\n", name);
+ debugs(28, 3, "ACL::checklistMatches: checking '" << name << "'");
rv= match(checklist);
- debug(28,3) ("ACL::ChecklistMatches: result for '%s' is %d\n",name,rv);
+ debugs(28, 3, "ACL::ChecklistMatches: result for '" << name << "' is " << rv);
return rv;
}
{
assert (_acl);
AclMatchedName = _acl->name;
- debug(28, 3) ("ACLList::matches: checking %s%s\n",
- op ? null_string : "!", _acl->name);
+ debugs(28, 3, "ACLList::matches: checking " << (op ? null_string : "!") << _acl->name);
if (_acl->checklistMatches(checklist) != op) {
- debug(28,4)("ACLList::matches: result is false\n");
+ debugs(28, 4, "ACLList::matches: result is false");
return checklist->lastACLResult(false);
}
- debug(28,4)("ACLList::matches: result is true\n");
+ debugs(28, 4, "ACLList::matches: result is true");
return checklist->lastACLResult(true);
}
ACL::~ACL()
{
- debug(28, 3) ("ACL::~ACL: '%s'\n", cfgline);
+ debugs(28, 3, "ACL::~ACL: '" << cfgline << "'");
safe_free(cfgline);
}
acl_access const *a = this;
acl_list *b;
- debug(28,6)("acl_access::containsPURGE: invoked for '%s'\n",cfgline);
+ debugs(28, 6, "acl_access::containsPURGE: invoked for '" << cfgline << "'");
for (; a; a = a->next) {
for (b = a->aclList; b; b = b->next) {
ACLStrategised<method_t> *tempAcl = dynamic_cast<ACLStrategised<method_t> *>(b->_acl);
if (!tempAcl) {
- debug(28,7)("acl_access::containsPURGE: can't create tempAcl\n");
+ debugs(28, 7, "acl_access::containsPURGE: can't create tempAcl");
continue;
}
if (tempAcl->match(METHOD_PURGE)) {
- debug(28,6)("acl_access::containsPURGE: returning true\n");
+ debugs(28, 6, "acl_access::containsPURGE: returning true");
return true;
}
}
}
- debug(28,6)("acl_access::containsPURGE: returning false\n");
+ debugs(28, 6, "acl_access::containsPURGE: returning false");
return false;
}
bool
ACL::Prototype::Registered(char const *aType)
{
- debug(28,7)("ACL::Prototype::Registered: invoked for type %s\n",aType);
+ debugs(28, 7, "ACL::Prototype::Registered: invoked for type " << aType);
for (iterator i = Registry->begin(); i != Registry->end(); ++i)
if (!strcmp (aType, (*i)->typeString)) {
- debug(28,7)("ACL::Prototype::Registered: yes\n");
+ debugs(28, 7, "ACL::Prototype::Registered: yes");
return true;
}
- debug(28,7)("ACL::Prototype::Registered: no\n");
+ debugs(28, 7, "ACL::Prototype::Registered: no");
return false;
}
ACL::Prototype::~Prototype()
{
- debug (28,2)("ACL::Prototype::~Prototype: TODO: unregister me\n");
+ debugs(28, 2, "ACL::Prototype::~Prototype: TODO: unregister me");
}
ACL *
ACL::Prototype::Factory (char const *typeToClone)
{
- debug(28,4)("ACL::Prototype::Factory: cloning an object for type '%s'\n",typeToClone);
+ debugs(28, 4, "ACL::Prototype::Factory: cloning an object for type '" << typeToClone << "'");
for (iterator i = Registry->begin(); i != Registry->end(); ++i)
if (!strcmp (typeToClone, (*i)->typeString))
return (*i)->prototype->clone();
- debug(28,4)("ACL::Prototype::Factory: cloning failed, no type '%s' available\n",typeToClone);
+ debugs(28, 4, "ACL::Prototype::Factory: cloning failed, no type '" << typeToClone << "' available");
return NULL;
}
ACL::Initialize()
{
ACL *a = Config.aclList;
- debug(53, 3) ("ACL::Initialize\n");
+ debugs(53, 3, "ACL::Initialize");
while (a) {
a->prepareForUse();
/*
- * $Id: acl_noncore.cc,v 1.4 2007/01/28 15:37:46 serassio Exp $
+ * $Id: acl_noncore.cc,v 1.5 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 28 Access Control
* AUTHOR: Duane Wessels
{
acl_deny_info_list *A = NULL;
- debug(28,9)("aclGetDenyInfoPage: got called for %s\n",name);
+ debugs(28, 9, "aclGetDenyInfoPage: got called for " << name);
for (A = *head; A; A = A->next) {
acl_name_list *L = NULL;
if (!redirect_allowed && strchr(A->err_page_name, ':')) {
- debug(28,3)("aclGetDenyInfoPage: "
- "WARNING, unexpected codepath taken\n");
+ debugs(28, 3, "aclGetDenyInfoPage: WARNING, unexpected codepath taken");
continue;
}
for (L = A->acl_list; L; L = L->next) {
if (!strcmp(name, L->name)) {
- debug(28,8)("aclGetDenyInfoPage: match on %s\n",name);
+ debugs(28, 8, "aclGetDenyInfoPage: match on " << name);
return A->err_page_id;
}
}
}
- debug(28,8)("aclGetDenyInfoPage: no match\n");
+ debugs(28, 8, "aclGetDenyInfoPage: no match");
return ERR_NONE;
}
int
aclIsProxyAuth(const char *name)
{
- debug(28,5)("aclIsProxyAuth: called for %s\n",name);
+ debugs(28, 5, "aclIsProxyAuth: called for " << name);
if (NULL == name)
return false;
ACL *a;
if ((a = ACL::FindByName(name))) {
- debug(28,5)("aclIsProxyAuth: returning %d\n",a->isProxyAuth());
+ debugs(28, 5, "aclIsProxyAuth: returning " << a->isProxyAuth());
return a->isProxyAuth();
}
- debug(28,3)("aclIsProxyAuth: WARNING, called for nonexistent ACL\n");
+ debugs(28, 3, "aclIsProxyAuth: WARNING, called for nonexistent ACL");
return false;
}
/* first expect a page name */
if ((t = strtok(NULL, w_space)) == NULL) {
- debug(28, 0) ("aclParseDenyInfoLine: %s line %d: %s\n",
- cfg_filename, config_lineno, config_input_line);
- debug(28, 0) ("aclParseDenyInfoLine: missing 'error page' parameter.\n");
+ debugs(28, 0, "aclParseDenyInfoLine: " << cfg_filename << " line " << config_lineno << ": " << config_input_line);
+ debugs(28, 0, "aclParseDenyInfoLine: missing 'error page' parameter.");
return;
}
}
if (A->acl_list == NULL) {
- debug(28, 0) ("aclParseDenyInfoLine: %s line %d: %s\n",
- cfg_filename, config_lineno, config_input_line);
- debug(28, 0) ("aclParseDenyInfoLine: deny_info line contains no ACL's, skipping\n");
+ debugs(28, 0, "aclParseDenyInfoLine: " << cfg_filename << " line " << config_lineno << ": " << config_input_line);
+ debugs(28, 0, "aclParseDenyInfoLine: deny_info line contains no ACL's, skipping");
memFree(A, MEM_ACL_DENY_INFO_LIST);
return;
}
/* first expect either 'allow' or 'deny' */
if ((t = strtok(NULL, w_space)) == NULL) {
- debug(28, 0) ("aclParseAccessLine: %s line %d: %s\n",
- cfg_filename, config_lineno, config_input_line);
- debug(28, 0) ("aclParseAccessLine: missing 'allow' or 'deny'.\n");
+ debugs(28, 0, "aclParseAccessLine: " << cfg_filename << " line " << config_lineno << ": " << config_input_line);
+ debugs(28, 0, "aclParseAccessLine: missing 'allow' or 'deny'.");
return;
}
else if (!strcmp(t, "deny"))
A->allow = ACCESS_DENIED;
else {
- debug(28, 0) ("aclParseAccessLine: %s line %d: %s\n",
- cfg_filename, config_lineno, config_input_line);
- debug(28, 0) ("aclParseAccessLine: expecting 'allow' or 'deny', got '%s'.\n", t);
+ debugs(28, 0, "aclParseAccessLine: " << cfg_filename << " line " << config_lineno << ": " << config_input_line);
+ debugs(28, 0, "aclParseAccessLine: expecting 'allow' or 'deny', got '" << t << "'.");
delete A;
return;
}
aclParseAclList(parser, &A->aclList);
if (A->aclList == NULL) {
- debug(28, 0) ("%s line %d: %s\n",
- cfg_filename, config_lineno, config_input_line);
- debug(28, 0) ("aclParseAccessLine: Access line contains no ACL's, skipping\n");
+ debugs(28, 0, "" << cfg_filename << " line " << config_lineno << ": " << config_input_line);
+ debugs(28, 0, "aclParseAccessLine: Access line contains no ACL's, skipping");
delete A;
return;
}
t++;
}
- debug(28, 3) ("aclParseAccessLine: looking for ACL name '%s'\n", t);
+ debugs(28, 3, "aclParseAccessLine: looking for ACL name '" << t << "'");
a = ACL::FindByName(t);
if (a == NULL) {
- debug(28, 0) ("aclParseAccessLine: ACL name '%s' not found.\n", t);
+ debugs(28, 0, "aclParseAccessLine: ACL name '" << t << "' not found.");
delete L;
parser.destruct();
continue;
{
ACL *next = NULL;
- debug(28,8)("aclDestroyACLs: invoked\n");
+ debugs(28, 8, "aclDestroyACLs: invoked");
for (ACL *a = *head; a; a = next) {
next = a->next;
aclDestroyAclList(acl_list ** head)
{
acl_list *l;
- debug(28,8)("aclDestroyAclList: invoked\n");
+ debugs(28, 8, "aclDestroyAclList: invoked");
for (l = *head; l; l = *head) {
*head = l->next;
acl_access *next = NULL;
for (l = *list; l; l = next) {
- debug(28, 3) ("aclDestroyAccessList: '%s'\n", l->cfgline);
+ debugs(28, 3, "aclDestroyAccessList: '" << l->cfgline << "'");
next = l->next;
aclDestroyAclList(&l->aclList);
safe_free(l->cfgline);
acl_name_list *l = NULL;
acl_name_list *l_next = NULL;
- debug(28,8)("aclDestroyDenyInfoList: invoked\n");
+ debugs(28, 8, "aclDestroyDenyInfoList: invoked");
for (a = *list; a; a = a_next) {
for (l = a->acl_list; l; l = l_next) {
/*
- * $Id: asn.cc,v 1.110 2007/04/21 07:14:13 wessels Exp $
+ * $Id: asn.cc,v 1.111 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 53 AS Number handling
* AUTHOR: Duane Wessels, Kostas Anagnostakis
List<int> *a = NULL;
List<int> *b = NULL;
lh = ntohl(addr.s_addr);
- debug(53, 3) ("asnMatchIp: Called for %s.\n", inet_ntoa(addr));
+ debugs(53, 3, "asnMatchIp: Called for " << inet_ntoa(addr) << ".");
if (AS_tree_head == NULL)
return 0;
rn = squid_rn_match(m_addr, AS_tree_head);
if (rn == NULL) {
- debug(53, 3) ("asnMatchIp: Address not in as db.\n");
+ debugs(53, 3, "asnMatchIp: Address not in as db.");
return 0;
}
- debug(53, 3) ("asnMatchIp: Found in db!\n");
+ debugs(53, 3, "asnMatchIp: Found in db!");
e = ((rtentry_t *) rn)->e_info;
assert(e);
for (a = data; a; a = a->next)
for (b = e->as_number; b; b = b->next)
if (a->element == b->element) {
- debug(53, 5) ("asnMatchIp: Found a match!\n");
+ debugs(53, 5, "asnMatchIp: Found a match!");
return 1;
}
- debug(53, 5) ("asnMatchIp: AS not in as db.\n");
+ debugs(53, 5, "asnMatchIp: AS not in as db.");
return 0;
}
ASState *asState;
asState = cbdataAlloc(ASState);
asState->dataRead = 0;
- debug(53, 3) ("asnCacheStart: AS %d\n", as);
+ debugs(53, 3, "asnCacheStart: AS " << as);
snprintf(asres, 4096, "whois://%s/!gAS%d", Config.as_whois_server, as);
asState->as_number = as;
req = HttpRequest::CreateFromUrl(asres);
char *buf = asState->reqbuf;
int leftoversz = -1;
- debug(53, 3) ("asHandleReply: Called with size=%u\n", (unsigned int)result.length);
- debug(53, 3) ("asHandleReply: buffer='%s'\n", buf);
+ debugs(53, 3, "asHandleReply: Called with size=" << (unsigned int)result.length);
+ debugs(53, 3, "asHandleReply: buffer='" << buf << "'");
/* First figure out whether we should abort the request */
}
if (result.length == 0 && asState->dataRead) {
- debug(53, 3) ("asHandleReply: Done: %s\n", e->url());
+ debugs(53, 3, "asHandleReply: Done: " << e->url() );
asStateFree(asState);
return;
} else if (result.flags.error) {
- debug(53, 1) ("asHandleReply: Called with Error set and size=%u\n", (unsigned int) result.length);
+ debugs(53, 1, "asHandleReply: Called with Error set and size=" << (unsigned int) result.length);
asStateFree(asState);
return;
} else if (HTTP_OK != e->getReply()->sline.status) {
- debug(53, 1) ("WARNING: AS %d whois request failed\n",
- asState->as_number);
+ debugs(53, 1, "WARNING: AS " << asState->as_number << " whois request failed");
asStateFree(asState);
return;
}
}
*t = '\0';
- debug(53, 3) ("asHandleReply: AS# %s (%d)\n", s, asState->as_number);
+ debugs(53, 3, "asHandleReply: AS# " << s << " (" << asState->as_number << ")");
asnAddNet(s, asState->as_number);
s = t + 1;
asState->dataRead = 1;
asState->reqofs = leftoversz;
- debug(53, 3) ("asState->offset = %ld\n", (long int) asState->offset);
+ debugs(53, 3, "asState->offset = " << (long int) asState->offset);
if (e->store_status == STORE_PENDING) {
- debug(53, 3) ("asHandleReply: store_status == STORE_PENDING: %s\n", e->url());
+ debugs(53, 3, "asHandleReply: store_status == STORE_PENDING: " << e->url() );
StoreIOBuffer tempBuffer (AS_REQBUF_SZ - asState->reqofs,
asState->offset,
asState->reqbuf + asState->reqofs);
asState);
} else {
StoreIOBuffer tempBuffer;
- debug(53, 3) ("asHandleReply: store complete, but data recieved %s\n", e->url());
+ debugs(53, 3, "asHandleReply: store complete, but data recieved " << e->url() );
tempBuffer.offset = asState->offset;
tempBuffer.length = AS_REQBUF_SZ - asState->reqofs;
tempBuffer.data = asState->reqbuf + asState->reqofs;
asStateFree(void *data)
{
ASState *asState = (ASState *)data;
- debug(53, 3) ("asnStateFree: %s\n", asState->entry->url());
+ debugs(53, 3, "asnStateFree: " << asState->entry->url() );
storeUnregister(asState->sc, asState->entry, asState);
asState->entry->unlock();
HTTPMSGUNLOCK(asState->request);
t = strchr(as_string, '/');
if (t == NULL) {
- debug(53, 3) ("asnAddNet: failed, invalid response from whois server.\n");
+ debugs(53, 3, "asnAddNet: failed, invalid response from whois server.");
return 0;
}
addr = ntohl(addr);
/*mask = ntohl(mask); */
- debug(53, 3) ("asnAddNet: called for %s/%s\n", dbg1, dbg2);
+ debugs(53, 3, "asnAddNet: called for " << dbg1 << "/" << dbg2);
e = (rtentry_t *)xmalloc(sizeof(rtentry_t));
asinfo = ((rtentry_t *) rn)->e_info;
if (asinfo->as_number->find(as_number)) {
- debug(53, 3) ("asnAddNet: Ignoring repeated network '%s/%d' for AS %d\n",
- dbg1, bitl, as_number);
+ debugs(53, 3, "asnAddNet: Ignoring repeated network '" << dbg1 << "/" << bitl << "' for AS " << as_number);
} else {
- debug(53, 3) ("asnAddNet: Warning: Found a network with multiple AS numbers!\n");
+ debugs(53, 3, "asnAddNet: Warning: Found a network with multiple AS numbers!");
for (Tail = &asinfo->as_number; *Tail; Tail = &(*Tail)->next)
xfree(asinfo);
delete q;
xfree(e);
- debug(53, 3) ("asnAddNet: Could not add entry.\n");
+ debugs(53, 3, "asnAddNet: Could not add entry.");
return 0;
}
rn = squid_rn_delete(rn->rn_key, rn->rn_mask, rnh);
if (rn == 0)
- debug(53, 3) ("destroyRadixNode: internal screwup\n");
+ debugs(53, 3, "destroyRadixNode: internal screwup");
destroyRadixNodeInfo(e->e_info);
} else if (!checklist->request->flags.destinationIPLookedUp()) {
/* No entry in cache, lookup not attempted */
/* XXX FIXME: allow accessing the acl name here */
- debug(28, 3) ("asnMatchAcl: Can't yet compare '%s' ACL for '%s'\n",
- "unknown" /*name*/, checklist->request->host);
+ debugs(28, 3, "asnMatchAcl: Can't yet compare '" << "unknown" /*name*/ << "' ACL for '" << checklist->request->host << "'");
checklist->changeState (DestinationIPLookup::Instance());
} else {
return data->match(no_addr);
/*
- * $Id: auth_basic.cc,v 1.45 2007/04/23 05:50:37 wessels Exp $
+ * $Id: auth_basic.cc,v 1.46 2007/04/28 22:26:48 hno Exp $
*
* DEBUG: section 29 Authenticator
* AUTHOR: Duane Wessels
basicauthenticators = NULL;
/* XXX Reinstate auth shutdown for dynamic schemes? */
- debug(29, 2) ("authBasicDone: Basic authentication Shutdown.\n");
+ debugs(29, 2, "authBasicDone: Basic authentication Shutdown.");
}
bool
{
if ((authenticate != NULL) && (authenticateChildren != 0) &&
(basicAuthRealm != NULL)) {
- debug(29, 9) ("authBasicConfigured: returning configured\n");
+ debugs(29, 9, "authBasicConfigured: returning configured");
return true;
}
- debug(29, 9) ("authBasicConfigured: returning unconfigured\n");
+ debugs(29, 9, "authBasicConfigured: returning unconfigured");
return false;
}
if ((flags.credentials_ok == 1) && (credentials_checkedtime + basicConfig.credentialsTTL > squid_curtime))
return true;
- debug(29, 4) ("User not authenticated or credentials need rechecking.\n");
+ debugs(29, 4, "User not authenticated or credentials need rechecking.");
return false;
}
/* are we about to recheck the credentials externally? */
if ((basic_auth->credentials_checkedtime + basicConfig.credentialsTTL) <= squid_curtime) {
- debug(29, 4) ("authBasicAuthenticate: credentials expired - rechecking\n");
+ debugs(29, 4, "authBasicAuthenticate: credentials expired - rechecking");
return;
}
/* we have been through the external helper, and the credentials haven't expired */
- debug(29, 9) ("authenticateBasicAuthenticateuser: user '%s' authenticated\n",
- basic_auth->username());
+ debugs(29, 9, "authenticateBasicAuthenticateuser: user '" << basic_auth->username() << "' authenticated");
/* Decode now takes care of finding the AuthUser struct in the cache */
/* after external auth occurs anyway */
AuthBasicConfig::fixHeader(auth_user_request_t *auth_user_request, HttpReply *rep, http_hdr_type type, HttpRequest * request)
{
if (authenticate) {
- debug(29, 9) ("authenticateFixErrorHeader: Sending type:%d header: 'Basic realm=\"%s\"'\n", type, basicAuthRealm);
+ debugs(29, 9, "authenticateFixErrorHeader: Sending type:" << type << " header: 'Basic realm=\"" << basicAuthRealm << "\"'");
httpHeaderPutStrf(&rep->header, type, "Basic realm=\"%s\"", basicAuthRealm);
}
}
BasicAuthQueueNode *tmpnode;
char *t = NULL;
void *cbdata;
- debug(29, 9) ("authenticateBasicHandleReply: {%s}\n", reply ? reply : "<NULL>");
+ debugs(29, 9, "authenticateBasicHandleReply: {" << (reply ? reply : "<NULL>") << "}");
if (reply) {
if ((t = strchr(reply, ' ')))
} else if (strcasecmp(param_str, "casesensitive") == 0) {
parse_onoff(&casesensitive);
} else {
- debug(29, 0) ("unrecognised basic auth scheme parameter '%s'\n", param_str);
+ debugs(29, 0, "unrecognised basic auth scheme parameter '" << param_str << "'");
}
}
authBasicAuthUserFindUsername(const char *username)
{
AuthUserHashPointer *usernamehash;
- debug(29, 9) ("authBasicAuthUserFindUsername: Looking for user '%s'\n", username);
+ debugs(29, 9, "authBasicAuthUserFindUsername: Looking for user '" << username << "'");
if (username && (usernamehash = static_cast<AuthUserHashPointer *>(hash_lookup(proxy_auth_username_cache, username)))) {
while (usernamehash) {
* Don't allow NL or CR in the credentials.
* Oezguer Kesim <oec@codeblau.de>
*/
- debug(29, 9) ("BasicUser::decodeCleartext: '%s'\n", cleartext);
+ debugs(29, 9, "BasicUser::decodeCleartext: '" << cleartext << "'");
if (strcspn(cleartext, "\r\n") != strlen(cleartext)) {
- debug(29, 1) ("BasicUser::decodeCleartext: bad characters in authorization header '%s'\n",
- httpAuthHeader);
+ debugs(29, 1, "BasicUser::decodeCleartext: bad characters in authorization header '" << httpAuthHeader << "'");
safe_free(cleartext);
return false;
}
passwd = cleartext;
if (cleartext == NULL) {
- debug(29, 4) ("authenticateBasicDecodeAuth: no password in proxy authorization header '%s'\n",
- httpAuthHeader);
+ debugs(29, 4, "authenticateBasicDecodeAuth: no password in proxy authorization header '" << httpAuthHeader << "'");
passwd = NULL;
currentRequest->setDenyMessage ("no password was present in the HTTP [proxy-]authorization header. This is most likely a browser bug");
} else if (*cleartext == '\0') {
- debug(29, 4) ("authenticateBasicDecodeAuth: Disallowing empty password,"
- "user is '%s'\n", username());
+ debugs(29, 4, "authenticateBasicDecodeAuth: Disallowing empty password,user is '" << username() << "'");
passwd = NULL;
currentRequest->setDenyMessage ("Request denied because you provided an empty password. Users MUST have a password.");
}
{
if (username()) {
/* log the username */
- debug(29, 9) ("authBasicDecodeAuth: Creating new user for logging '%s'\n", username());
+ debugs(29, 9, "authBasicDecodeAuth: Creating new user for logging '" << username() << "'");
/* new scheme data */
BasicUser *basic_auth = new BasicUser(& basicConfig);
auth_user_request->user(basic_auth);
BasicUser::makeCachedFrom()
{
/* the user doesn't exist in the username cache yet */
- debug(29, 9) ("authBasicDecodeAuth: Creating new user '%s'\n", username());
+ debugs(29, 9, "authBasicDecodeAuth: Creating new user '" << username() << "'");
BasicUser *basic_user = new BasicUser(&basicConfig);
/* save the credentials */
basic_user->username(username());
void
BasicUser::updateCached(BasicUser *from)
{
- debug(29, 9) ("authBasicDecodeAuth: Found user '%s' in the user cache as '%p'\n", from->username(), this);
+ debugs(29, 9, "authBasicDecodeAuth: Found user '" << from->username() << "' in the user cache as '" << this << "'");
if (strcmp(from->passwd, passwd)) {
- debug(29, 4) ("authBasicDecodeAuth: new password found. Updating in user master record and resetting auth state to unchecked\n");
+ debugs(29, 4, "authBasicDecodeAuth: new password found. Updating in user master record and resetting auth state to unchecked");
flags.credentials_ok = 0;
xfree(passwd);
passwd = from->passwd;
}
if (flags.credentials_ok == 3) {
- debug(29, 4) ("authBasicDecodeAuth: last attempt to authenticate this user failed, resetting auth state to unchecked\n");
+ debugs(29, 4, "authBasicDecodeAuth: last attempt to authenticate this user failed, resetting auth state to unchecked");
flags.credentials_ok = 0;
}
}
basic_data *basic_auth;
assert(user()->auth_type == AUTH_BASIC);
basic_auth = dynamic_cast<basic_data *>(user());
- debug(29, 9) ("AuthBasicUserRequest::start: '%s:%s'\n", basic_auth->username(),
- basic_auth->passwd);
+ debugs(29, 9, "AuthBasicUserRequest::start: '" << basic_auth->username() << ":" << basic_auth->passwd << "'");
if (basicConfig.authenticate == NULL) {
handler(data, NULL);
/*
- * $Id: auth_digest.cc,v 1.50 2006/09/03 21:05:20 hno Exp $
+ * $Id: auth_digest.cc,v 1.51 2007/04/28 22:26:49 hno Exp $
*
* DEBUG: section 29 Authenticator
* AUTHOR: Robert Collins
/* the cache's link */
authDigestNonceLink(newnonce);
newnonce->flags.incache = 1;
- debug(29, 5) ("authenticateDigestNonceNew: created nonce %p at %ld\n", newnonce, (long int) newnonce->noncedata.creationtime);
+ debugs(29, 5, "authenticateDigestNonceNew: created nonce " << newnonce << " at " << (long int) newnonce->noncedata.creationtime);
return newnonce;
}
digest_nonce_h *nonce;
if (digest_nonce_cache) {
- debug(29, 2) ("authenticateDigestNonceShutdown: Shutting down nonce cache \n");
+ debugs(29, 2, "authenticateDigestNonceShutdown: Shutting down nonce cache ");
hash_first(digest_nonce_cache);
while ((nonce = ((digest_nonce_h *) hash_next(digest_nonce_cache)))) {
}
#endif
- debug(29, 2) ("authenticateDigestNonceShutdown: Nonce cache shutdown\n");
+ debugs(29, 2, "authenticateDigestNonceShutdown: Nonce cache shutdown");
}
static void
* first.
*/
digest_nonce_h *nonce;
- debug(29, 3) ("authenticateDigestNonceCacheCleanup: Cleaning the nonce cache now\n");
- debug(29, 3) ("authenticateDigestNonceCacheCleanup: Current time: %ld\n",
- (long int) current_time.tv_sec);
+ debugs(29, 3, "authenticateDigestNonceCacheCleanup: Cleaning the nonce cache now");
+ debugs(29, 3, "authenticateDigestNonceCacheCleanup: Current time: " << (long int) current_time.tv_sec);
hash_first(digest_nonce_cache);
while ((nonce = ((digest_nonce_h *) hash_next(digest_nonce_cache)))) {
- debug(29, 3) ("authenticateDigestNonceCacheCleanup: nonce entry : %p '%s'\n", nonce, (char *) nonce->key);
- debug(29, 4) ("authenticateDigestNonceCacheCleanup: Creation time: %ld\n", (long int) nonce->noncedata.creationtime);
+ debugs(29, 3, "authenticateDigestNonceCacheCleanup: nonce entry : " << nonce << " '" << (char *) nonce->key << "'");
+ debugs(29, 4, "authenticateDigestNonceCacheCleanup: Creation time: " << (long int) nonce->noncedata.creationtime);
if (authDigestNonceIsStale(nonce)) {
- debug(29, 4) ("authenticateDigestNonceCacheCleanup: Removing nonce %s from cache due to timeout.\n", (char *) nonce->key);
+ debugs(29, 4, "authenticateDigestNonceCacheCleanup: Removing nonce " << (char *) nonce->key << " from cache due to timeout.");
assert(nonce->flags.incache);
/* invalidate nonce so future requests fail */
nonce->flags.valid = 0;
}
}
- debug(29, 3) ("authenticateDigestNonceCacheCleanup: Finished cleaning the nonce cache.\n");
+ debugs(29, 3, "authenticateDigestNonceCacheCleanup: Finished cleaning the nonce cache.");
if (digestConfig.active())
eventAdd("Digest none cache maintenance", authenticateDigestNonceCacheCleanup, NULL, digestConfig.nonceGCInterval, 1);
{
assert(nonce != NULL);
nonce->references++;
- debug(29, 9) ("authDigestNonceLink: nonce '%p' now at '%d'.\n", nonce, nonce->references);
+ debugs(29, 9, "authDigestNonceLink: nonce '" << nonce << "' now at '" << nonce->references << "'.");
}
#if NOT_USED
if (nonce->references > 0) {
nonce->references--;
} else {
- debug(29, 1) ("authDigestNonceUnlink; Attempt to lower nonce %p refcount below 0!\n", nonce);
+ debugs(29, 1, "authDigestNonceUnlink; Attempt to lower nonce " << nonce << " refcount below 0!");
}
- debug(29, 9) ("authDigestNonceUnlink: nonce '%p' now at '%d'.\n", nonce, nonce->references);
+ debugs(29, 9, "authDigestNonceUnlink: nonce '" << nonce << "' now at '" << nonce->references << "'.");
if (nonce->references == 0)
authenticateDigestNonceDelete(nonce);
if (nonceb64 == NULL)
return NULL;
- debug(29, 9) ("authDigestNonceFindNonce:looking for nonceb64 '%s' in the nonce cache.\n", nonceb64);
+ debugs(29, 9, "authDigestNonceFindNonce:looking for nonceb64 '" << nonceb64 << "' in the nonce cache.");
nonce = static_cast < digest_nonce_h * >(hash_lookup(digest_nonce_cache, nonceb64));
if ((nonce == NULL) || (strcmp(authenticateDigestNonceNonceb64(nonce), nonceb64)))
return NULL;
- debug(29, 9) ("authDigestNonceFindNonce: Found nonce '%p'\n", nonce);
+ debugs(29, 9, "authDigestNonceFindNonce: Found nonce '" << nonce << "'");
return nonce;
}
/* has it already been invalidated ? */
if (!nonce->flags.valid) {
- debug(29, 4) ("authDigestNonceIsValid: Nonce already invalidated\n");
+ debugs(29, 4, "authDigestNonceIsValid: Nonce already invalidated");
return 0;
}
if ((digestConfig.NonceStrictness && intnc != nonce->nc + 1) ||
intnc < nonce->nc + 1) {
- debug(29, 4) ("authDigestNonceIsValid: Nonce count doesn't match\n");
+ debugs(29, 4, "authDigestNonceIsValid: Nonce count doesn't match");
nonce->flags.valid = 0;
return 0;
}
/* has it's max duration expired? */
if (nonce->noncedata.creationtime + digestConfig.noncemaxduration < current_time.tv_sec) {
- debug(29, 4) ("authDigestNonceIsStale: Nonce is too old. %ld %d %ld\n", (long int) nonce->noncedata.creationtime, (int) digestConfig.noncemaxduration, (long int) current_time.tv_sec);
+ debugs(29, 4, "authDigestNonceIsStale: Nonce is too old. " <<
+ (long int) nonce->noncedata.creationtime << " " <<
+ (int) digestConfig.noncemaxduration << " " <<
+ (long int) current_time.tv_sec);
+
nonce->flags.valid = 0;
return -1;
}
if (nonce->nc > 99999998) {
- debug(29, 4) ("authDigestNonceIsStale: Nonce count overflow\n");
+ debugs(29, 4, "authDigestNonceIsStale: Nonce count overflow");
nonce->flags.valid = 0;
return -1;
}
if (nonce->nc > digestConfig.noncemaxuses) {
- debug(29, 4) ("authDigestNoncelastRequest: Nonce count over user limit\n");
+ debugs(29, 4, "authDigestNoncelastRequest: Nonce count over user limit");
nonce->flags.valid = 0;
return -1;
}
return -1;
if (nonce->nc == 99999997) {
- debug(29, 4) ("authDigestNoncelastRequest: Nonce count about to overflow\n");
+ debugs(29, 4, "authDigestNoncelastRequest: Nonce count about to overflow");
return -1;
}
if (nonce->nc >= digestConfig.noncemaxuses - 1) {
- debug(29, 4) ("authDigestNoncelastRequest: Nonce count about to hit user limit\n");
+ debugs(29, 4, "authDigestNoncelastRequest: Nonce count about to hit user limit");
return -1;
}
{
auth_user_hash_pointer *usernamehash;
auth_user_t *auth_user;
- debug(29, 9) ("authDigestUserFindUsername: Looking for user '%s'\n", username);
+ debugs(29, 9, "authDigestUserFindUsername: Looking for user '" << username << "'");
if (username && (usernamehash = static_cast < auth_user_hash_pointer * >(hash_lookup(proxy_auth_username_cache, username)))) {
while ((usernamehash->user()->auth_type != AUTH_DIGEST) &&
authDigestUserShutdown();
authenticateDigestNonceShutdown();
- debug(29, 2) ("authenticateDigestDone: Digest authentication shut down.\n");
+ debugs(29, 2, "authenticateDigestDone: Digest authentication shut down.");
}
void
AuthDigestConfig::dump(StoreEntry * entry, const char *name, AuthConfig * scheme)
{
wordlist *list = authenticate;
- debug(29, 9) ("authDigestCfgDump: Dumping configuration\n");
+ debugs(29, 9, "authDigestCfgDump: Dumping configuration");
storeAppendPrintf(entry, "%s %s", name, "digest");
while (list != NULL) {
digest_request->nc, digest_request->cnonce, digest_request->qop,
RequestMethodStr[request->method], digest_request->uri, HA2, Response);
- debug(29, 9) ("\nResponse = '%s'\n"
- "squid is = '%s'\n", digest_request->response, Response);
+ debugs(29, 9, "\nResponse = '" << digest_request->response << "'\nsquid is = '" << Response << "'");
if (strcasecmp(digest_request->response, Response) != 0) {
if (!digest_request->flags.helper_queried) {
}
if (memcmp(&last_broken_addr, &request->client_addr, sizeof(last_broken_addr)) != 0) {
- debug(29, 1) ("\nDigest POST bug detected from %s using '%s'. Please upgrade browser. See Bug #630 for details.\n", inet_ntoa(request->client_addr), useragent ? useragent : "-");
+ debugs(29, 1, "\nDigest POST bug detected from " <<
+ inet_ntoa(request->client_addr) << " using '" <<
+ (useragent ? useragent : "-") <<
+ "'. Please upgrade browser. See Bug #630 for details.");
+
last_broken_addr = request->client_addr;
}
}
/* check for stale nonce */
if (!authDigestNonceIsValid(digest_request->nonce, digest_request->nc)) {
- debug(29, 3) ("authenticateDigestAuthenticateuser: user '%s' validated OK but nonce stale\n",
- digest_user->username());
+ debugs(29, 3, "authenticateDigestAuthenticateuser: user '" << digest_user->username() << "' validated OK but nonce stale");
digest_request->flags.nonce_stale = 1;
credentials(Failed);
digest_request->setDenyMessage("Stale nonce");
credentials(Ok);
/* password was checked and did match */
- debug(29, 4) ("authenticateDigestAuthenticateuser: user '%s' validated OK\n",
- digest_user->username());
+ debugs(29, 4, "authenticateDigestAuthenticateuser: user '" << digest_user->username() << "' validated OK");
/* auth_user is now linked, we reset these values
* after external auth occurs anyway */
if ((digestConfig.authenticate) && authDigestNonceLastRequest(nonce)) {
flags.authinfo_sent = 1;
- debug(29, 9) ("authDigestAddHead: Sending type:%d header: 'nextnonce=\"%s\"", type, authenticateDigestNonceNonceb64(nonce));
+ debugs(29, 9, "authDigestAddHead: Sending type:" << type << " header: 'nextnonce=\"" << authenticateDigestNonceNonceb64(nonce) << "\"");
httpHeaderPutStrf(&rep->header, type, "nextnonce=\"%s\"", authenticateDigestNonceNonceb64(nonce));
}
}
type = accel ? HDR_AUTHENTICATION_INFO : HDR_PROXY_AUTHENTICATION_INFO;
if ((digestConfig.authenticate) && authDigestNonceLastRequest(nonce)) {
- debug(29, 9) ("authDigestAddTrailer: Sending type:%d header: 'nextnonce=\"%s\"", type, authenticateDigestNonceNonceb64(nonce));
+ debugs(29, 9, "authDigestAddTrailer: Sending type:" << type << " header: 'nextnonce=\"" << authenticateDigestNonceNonceb64(nonce) << "\"");
httpTrailerPutStrf(&rep->header, type, "nextnonce=\"%s\"", authenticateDigestNonceNonceb64(nonce));
}
}
/* on a 407 or 401 we always use a new nonce */
digest_nonce_h *nonce = authenticateDigestNonceNew();
- debug(29, 9) ("authenticateFixHeader: Sending type:%d header: 'Digest realm=\"%s\", nonce=\"%s\", qop=\"%s\", stale=%s\n", type, digestAuthRealm, authenticateDigestNonceNonceb64(nonce), QOP_AUTH, stale ? "true" : "false");
+ debugs(29, 9, "authenticateFixHeader: Sending type:" << type <<
+ " header: 'Digest realm=\"" << digestAuthRealm << "\", nonce=\"" <<
+ authenticateDigestNonceNonceb64(nonce) << "\", qop=\"" << QOP_AUTH <<
+ "\", stale=" << (stale ? "true" : "false"));
/* in the future, for WWW auth we may want to support the domain entry */
httpHeaderPutStrf(&rep->header, type, "Digest realm=\"%s\", nonce=\"%s\", qop=\"%s\", stale=%s", digestAuthRealm, authenticateDigestNonceNonceb64(nonce), QOP_AUTH, stale ? "true" : "false");
digest_user_h *digest_user;
char *t = NULL;
void *cbdata;
- debug(29, 9) ("authenticateDigestHandleReply: {%s}\n", reply ? reply : "<NULL>");
+ debugs(29, 9, "authenticateDigestHandleReply: {" << (reply ? reply : "<NULL>") << "}");
if (reply) {
if ((t = strchr(reply, ' ')))
} else if (strcasecmp(param_str, "post_workaround") == 0) {
parse_onoff(&PostWorkaround);
} else {
- debug(29, 0) ("unrecognised digest auth scheme parameter '%s'\n", param_str);
+ debugs(29, 0, "unrecognised digest auth scheme parameter '" << param_str << "'");
}
}
assert(auth_user_request != NULL);
/* log the username */
- debug(29, 9) ("authDigestLogUsername: Creating new user for logging '%s'\n", username);
+ debugs(29, 9, "authDigestLogUsername: Creating new user for logging '" << username << "'");
digest_user_h *digest_user = new DigestUser(&digestConfig);
/* save the credentials */
digest_user->username(username);
digest_nonce_h *nonce;
int ilen;
- debug(29, 9) ("authenticateDigestDecodeAuth: beginning\n");
+ debugs(29, 9, "authenticateDigestDecodeAuth: beginning");
AuthDigestUserRequest *digest_request = new AuthDigestUserRequest();
username = xstrndup(p, strchr(p, '"') + 1 - p);
- debug(29, 9) ("authDigestDecodeAuth: Found Username '%s'\n", username);
+ debugs(29, 9, "authDigestDecodeAuth: Found Username '" << username << "'");
} else if (!strncmp(item, "realm", ilen)) {
/* white space */
digest_request->realm = xstrndup(p, strchr(p, '"') + 1 - p);
- debug(29, 9) ("authDigestDecodeAuth: Found realm '%s'\n", digest_request->realm);
+ debugs(29, 9, "authDigestDecodeAuth: Found realm '" << digest_request->realm << "'");
} else if (!strncmp(item, "qop", ilen)) {
/* white space */
digest_request->qop = xstrndup(p, strcspn(p, "\" \t\r\n()<>@,;:\\/[]?={}") + 1);
- debug(29, 9) ("authDigestDecodeAuth: Found qop '%s'\n", digest_request->qop);
+ debugs(29, 9, "authDigestDecodeAuth: Found qop '" << digest_request->qop << "'");
} else if (!strncmp(item, "algorithm", ilen)) {
/* white space */
digest_request->algorithm = xstrndup(p, strcspn(p, "\" \t\r\n()<>@,;:\\/[]?={}") + 1);
- debug(29, 9) ("authDigestDecodeAuth: Found algorithm '%s'\n", digest_request->algorithm);
+ debugs(29, 9, "authDigestDecodeAuth: Found algorithm '" << digest_request->algorithm << "'");
} else if (!strncmp(item, "uri", ilen)) {
/* white space */
digest_request->uri = xstrndup(p, strchr(p, '"') + 1 - p);
- debug(29, 9) ("authDigestDecodeAuth: Found uri '%s'\n", digest_request->uri);
+ debugs(29, 9, "authDigestDecodeAuth: Found uri '" << digest_request->uri << "'");
} else if (!strncmp(item, "nonce", ilen)) {
/* white space */
digest_request->nonceb64 = xstrndup(p, strchr(p, '"') + 1 - p);
- debug(29, 9) ("authDigestDecodeAuth: Found nonce '%s'\n", digest_request->nonceb64);
+ debugs(29, 9, "authDigestDecodeAuth: Found nonce '" << digest_request->nonceb64 << "'");
} else if (!strncmp(item, "nc", ilen)) {
/* white space */
xstrncpy(digest_request->nc, p, 9);
- debug(29, 9) ("authDigestDecodeAuth: Found noncecount '%s'\n", digest_request->nc);
+ debugs(29, 9, "authDigestDecodeAuth: Found noncecount '" << digest_request->nc << "'");
} else if (!strncmp(item, "cnonce", ilen)) {
/* white space */
digest_request->cnonce = xstrndup(p, strchr(p, '"') + 1 - p);
- debug(29, 9) ("authDigestDecodeAuth: Found cnonce '%s'\n", digest_request->cnonce);
+ debugs(29, 9, "authDigestDecodeAuth: Found cnonce '" << digest_request->cnonce << "'");
} else if (!strncmp(item, "response", ilen)) {
/* white space */
digest_request->response = xstrndup(p, strchr(p, '"') + 1 - p);
- debug(29, 9) ("authDigestDecodeAuth: Found response '%s'\n", digest_request->response);
+ debugs(29, 9, "authDigestDecodeAuth: Found response '" << digest_request->response << "'");
}
}
/* first the NONCE count */
if (digest_request->cnonce && strlen(digest_request->nc) != 8) {
- debug(29, 4) ("authenticateDigestDecode: nonce count length invalid\n");
+ debugs(29, 4, "authenticateDigestDecode: nonce count length invalid");
delete digest_request;
return authDigestLogUsername(username);
}
if (!nonce) {
/* we couldn't find a matching nonce! */
- debug(29, 4) ("authenticateDigestDecode: Unexpected or invalid nonce recieved\n");
+ debugs(29, 4, "authenticateDigestDecode: Unexpected or invalid nonce recieved");
delete digest_request;
return authDigestLogUsername(username);
}
if (!digest_request->qop || strcmp(digest_request->qop, QOP_AUTH)) {
/* we recieved a qop option we didn't send */
- debug(29, 4) ("authenticateDigestDecode: Invalid qop option recieved\n");
+ debugs(29, 4, "authenticateDigestDecode: Invalid qop option recieved");
delete digest_request;
return authDigestLogUsername(username);
}
/* is the response the correct length? */
if (!digest_request->response || strlen(digest_request->response) != 32) {
- debug(29, 4) ("authenticateDigestDecode: Response length invalid\n");
+ debugs(29, 4, "authenticateDigestDecode: Response length invalid");
delete digest_request;
return authDigestLogUsername(username);
}
/* do we have a username ? */
if (!username || username[0] == '\0') {
- debug(29, 4) ("authenticateDigestDecode: Empty or not present username\n");
+ debugs(29, 4, "authenticateDigestDecode: Empty or not present username");
delete digest_request;
return authDigestLogUsername(username);
}
/* check that we're not being hacked / the username hasn't changed */
if (nonce->user && strcmp(username, nonce->user->username())) {
- debug(29, 4) ("authenticateDigestDecode: Username for the nonce does not equal the username for the request\n");
+ debugs(29, 4, "authenticateDigestDecode: Username for the nonce does not equal the username for the request");
delete digest_request;
return authDigestLogUsername(username);
}
/* if we got a qop, did we get a cnonce or did we get a cnonce wihtout a qop? */
if ((digest_request->qop && !digest_request->cnonce)
|| (!digest_request->qop && digest_request->cnonce)) {
- debug(29, 4) ("authenticateDigestDecode: qop without cnonce, or vice versa!\n");
+ debugs(29, 4, "authenticateDigestDecode: qop without cnonce, or vice versa!");
delete digest_request;
return authDigestLogUsername(username);
}
digest_request->algorithm = xstrndup("MD5", 4);
else if (strcmp(digest_request->algorithm, "MD5")
&& strcmp(digest_request->algorithm, "MD5-sess")) {
- debug(29, 4) ("authenticateDigestDecode: invalid algorithm specified!\n");
+ debugs(29, 4, "authenticateDigestDecode: invalid algorithm specified!");
delete digest_request;
return authDigestLogUsername(username);
}
if ((auth_user = authDigestUserFindUsername(username)) == NULL) {
/* the user doesn't exist in the username cache yet */
- debug(29, 9) ("authDigestDecodeAuth: Creating new digest user '%s'\n", username);
+ debugs(29, 9, "authDigestDecodeAuth: Creating new digest user '" << username << "'");
digest_user = new DigestUser (&digestConfig);
/* auth_user is a parent */
auth_user = digest_user;
*/
authDigestUserLinkNonce(digest_user, nonce);
} else {
- debug(29, 9) ("authDigestDecodeAuth: Found user '%s' in the user cache as '%p'\n", username, auth_user);
+ debugs(29, 9, "authDigestDecodeAuth: Found user '" << username << "' in the user cache as '" << auth_user << "'");
digest_user = static_cast < digest_user_h * >(auth_user);
xfree(username);
}
digest_user->addRequest (digest_request);
- debug(29, 9) ("username = '%s'\nrealm = '%s'\nqop = '%s'\nalgorithm = '%s'\nuri = '%s'\nnonce = '%s'\nnc = '%s'\ncnonce = '%s'\nresponse = '%s'\ndigestnonce = '%p'\n",
- digest_user->username(), digest_request->realm,
- digest_request->qop, digest_request->algorithm,
- digest_request->uri, digest_request->nonceb64,
- digest_request->nc, digest_request->cnonce, digest_request->response, nonce);
+ debugs(29, 9, "username = '" << digest_user->username() << "'\nrealm = '" <<
+ digest_request->realm << "'\nqop = '" << digest_request->qop <<
+ "'\nalgorithm = '" << digest_request->algorithm << "'\nuri = '" <<
+ digest_request->uri << "'\nnonce = '" << digest_request->nonceb64 <<
+ "'\nnc = '" << digest_request->nc << "'\ncnonce = '" <<
+ digest_request->cnonce << "'\nresponse = '" <<
+ digest_request->response << "'\ndigestnonce = '" << nonce << "'");
return digest_request;
}
digest_user_h *digest_user;
assert(user()->auth_type == AUTH_DIGEST);
digest_user = dynamic_cast < digest_user_h * >(user());
- debug(29, 9) ("authenticateStart: '\"%s\":\"%s\"'\n", digest_user->username(),
- realm);
+ debugs(29, 9, "authenticateStart: '\"" << digest_user->username() << "\":\"" << realm << "\"'");
if (digestConfig.authenticate == NULL) {
handler(data, NULL);
/*
- * $Id: auth_negotiate.cc,v 1.13 2007/01/20 21:13:59 hno Exp $
+ * $Id: auth_negotiate.cc,v 1.14 2007/04/28 22:26:49 hno Exp $
*
* DEBUG: section 29 Negotiate Authenticator
* AUTHOR: Robert Collins, Henrik Nordstrom, Francesco Chemolli
negotiateScheme::done()
{
/* TODO: this should be a Config call. */
- debug(29, 2) ("negotiateScheme::done: shutting down Negotiate authentication.\n");
+ debugs(29, 2, "negotiateScheme::done: shutting down Negotiate authentication.");
if (negotiateauthenticators)
helperStatefulShutdown(negotiateauthenticators);
negotiateauthenticators = NULL;
- debug(29, 2) ("negotiateScheme::done: Negotiate authentication Shutdown.\n");
+ debugs(29, 2, "negotiateScheme::done: Negotiate authentication Shutdown.");
}
/* free any allocated configuration details */
} else if (strcasecmp(param_str, "keep_alive") == 0) {
parse_onoff(&keep_alive);
} else {
- debug(29, 0) ("AuthNegotiateConfig::parse: unrecognised negotiate auth scheme parameter '%s'\n", param_str);
+ debugs(29, 0, "AuthNegotiateConfig::parse: unrecognised negotiate auth scheme parameter '" << param_str << "'");
}
/*
AuthNegotiateConfig::configured() const
{
if ((authenticate != NULL) && (authenticateChildren != 0)) {
- debug(29, 9) ("AuthNegotiateConfig::configured: returning configured\n");
+ debugs(29, 9, "AuthNegotiateConfig::configured: returning configured");
return true;
}
- debug(29, 9) ("AuthNegotiateConfig::configured: returning unconfigured\n");
+ debugs(29, 9, "AuthNegotiateConfig::configured: returning unconfigured");
return false;
}
/* no progress at all. */
case AUTHENTICATE_STATE_NONE:
- debug(29, 1) ("AuthNegotiateUserRequest::direction: called before Negotiate Authenticate for request %p!. Report a bug to squid-dev.\n",this);
+ debugs(29, 1, "AuthNegotiateUserRequest::direction: called before Negotiate Authenticate for request " << this << "!. Report a bug to squid-dev.");
return -2; /* error */
case AUTHENTICATE_STATE_FAILED:
return 0; /* do nothing */
case AUTHENTICATE_STATE_INITIAL:
- debug(29, 1) ("AuthNegotiateUserRequest::direction: Unexpected AUTHENTICATE_STATE_INITIAL\n");
+ debugs(29, 1, "AuthNegotiateUserRequest::direction: Unexpected AUTHENTICATE_STATE_INITIAL");
return -2;
}
/* New request, no user details */
if (auth_user_request == NULL) {
- debug(29, 9) ("AuthNegotiateConfig::fixHeader: Sending type:%d header: 'NEGOTIATE'\n", type);
+ debugs(29, 9, "AuthNegotiateConfig::fixHeader: Sending type:" << type << " header: 'NEGOTIATE'");
httpHeaderPutStrf(&rep->header, type, "NEGOTIATE");
if (!keep_alive) {
*/
if (negotiate_request->server_blob) {
- debug(29, 9) ("authenticateNegotiateFixErrorHeader: Sending type:%d header: 'Negotiate %s'\n", type, negotiate_request->server_blob);
+ debugs(29, 9, "authenticateNegotiateFixErrorHeader: Sending type:" << type << " header: 'Negotiate " << negotiate_request->server_blob << "'");
httpHeaderPutStrf(&rep->header, type, "Negotiate %s", negotiate_request->server_blob);
safe_free(negotiate_request->server_blob);
} else {
- debug(29, 9) ("authenticateNegotiateFixErrorHeader: Connection authenticated\n");
+ debugs(29, 9, "authenticateNegotiateFixErrorHeader: Connection authenticated");
httpHeaderPutStrf(&rep->header, type, "Negotiate");
}
case AUTHENTICATE_STATE_NONE:
/* semantic change: do not drop the connection.
* 2.5 implementation used to keep it open - Kinkie */
- debug(29, 9) ("AuthNegotiateConfig::fixHeader: Sending type:%d header: 'NEGOTIATE'\n", type);
+ debugs(29, 9, "AuthNegotiateConfig::fixHeader: Sending type:" << type << " header: 'NEGOTIATE'");
httpHeaderPutStrf(&rep->header, type, "Negotiate");
break;
case AUTHENTICATE_STATE_IN_PROGRESS:
/* we're waiting for a response from the client. Pass it the blob */
- debug(29, 9) ("AuthNegotiateConfig::fixHeader: Sending type:%d header: 'Negotiate %s'\n", type, negotiate_request->server_blob);
+ debugs(29, 9, "AuthNegotiateConfig::fixHeader: Sending type:" << type << " header: 'Negotiate " << negotiate_request->server_blob << "'");
httpHeaderPutStrf(&rep->header, type, "Negotiate %s", negotiate_request->server_blob);
request->flags.must_keepalive = 1;
safe_free(negotiate_request->server_blob);
default:
- debug(29, 0) ("AuthNegotiateConfig::fixHeader: state %d.\n", negotiate_request->auth_state);
+ debugs(29, 0, "AuthNegotiateConfig::fixHeader: state " << negotiate_request->auth_state << ".");
fatal("unexpected state in AuthenticateNegotiateFixErrorHeader.\n");
}
}
NegotiateUser::~NegotiateUser()
{
- debug(29, 5) ("NegotiateUser::~NegotiateUser: doing nothing to clearNEGOTIATE scheme data for '%p'\n",this);
+ debugs(29, 5, "NegotiateUser::~NegotiateUser: doing nothing to clearNEGOTIATE scheme data for '" << this << "'");
}
static stateful_helper_callback_t
NegotiateUser *negotiate_user;
AuthNegotiateUserRequest *negotiate_request;
- debug(29, 8) ("authenticateNegotiateHandleReply: helper: '%p' sent us '%s'\n", lastserver, reply ? reply : "<NULL>");
+ debugs(29, 8, "authenticateNegotiateHandleReply: helper: '" << lastserver << "' sent us '" << (reply ? reply : "<NULL>") << "'");
valid = cbdataReferenceValid(r->data);
if (!valid) {
- debug(29, 1) ("authenticateNegotiateHandleReply: invalid callback data. Releasing helper '%p'.\n", lastserver);
+ debugs(29, 1, "authenticateNegotiateHandleReply: invalid callback data. Releasing helper '" << lastserver << "'.");
cbdataReferenceDone(r->data);
authenticateStateFree(r);
- debug(29, 9) ("authenticateNegotiateHandleReply: telling stateful helper : %d\n", S_HELPER_RELEASE);
+ debugs(29, 9, "authenticateNegotiateHandleReply: telling stateful helper : " << S_HELPER_RELEASE);
return S_HELPER_RELEASE;
}
if (!reply) {
- debug(29, 1) ("authenticateNegotiateHandleReply: Helper '%p' crashed!.\n", lastserver);
+ debugs(29, 1, "authenticateNegotiateHandleReply: Helper '" << lastserver << "' crashed!.");
reply = (char *)"BH Internal error";
}
auth_user_request->denyMessage("Authentication in progress");
- debug(29, 4) ("authenticateNegotiateHandleReply: Need to challenge the client with a server blob '%s'\n", blob);
+ debugs(29, 4, "authenticateNegotiateHandleReply: Need to challenge the client with a server blob '" << blob << "'");
result = S_HELPER_RESERVE;
} else if (strncasecmp(reply, "AF ", 3) == 0 && arg != NULL) {
result = S_HELPER_RELEASE;
- debug(29, 4) ("authenticateNegotiateHandleReply: Successfully validated user via NEGOTIATE. Username '%s'\n", blob);
+ debugs(29, 4, "authenticateNegotiateHandleReply: Successfully validated user via NEGOTIATE. Username '" << blob << "'");
} else if (strncasecmp(reply, "NA ", 3) == 0 && arg != NULL) {
/* authentication failure (wrong password, etc.) */
result = S_HELPER_RELEASE;
- debug(29, 4) ("authenticateNegotiateHandleReply: Failed validating user via NEGOTIATE. Error returned '%s'\n", blob);
+ debugs(29, 4, "authenticateNegotiateHandleReply: Failed validating user via NEGOTIATE. Error returned '" << blob << "'");
} else if (strncasecmp(reply, "BH ", 3) == 0) {
/* TODO kick off a refresh process. This can occur after a YR or after
* a KK. If after a YR release the helper and resubmit the request via
safe_free(negotiate_request->server_blob);
authenticateNegotiateReleaseServer(negotiate_request);
result = S_HELPER_RELEASE;
- debug(29, 1) ("authenticateNegotiateHandleReply: Error validating user via NEGOTIATE. Error returned '%s'\n", reply);
+ debugs(29, 1, "authenticateNegotiateHandleReply: Error validating user via NEGOTIATE. Error returned '" << reply << "'");
} else {
/* protocol error */
fatalf("authenticateNegotiateHandleReply: *** Unsupported helper response ***, '%s'\n", reply);
r->handler(r->data, NULL);
cbdataReferenceDone(r->data);
authenticateStateFree(r);
- debug(29, 9) ("authenticateNegotiateHandleReply: telling stateful helper : %d\n", result);
+ debugs(29, 9, "authenticateNegotiateHandleReply: telling stateful helper : " << result);
return result;
}
negotiate_user = dynamic_cast<negotiate_user_t *>(user());
- debug(29, 8) ("AuthNegotiateUserRequest::module_start: auth state is '%d'\n", auth_state);
+ debugs(29, 8, "AuthNegotiateUserRequest::module_start: auth state is '" << auth_state << "'");
if (negotiateConfig.authenticate == NULL) {
- debug(29, 0) ("AuthNegotiateUserRequest::module_start: no NEGOTIATE program specified.");
+ debugs(29, 0, "AuthNegotiateUserRequest::module_start: no NEGOTIATE program specified.");
handler(data, NULL);
return;
}
AuthNegotiateUserRequest *negotiate_request;
assert(auth_user_request->user()->auth_type == AUTH_NEGOTIATE);
negotiate_request = dynamic_cast< AuthNegotiateUserRequest *>(auth_user_request);
- debug(29, 9) ("authenticateNegotiateReleaseServer: releasing server '%p'\n", negotiate_request->authserver);
+ debugs(29, 9, "authenticateNegotiateReleaseServer: releasing server '" << negotiate_request->authserver << "'");
/* is it possible for the server to be NULL? hno seems to think so.
* Let's see what happens, might segfault in helperStatefulReleaseServer
* if it does. I leave it like this not to cover possibly problematic
{
assert(connection != NULL);
- debug(29,8)("AuthNegotiateUserRequest::onConnectionClose: closing connection '%p' (this is '%p')\n",connection,this);
+ debugs(29, 8, "AuthNegotiateUserRequest::onConnectionClose: closing connection '" << connection << "' (this is '" << this << "')");
if (connection->auth_user_request == NULL) {
- debug(29,8)("AuthNegotiateUserRequest::onConnectionClose: no auth_user_request\n");
+ debugs(29, 8, "AuthNegotiateUserRequest::onConnectionClose: no auth_user_request");
return;
}
authenticateNegotiateReleaseServer(this);
/* unlock the connection based lock */
- debug(29, 9) ("AuthNegotiateUserRequest::onConnectionClose: Unlocking auth_user from the connection '%p'.\n",connection);
+ debugs(29, 9, "AuthNegotiateUserRequest::onConnectionClose: Unlocking auth_user from the connection '" << connection << "'.");
/* This still breaks the abstraction, but is at least read only now.
* If needed, this could be ignored, as the conn deletion will also unlock
auth_user_request->user()->addRequest(auth_user_request);
/* all we have to do is identify that it's NEGOTIATE - the helper does the rest */
- debug(29, 9) ("AuthNegotiateConfig::decode: NEGOTIATE authentication\n");
+ debugs(29, 9, "AuthNegotiateConfig::decode: NEGOTIATE authentication");
return auth_user_request;
}
AuthNegotiateUserRequest::authenticated() const
{
if (auth_state == AUTHENTICATE_STATE_DONE) {
- debug(29, 9) ("AuthNegotiateUserRequest::authenticated: user authenticated.\n");
+ debugs(29, 9, "AuthNegotiateUserRequest::authenticated: user authenticated.");
return 1;
}
- debug(29, 9) ("AuthNegotiateUserRequest::authenticated: user not fully authenticated.\n");
+ debugs(29, 9, "AuthNegotiateUserRequest::authenticated: user not fully authenticated.");
return 0;
}
if (conn.getRaw() == NULL) {
auth_state = AUTHENTICATE_STATE_FAILED;
- debug(29, 1) ("AuthNegotiateUserRequest::authenticate: attempt to perform authentication without a connection!\n");
+ debugs(29, 1, "AuthNegotiateUserRequest::authenticate: attempt to perform authentication without a connection!");
return;
}
if (waiting) {
- debug(29, 1) ("AuthNegotiateUserRequest::authenticate: waiting for helper reply!\n");
+ debugs(29, 1, "AuthNegotiateUserRequest::authenticate: waiting for helper reply!");
return;
}
if (server_blob) {
- debug(29,2)("AuthNegotiateUserRequest::authenticate: need to challenge client '%s'!\n", server_blob);
+ debugs(29, 2, "AuthNegotiateUserRequest::authenticate: need to challenge client '" << server_blob << "'!");
return;
}
case AUTHENTICATE_STATE_NONE:
/* we've recieved a negotiate request. pass to a helper */
- debug(29, 9) ("AuthNegotiateUserRequest::authenticate: auth state negotiate none. Received blob: '%s'\n", proxy_auth);
+ debugs(29, 9, "AuthNegotiateUserRequest::authenticate: auth state negotiate none. Received blob: '" << proxy_auth << "'");
auth_state = AUTHENTICATE_STATE_INITIAL;
safe_free(client_blob);
client_blob=xstrdup(blob);
break;
case AUTHENTICATE_STATE_INITIAL:
- debug(29,1)("AuthNegotiateUserRequest::authenticate: need to ask helper\n");
+ debugs(29, 1, "AuthNegotiateUserRequest::authenticate: need to ask helper");
return;
case AUTHENTICATE_STATE_FINISHED:
/* connection is authenticated */
- debug(29, 4) ("AuthNegotiateUserRequest::authenticate: authenticated user %s\n", negotiate_user->username());
+ debugs(29, 4, "AuthNegotiateUserRequest::authenticate: authenticated user " << negotiate_user->username());
/* see if this is an existing user with a different proxy_auth
* string */
case AUTHENTICATE_STATE_FAILED:
/* we've failed somewhere in authentication */
- debug(29, 9) ("AuthNegotiateUserRequest::authenticate: auth state negotiate failed. %s\n", proxy_auth);
+ debugs(29, 9, "AuthNegotiateUserRequest::authenticate: auth state negotiate failed. " << proxy_auth);
return;
safe_free(client_blob);
if (authserver != NULL) {
- debug(29, 9) ("AuthNegotiateUserRequest::~AuthNegotiateUserRequest: releasing server '%p'\n", authserver);
+ debugs(29, 9, "AuthNegotiateUserRequest::~AuthNegotiateUserRequest: releasing server '" << authserver << "'");
helperStatefulReleaseServer(authserver);
authserver = NULL;
}
/*
- * $Id: auth_ntlm.cc,v 1.62 2007/01/20 21:13:59 hno Exp $
+ * $Id: auth_ntlm.cc,v 1.63 2007/04/28 22:26:49 hno Exp $
*
* DEBUG: section 29 NTLM Authenticator
* AUTHOR: Robert Collins, Henrik Nordstrom, Francesco Chemolli
ntlmScheme::done()
{
/* TODO: this should be a Config call. */
- debug(29, 2) ("ntlmScheme::done: shutting down NTLM authentication.\n");
+ debugs(29, 2, "ntlmScheme::done: shutting down NTLM authentication.");
if (ntlmauthenticators)
helperStatefulShutdown(ntlmauthenticators);
ntlmauthenticators = NULL;
- debug(29, 2) ("ntlmScheme::done: NTLM authentication Shutdown.\n");
+ debugs(29, 2, "ntlmScheme::done: NTLM authentication Shutdown.");
}
/* free any allocated configuration details */
} else if (strcasecmp(param_str, "keep_alive") == 0) {
parse_onoff(&keep_alive);
} else {
- debug(29, 0) ("AuthNTLMConfig::parse: unrecognised ntlm auth scheme parameter '%s'\n", param_str);
+ debugs(29, 0, "AuthNTLMConfig::parse: unrecognised ntlm auth scheme parameter '" << param_str << "'");
}
/*
AuthNTLMConfig::configured() const
{
if ((authenticate != NULL) && (authenticateChildren != 0)) {
- debug(29, 9) ("AuthNTLMConfig::configured: returning configured\n");
+ debugs(29, 9, "AuthNTLMConfig::configured: returning configured");
return true;
}
- debug(29, 9) ("AuthNTLMConfig::configured: returning unconfigured\n");
+ debugs(29, 9, "AuthNTLMConfig::configured: returning unconfigured");
return false;
}
/* no progress at all. */
case AUTHENTICATE_STATE_NONE:
- debug(29, 1) ("AuthNTLMUserRequest::direction: called before NTLM Authenticate for request %p!. Report a bug to squid-dev.\n",this);
+ debugs(29, 1, "AuthNTLMUserRequest::direction: called before NTLM Authenticate for request " << this << "!. Report a bug to squid-dev.");
return -2; /* error */
case AUTHENTICATE_STATE_FAILED:
return 0; /* do nothing */
case AUTHENTICATE_STATE_INITIAL:
- debug(29, 1) ("AuthNTLMUserRequest::direction: Unexpected AUTHENTICATE_STATE_INITIAL\n");
+ debugs(29, 1, "AuthNTLMUserRequest::direction: Unexpected AUTHENTICATE_STATE_INITIAL");
return -2;
}
/* New request, no user details */
if (auth_user_request == NULL) {
- debug(29, 9) ("AuthNTLMConfig::fixHeader: Sending type:%d header: 'NTLM'\n", type);
+ debugs(29, 9, "AuthNTLMConfig::fixHeader: Sending type:" << type << " header: 'NTLM'");
httpHeaderPutStrf(&rep->header, type, "NTLM");
if (!keep_alive) {
case AUTHENTICATE_STATE_NONE:
/* semantic change: do not drop the connection.
* 2.5 implementation used to keep it open - Kinkie */
- debug(29, 9) ("AuthNTLMConfig::fixHeader: Sending type:%d header: 'NTLM'\n", type);
+ debugs(29, 9, "AuthNTLMConfig::fixHeader: Sending type:" << type << " header: 'NTLM'");
httpHeaderPutStrf(&rep->header, type, "NTLM");
break;
case AUTHENTICATE_STATE_IN_PROGRESS:
/* we're waiting for a response from the client. Pass it the blob */
- debug(29, 9) ("AuthNTLMConfig::fixHeader: Sending type:%d header: 'NTLM %s'\n", type, ntlm_request->server_blob);
+ debugs(29, 9, "AuthNTLMConfig::fixHeader: Sending type:" << type << " header: 'NTLM " << ntlm_request->server_blob << "'");
httpHeaderPutStrf(&rep->header, type, "NTLM %s", ntlm_request->server_blob);
request->flags.must_keepalive = 1;
safe_free(ntlm_request->server_blob);
default:
- debug(29, 0) ("AuthNTLMConfig::fixHeader: state %d.\n", ntlm_request->auth_state);
+ debugs(29, 0, "AuthNTLMConfig::fixHeader: state " << ntlm_request->auth_state << ".");
fatal("unexpected state in AuthenticateNTLMFixErrorHeader.\n");
}
}
NTLMUser::~NTLMUser()
{
- debug(29, 5) ("NTLMUser::~NTLMUser: doing nothing to clearNTLM scheme data for '%p'\n",this);
+ debugs(29, 5, "NTLMUser::~NTLMUser: doing nothing to clearNTLM scheme data for '" << this << "'");
}
static stateful_helper_callback_t
NTLMUser *ntlm_user;
AuthNTLMUserRequest *ntlm_request;
- debug(29, 8) ("authenticateNTLMHandleReply: helper: '%p' sent us '%s'\n", lastserver, reply ? reply : "<NULL>");
+ debugs(29, 8, "authenticateNTLMHandleReply: helper: '" << lastserver << "' sent us '" << (reply ? reply : "<NULL>") << "'");
valid = cbdataReferenceValid(r->data);
if (!valid) {
- debug(29, 1) ("authenticateNTLMHandleReply: invalid callback data. Releasing helper '%p'.\n", lastserver);
+ debugs(29, 1, "authenticateNTLMHandleReply: invalid callback data. Releasing helper '" << lastserver << "'.");
cbdataReferenceDone(r->data);
authenticateStateFree(r);
- debug(29, 9) ("authenticateNTLMHandleReply: telling stateful helper : %d\n", S_HELPER_RELEASE);
+ debugs(29, 9, "authenticateNTLMHandleReply: telling stateful helper : " << S_HELPER_RELEASE);
return S_HELPER_RELEASE;
}
if (!reply) {
- debug(29, 1) ("authenticateNTLMHandleReply: Helper '%p' crashed!.\n", lastserver);
+ debugs(29, 1, "authenticateNTLMHandleReply: Helper '" << lastserver << "' crashed!.");
reply = (char *)"BH Internal error";
}
ntlm_request->server_blob = xstrdup(blob);
ntlm_request->auth_state = AUTHENTICATE_STATE_IN_PROGRESS;
auth_user_request->denyMessage("Authenication in progress");
- debug(29, 4) ("authenticateNTLMHandleReply: Need to challenge the client with a server blob '%s'\n", blob);
+ debugs(29, 4, "authenticateNTLMHandleReply: Need to challenge the client with a server blob '" << blob << "'");
result = S_HELPER_RESERVE;
} else if (strncasecmp(reply, "AF ", 3) == 0) {
/* we're finished, release the helper */
ntlm_request->auth_state = AUTHENTICATE_STATE_FINISHED;
result = S_HELPER_RELEASE;
- debug(29, 4) ("authenticateNTLMHandleReply: Successfully validated user via NTLM. Username '%s'\n", blob);
+ debugs(29, 4, "authenticateNTLMHandleReply: Successfully validated user via NTLM. Username '" << blob << "'");
} else if (strncasecmp(reply, "NA ", 3) == 0) {
/* authentication failure (wrong password, etc.) */
auth_user_request->denyMessage(blob);
safe_free(ntlm_request->server_blob);
authenticateNTLMReleaseServer(ntlm_request);
result = S_HELPER_RELEASE;
- debug(29, 4) ("authenticateNTLMHandleReply: Failed validating user via NTLM. Error returned '%s'\n", blob);
+ debugs(29, 4, "authenticateNTLMHandleReply: Failed validating user via NTLM. Error returned '" << blob << "'");
} else if (strncasecmp(reply, "BH ", 3) == 0) {
/* TODO kick off a refresh process. This can occur after a YR or after
* a KK. If after a YR release the helper and resubmit the request via
safe_free(ntlm_request->server_blob);
authenticateNTLMReleaseServer(ntlm_request);
result = S_HELPER_RELEASE;
- debug(29, 1) ("authenticateNTLMHandleReply: Error validating user via NTLM. Error returned '%s'\n", reply);
+ debugs(29, 1, "authenticateNTLMHandleReply: Error validating user via NTLM. Error returned '" << reply << "'");
} else {
/* protocol error */
fatalf("authenticateNTLMHandleReply: *** Unsupported helper response ***, '%s'\n", reply);
r->handler(r->data, NULL);
cbdataReferenceDone(r->data);
authenticateStateFree(r);
- debug(29, 9) ("authenticateNTLMHandleReply: telling stateful helper : %d\n", result);
+ debugs(29, 9, "authenticateNTLMHandleReply: telling stateful helper : " << result);
return result;
}
ntlm_user = dynamic_cast<ntlm_user_t *>(user());
- debug(29, 8) ("AuthNTLMUserRequest::module_start: auth state is '%d'\n", auth_state);
+ debugs(29, 8, "AuthNTLMUserRequest::module_start: auth state is '" << auth_state << "'");
if (ntlmConfig.authenticate == NULL) {
- debug(29, 0) ("AuthNTLMUserRequest::module_start: no NTLM program specified.");
+ debugs(29, 0, "AuthNTLMUserRequest::module_start: no NTLM program specified.");
handler(data, NULL);
return;
}
AuthNTLMUserRequest *ntlm_request;
assert(auth_user_request->user()->auth_type == AUTH_NTLM);
ntlm_request = dynamic_cast< AuthNTLMUserRequest *>(auth_user_request);
- debug(29, 9) ("authenticateNTLMReleaseServer: releasing server '%p'\n", ntlm_request->authserver);
+ debugs(29, 9, "authenticateNTLMReleaseServer: releasing server '" << ntlm_request->authserver << "'");
/* is it possible for the server to be NULL? hno seems to think so.
* Let's see what happens, might segfault in helperStatefulReleaseServer
* if it does. I leave it like this not to cover possibly problematic
{
assert(connection != NULL);
- debug(29,8)("AuthNTLMUserRequest::onConnectionClose: closing connection '%p' (this is '%p')\n",connection,this);
+ debugs(29, 8, "AuthNTLMUserRequest::onConnectionClose: closing connection '" << connection << "' (this is '" << this << "')");
if (connection->auth_user_request == NULL) {
- debug(29,8)("AuthNTLMUserRequest::onConnectionClose: no auth_user_request\n");
+ debugs(29, 8, "AuthNTLMUserRequest::onConnectionClose: no auth_user_request");
return;
}
authenticateNTLMReleaseServer(this);
/* unlock the connection based lock */
- debug(29, 9) ("AuthNTLMUserRequest::onConnectionClose: Unlocking auth_user from the connection '%p'.\n",connection);
+ debugs(29, 9, "AuthNTLMUserRequest::onConnectionClose: Unlocking auth_user from the connection '" << connection << "'.");
/* This still breaks the abstraction, but is at least read only now.
* If needed, this could be ignored, as the conn deletion will also unlock
auth_user_request->user()->addRequest(auth_user_request);
/* all we have to do is identify that it's NTLM - the helper does the rest */
- debug(29, 9) ("AuthNTLMConfig::decode: NTLM authentication\n");
+ debugs(29, 9, "AuthNTLMConfig::decode: NTLM authentication");
return auth_user_request;
}
AuthNTLMUserRequest::authenticated() const
{
if (auth_state == AUTHENTICATE_STATE_DONE) {
- debug(29, 9) ("AuthNTLMUserRequest::authenticated: user authenticated.\n");
+ debugs(29, 9, "AuthNTLMUserRequest::authenticated: user authenticated.");
return 1;
}
- debug(29, 9) ("AuthNTLMUserRequest::authenticated: user not fully authenticated.\n");
+ debugs(29, 9, "AuthNTLMUserRequest::authenticated: user not fully authenticated.");
return 0;
}
if (conn.getRaw() == NULL) {
auth_state = AUTHENTICATE_STATE_FAILED;
- debug(29, 1) ("AuthNTLMUserRequest::authenticate: attempt to perform authentication without a connection!\n");
+ debugs(29, 1, "AuthNTLMUserRequest::authenticate: attempt to perform authentication without a connection!");
return;
}
if (waiting) {
- debug(29, 1) ("AuthNTLMUserRequest::authenticate: waiting for helper reply!\n");
+ debugs(29, 1, "AuthNTLMUserRequest::authenticate: waiting for helper reply!");
return;
}
if (server_blob) {
- debug(29,2)("AuthNTLMUserRequest::authenticate: need to challenge client '%s'!\n", server_blob);
+ debugs(29, 2, "AuthNTLMUserRequest::authenticate: need to challenge client '" << server_blob << "'!");
return;
}
case AUTHENTICATE_STATE_NONE:
/* we've recieved a ntlm request. pass to a helper */
- debug(29, 9) ("AuthNTLMUserRequest::authenticate: auth state ntlm none. Received blob: '%s'\n", proxy_auth);
+ debugs(29, 9, "AuthNTLMUserRequest::authenticate: auth state ntlm none. Received blob: '" << proxy_auth << "'");
auth_state = AUTHENTICATE_STATE_INITIAL;
safe_free(client_blob);
client_blob=xstrdup(blob);
break;
case AUTHENTICATE_STATE_INITIAL:
- debug(29,1)("AuthNTLMUserRequest::authenticate: need to ask helper\n");
+ debugs(29, 1, "AuthNTLMUserRequest::authenticate: need to ask helper");
return;
case AUTHENTICATE_STATE_FINISHED:
/* connection is authenticated */
- debug(29, 4) ("AuthNTLMUserRequest::authenticate: authenticated user %s\n", ntlm_user->username());
+ debugs(29, 4, "AuthNTLMUserRequest::authenticate: authenticated user " << ntlm_user->username());
/* see if this is an existing user with a different proxy_auth
* string */
case AUTHENTICATE_STATE_FAILED:
/* we've failed somewhere in authentication */
- debug(29, 9) ("AuthNTLMUserRequest::authenticate: auth state ntlm failed. %s\n", proxy_auth);
+ debugs(29, 9, "AuthNTLMUserRequest::authenticate: auth state ntlm failed. " << proxy_auth);
return;
safe_free(client_blob);
if (authserver != NULL) {
- debug(29, 9) ("AuthNTLMUserRequest::~AuthNTLMUserRequest: releasing server '%p'\n", authserver);
+ debugs(29, 9, "AuthNTLMUserRequest::~AuthNTLMUserRequest: releasing server '" << authserver << "'");
helperStatefulReleaseServer(authserver);
authserver = NULL;
}
/*
- * $Id: authenticate.cc,v 1.67 2006/05/29 00:15:01 robertc Exp $
+ * $Id: authenticate.cc,v 1.68 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 29 Authenticator
* AUTHOR: Robert Collins
if ((*i)->configured())
++rv;
- debug(29, 9) ("authenticateActiveSchemeCount: %d active.\n", rv);
+ debugs(29, 9, "authenticateActiveSchemeCount: " << rv << " active.");
return rv;
}
{
int rv = AuthScheme::Schemes().size();
- debug(29, 9) ("authenticateSchemeCount: %d active.\n", rv);
+ debugs(29, 9, "authenticateSchemeCount: " << rv << " active.");
return rv;
}
void
authenticateShutdown(void)
{
- debug(29, 2) ("authenticateShutdown: shutting down auth schemes\n");
+ debugs(29, 2, "authenticateShutdown: shutting down auth schemes");
/* free the cache if we are shutting down */
if (shutting_down) {
{
AuthUserHashPointer *usernamehash;
auth_user_t *auth_user;
- debug(29, 3) ("authenticateUserCacheRestart: Clearing config dependent cache data.\n");
+ debugs(29, 3, "authenticateUserCacheRestart: Clearing config dependent cache data.");
hash_first(proxy_auth_username_cache);
while ((usernamehash = ((AuthUserHashPointer *) hash_next(proxy_auth_username_cache)))) {
auth_user = usernamehash->user();
- debug(29, 5) ("authenticateUserCacheRestat: Clearing cache ACL results for user: %s\n", auth_user->username());
+ debugs(29, 5, "authenticateUserCacheRestat: Clearing cache ACL results for user: " << auth_user->username());
}
}
auth_user_t *auth_user = usernamehash->auth_user;
if ((authenticateAuthUserInuse(auth_user) - 1))
- debug(29, 1) ("AuthUserHashPointer::removeFromCache: entry in use - not freeing\n");
+ debugs(29, 1, "AuthUserHashPointer::removeFromCache: entry in use - not freeing");
auth_user->unlock();
/*
- * $Id: cache_cf.cc,v 1.509 2007/04/20 07:29:47 wessels Exp $
+ * $Id: cache_cf.cc,v 1.510 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 3 Configuration File Parsing
* AUTHOR: Harvest Derived
tmp_line_len += append_len;
if (tmp_line[tmp_line_len-1] == '\\') {
- debug(3, 5) ("parseConfigFile: tmp_line='%s'\n", tmp_line);
+ debugs(3, 5, "parseConfigFile: tmp_line='" << tmp_line << "'");
tmp_line[--tmp_line_len] = '\0';
continue;
}
- debug(3, 5) ("Processing: '%s'\n", tmp_line);
+ debugs(3, 5, "Processing: '" << tmp_line << "'");
if (!parse_line(tmp_line)) {
- debug(3, 0) ("parseConfigFile: '%s' line %d unrecognized: '%s'\n",
- cfg_filename,
- config_lineno,
- config_input_line);
+ debugs(3, 0, "parseConfigFile: '" << cfg_filename << "' line " <<
+ config_lineno << " unrecognized: '" << config_input_line << "'");
err_count++;
}
(void) 0;
else if (Store::Root().maxSize() < (Config.memMaxSize >> 10))
/* This is bogus. folk with NULL caches will want this */
- debug(3, 0) ("WARNING cache_mem is larger than total disk cache space!\n");
+ debugs(3, 0, "WARNING cache_mem is larger than total disk cache space!");
if (Config.Announce.period > 0) {
Config.onoff.announce = 1;
fatal("maximum_single_addr_tries cannot be larger than 10");
if (Config.retry.maxtries < 1) {
- debug(3, 0) ("WARNING: resetting 'maximum_single_addr_tries to 1\n");
+ debugs(3, 0, "WARNING: resetting 'maximum_single_addr_tries to 1");
Config.retry.maxtries = 1;
}
if (!R->flags.override_expire)
continue;
- debug(22, 1) ("WARNING: use of 'override-expire' in 'refresh_pattern' violates HTTP\n");
+ debugs(22, 1, "WARNING: use of 'override-expire' in 'refresh_pattern' violates HTTP");
break;
}
if (!R->flags.override_lastmod)
continue;
- debug(22, 1) ("WARNING: use of 'override-lastmod' in 'refresh_pattern' violates HTTP\n");
+ debugs(22, 1, "WARNING: use of 'override-lastmod' in 'refresh_pattern' violates HTTP");
break;
}
if (!R->flags.reload_into_ims)
continue;
- debug(22, 1) ("WARNING: use of 'reload-into-ims' in 'refresh_pattern' violates HTTP\n");
+ debugs(22, 1, "WARNING: use of 'reload-into-ims' in 'refresh_pattern' violates HTTP");
break;
}
if (!R->flags.ignore_reload)
continue;
- debug(22, 1) ("WARNING: use of 'ignore-reload' in 'refresh_pattern' violates HTTP\n");
+ debugs(22, 1, "WARNING: use of 'ignore-reload' in 'refresh_pattern' violates HTTP");
break;
}
if (!R->flags.ignore_no_cache)
continue;
- debug(22, 1) ("WARNING: use of 'ignore-no-cache' in 'refresh_pattern' violates HTTP\n");
+ debugs(22, 1, "WARNING: use of 'ignore-no-cache' in 'refresh_pattern' violates HTTP");
break;
}
if (!R->flags.ignore_no_store)
continue;
- debug(22, 1) ("WARNING: use of 'ignore-no-store' in 'refresh_pattern' violates HTTP\n");
+ debugs(22, 1, "WARNING: use of 'ignore-no-store' in 'refresh_pattern' violates HTTP");
break;
}
if (!R->flags.ignore_private)
continue;
- debug(22, 1) ("WARNING: use of 'ignore-private' in 'refresh_pattern' violates HTTP\n");
+ debugs(22, 1, "WARNING: use of 'ignore-private' in 'refresh_pattern' violates HTTP");
break;
}
if (!R->flags.ignore_auth)
continue;
- debug(22, 1) ("WARNING: use of 'ignore-auth' in 'refresh_pattern' violates HTTP\n");
+ debugs(22, 1, "WARNING: use of 'ignore-auth' in 'refresh_pattern' violates HTTP");
break;
}
#else
if (!Config.onoff.via)
- debug(22, 1) ("WARNING: HTTP requires the use of Via\n");
+ debugs(22, 1, "WARNING: HTTP requires the use of Via");
#endif
HttpRequestMethod::Configure(Config);
#if USE_SSL
- debug(3, 1) ("Initializing https proxy context\n");
+ debugs(3, 1, "Initializing https proxy context");
Config.ssl_client.sslContext = sslCreateClientContext(Config.ssl_client.cert, Config.ssl_client.key, Config.ssl_client.version, Config.ssl_client.cipher, Config.ssl_client.options, Config.ssl_client.flags, Config.ssl_client.cafile, Config.ssl_client.capath, Config.ssl_client.crlfile);
for (p = Config.peers; p != NULL; p = p->next) {
if (p->use_ssl) {
- debug(3, 1) ("Initializing cache_peer %s SSL context\n", p->name);
+ debugs(3, 1, "Initializing cache_peer " << p->name << " SSL context");
p->sslContext = sslCreateClientContext(p->sslcert, p->sslkey, p->sslversion, p->sslcipher, p->ssloptions, p->sslflags, p->sslcafile, p->sslcapath, p->sslcrlfile);
}
}
https_port_list *s;
for (s = Config.Sockaddr.https; s != NULL; s = (https_port_list *) s->http.next) {
- debug(3, 1) ("Initializing https_port %s:%d SSL context\n", inet_ntoa(s->http.s.sin_addr), ntohs(s->http.s.sin_port));
+ debugs(3, 1, "Initializing https_port " <<
+ inet_ntoa(s->http.s.sin_addr) << ":" <<
+ ntohs(s->http.s.sin_port) << " SSL context");
+
s->sslContext = sslCreateServerContext(s->cert, s->key, s->version, s->cipher, s->options, s->sslflags, s->clientca, s->cafile, s->capath, s->crlfile, s->dhfile, s->sslcontext);
}
}
if (0 == d)
(void) 0;
else if ((token = strtok(NULL, w_space)) == NULL)
- debug(3, 0) ("WARNING: No units on '%s', assuming %f %s\n",
- config_input_line, d, units);
+ debugs(3, 0, "WARNING: No units on '" <<
+ config_input_line << "', assuming " <<
+ d << " " << units );
else if ((m = parseTimeUnits(token)) == 0)
self_destruct();
if (!strncasecmp(unit, T_DECADE_STR, strlen(T_DECADE_STR)))
return static_cast<int>(86400 * 365.2522 * 10);
- debug(3, 1) ("parseTimeUnits: unknown time unit '%s'\n", unit);
+ debugs(3, 1, "parseTimeUnits: unknown time unit '" << unit << "'");
return 0;
}
if (0.0 == d)
(void) 0;
else if ((token = strtok(NULL, w_space)) == NULL)
- debug(3, 0) ("WARNING: No units on '%s', assuming %f %s\n",
- config_input_line, d, units);
+ debugs(3, 0, "WARNING: No units on '" <<
+ config_input_line << "', assuming " <<
+ d << " " << units );
else if ((m = parseBytesUnits(token)) == 0)
self_destruct();
if (!strncasecmp(unit, B_GBYTES_STR, strlen(B_GBYTES_STR)))
return 1 << 30;
- debug(3, 1) ("parseBytesUnits: unknown bytes unit '%s'\n", unit);
+ debugs(3, 1, "parseBytesUnits: unknown bytes unit '" << unit << "'");
return 0;
}
wordlist *v;
while (ae != NULL) {
- debug(3, 3) ("dump_acl: %s %s\n", name, ae->name);
+ debugs(3, 3, "dump_acl: " << name << " " << ae->name);
storeAppendPrintf(entry, "%s %s %s ",
name,
ae->name,
v = w = ae->dump();
while (v != NULL) {
- debug(3, 3) ("dump_acl: %s %s %s\n", name, ae->name, v->key);
+ debugs(3, 3, "dump_acl: " << name << " " << ae->name << " " << v->key);
storeAppendPrintf(entry, "%s ", v->key);
v = v->next;
}
char *t = NULL;
if ((t = strtok(NULL, w_space)) == NULL) {
- debug(3, 0) ("%s line %d: %s\n",
- cfg_filename, config_lineno, config_input_line);
- debug(3, 0) ("parse_http_header_access: missing header name.\n");
+ debugs(3, 0, "" << cfg_filename << " line " << config_lineno << ": " << config_input_line);
+ debugs(3, 0, "parse_http_header_access: missing header name.");
return;
}
else if (strcmp(t, "Other") == 0)
id = HDR_OTHER;
else if (id == -1) {
- debug(3, 0) ("%s line %d: %s\n",
- cfg_filename, config_lineno, config_input_line);
- debug(3, 0) ("parse_http_header_access: unknown header name %s.\n", t);
+ debugs(3, 0, "" << cfg_filename << " line " << config_lineno << ": " << config_input_line);
+ debugs(3, 0, "parse_http_header_access: unknown header name '" << t << "'");
return;
}
char *t = NULL;
if ((t = strtok(NULL, w_space)) == NULL) {
- debug(3, 0) ("%s line %d: %s\n",
- cfg_filename, config_lineno, config_input_line);
- debug(3, 0) ("parse_http_header_replace: missing header name.\n");
+ debugs(3, 0, "" << cfg_filename << " line " << config_lineno << ": " << config_input_line);
+ debugs(3, 0, "parse_http_header_replace: missing header name.");
return;
}
else if (strcmp(t, "Other") == 0)
id = HDR_OTHER;
else if (id == -1) {
- debug(3, 0) ("%s line %d: %s\n",
- cfg_filename, config_lineno, config_input_line);
- debug(3, 0) ("parse_http_header_replace: unknown header name %s.\n",
- t);
+ debugs(3, 0, "" << cfg_filename << " line " << config_lineno << ": " << config_input_line);
+ debugs(3, 0, "parse_http_header_replace: unknown header name " << t << ".");
+
return;
}
AuthScheme *theScheme;
if ((theScheme = AuthScheme::Find(type_str)) == NULL) {
- debug(3, 0) ("Parsing Config File: Unknown authentication scheme '%s'.\n", type_str);
+ debugs(3, 0, "Parsing Config File: Unknown authentication scheme '" << type_str << "'.");
return;
}
sd = dynamic_cast<SwapDir *>(swap->swapDirs[i].getRaw());
if (sd->type() != StoreFileSystem::FileSystems().items[fs]->type()) {
- debug(3, 0) ("ERROR: Can't change type of existing cache_dir %s %s to %s. Restart required\n", sd->type(), sd->path, type_str);
+ debugs(3, 0, "ERROR: Can't change type of existing cache_dir " <<
+ sd->type() << " " << sd->path << " to " << type_str << ". Restart required");
return;
}
} else if (strcmp(token, "front-end-https=auto") == 0) {
p->front_end_https = 2;
} else {
- debug(3, 0) ("parse_peer: token='%s'\n", token);
+ debugs(3, 0, "parse_peer: token='" << token << "'");
self_destruct();
}
}
if (strcmp(w->key, u->key))
continue;
- debug(0, 0) ("WARNING: action '%s' (line %d) already has a password\n",
- u->key, config_lineno);
+ debugs(0, 0, "WARNING: action '" << u->key << "' (line " << config_lineno << ") already has a password");
}
}
}
self_destruct();
if ((p = peerFindByName(host)) == NULL) {
- debug(15, 0) ("%s, line %d: No cache_peer '%s'\n",
- cfg_filename, config_lineno, host);
+ debugs(15, 0, "" << cfg_filename << ", line " << config_lineno << ": No cache_peer '" << host << "'");
return;
}
peer *p;
if ((p = peerFindByName(host)) == NULL) {
- debug(15, 0) ("%s, line %d: No cache_peer '%s'\n",
- cfg_filename, config_lineno, host);
+ debugs(15, 0, "" << cfg_filename << ", line " << config_lineno << ": No cache_peer '" << host << "'");
continue;
}
peer *p;
if ((p = peerFindByName(host)) == NULL) {
- debug(15, 0) ("%s, line %d: No cache_peer '%s'\n",
- cfg_filename, config_lineno, host);
+ debugs(15, 0, "" << cfg_filename << ", line " << config_lineno << ": No cache_peer '" << host << "'");
return;
}
#endif
} else
- debug(22, 0) ("redreshAddToList: Unknown option '%s': %s\n",
- pattern, token);
+ debugs(22, 0, "redreshAddToList: Unknown option '" << pattern << "': " << token);
}
if ((errcode = regcomp(&comp, pattern, flags)) != 0) {
char errbuf[256];
regerror(errcode, &comp, errbuf, sizeof errbuf);
- debug(22, 0) ("%s line %d: %s\n",
- cfg_filename, config_lineno, config_input_line);
- debug(22, 0) ("refreshAddToList: Invalid regular expression '%s': %s\n",
- pattern, errbuf);
+ debugs(22, 0, "" << cfg_filename << " line " << config_lineno << ": " << config_input_line);
+ debugs(22, 0, "refreshAddToList: Invalid regular expression '" << pattern << "': " << errbuf);
return;
}
if (!strcasecmp(s, "multicast"))
return PEER_MULTICAST;
- debug(15, 0) ("WARNING: Unknown neighbor type: %s\n", s);
+ debugs(15, 0, "WARNING: Unknown neighbor type: " << s);
return PEER_SIBLING;
}
if ((def = strtok(NULL, "\r\n")) == NULL)
self_destruct();
- debug(3, 2) ("Logformat for '%s' is '%s'\n", name, def);
+ debugs(3, 2, "Logformat for '" << name << "' is '" << def << "'");
nlf = (logformat *)xcalloc(1, sizeof(logformat));
if ((logdef_name = strtok(NULL, w_space)) == NULL)
logdef_name = "auto";
- debug(3, 9) ("Log definition name '%s' file '%s'\n", logdef_name, filename);
+ debugs(3, 9, "Log definition name '" << logdef_name << "' file '" << filename << "'");
cl->filename = xstrdup(filename);
lf = Config.Log.logformats;
while (lf != NULL) {
- debug(3, 9) ("Comparing against '%s'\n", lf->name);
+ debugs(3, 9, "Comparing against '" << lf->name << "'");
if (strcmp(lf->name, logdef_name) == 0)
break;
} else if (strcmp(logdef_name, "common") == 0) {
cl->type = CLF_COMMON;
} else {
- debug(3, 0) ("Log format '%s' is not defined\n", logdef_name);
+ debugs(3, 0, "Log format '" << logdef_name << "' is not defined");
self_destruct();
}
/*
- * $Id: cache_manager.cc,v 1.46 2007/04/21 07:14:13 wessels Exp $
+ * $Id: cache_manager.cc,v 1.47 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 16 Cache Manager Objects
* AUTHOR: Duane Wessels
#endif
} else if ((a = cachemgrFindAction(request)) == NULL) {
- debug(16, 1) ("cachemgrParseUrl: action '%s' not found\n", request);
+ debugs(16, 1, "cachemgrParseUrl: action '" << request << "' not found");
return NULL;
} else {
prot = cachemgrActionProtection(a);
if (!strcmp(prot, "disabled") || !strcmp(prot, "hidden")) {
- debug(16, 1) ("cachemgrParseUrl: action '%s' is %s\n", request, prot);
+ debugs(16, 1, "cachemgrParseUrl: action '" << request << "' is " << prot);
return NULL;
}
}
return;
if (!(passwd_del = strchr(basic_cookie, ':'))) {
- debug(16, 1) ("cachemgrParseHeaders: unknown basic_cookie format '%s'\n", basic_cookie);
+ debugs(16, 1, "cachemgrParseHeaders: unknown basic_cookie format '" << basic_cookie << "'");
return;
}
mgr->passwd = xstrdup(passwd_del + 1);
/* warning: this prints decoded password which maybe not what you want to do @?@ @?@ */
- debug(16, 9) ("cachemgrParseHeaders: got user: '%s' passwd: '%s'\n", mgr->user_name, mgr->passwd);
+ debugs(16, 9, "cachemgrParseHeaders: got user: '" << mgr->user_name << "' passwd: '" << mgr->passwd << "'");
}
/*
cachemgrStateData *mgr = NULL;
ErrorState *err = NULL;
CacheManagerAction *a;
- debug(16, 3) ("objectcacheStart: '%s'\n", entry->url());
+ debugs(16, 3, "objectcacheStart: '" << entry->url() << "'" );
if ((mgr = cachemgrParseUrl(entry->url())) == NULL) {
err = errorCon(ERR_INVALID_URL, HTTP_NOT_FOUND, request);
;
entry->expires = squid_curtime;
- debug(16, 5) ("CACHEMGR: %s requesting '%s'\n",
- fd_table[fd].ipaddr, mgr->action);
+ debugs(16, 5, "CACHEMGR: " << fd_table[fd].ipaddr << " requesting '" << mgr->action << "'");
/* get additional info from request headers */
cachemgrParseHeaders(mgr, request);
/* warn if user specified incorrect password */
if (mgr->passwd)
- debug(16, 1) ("CACHEMGR: %s@%s: incorrect password for '%s'\n",
- mgr->user_name ? mgr->user_name : "<unknown>",
- fd_table[fd].ipaddr, mgr->action);
+ debugs(16, 1, "CACHEMGR: " <<
+ (mgr->user_name ? mgr->user_name : "<unknown>") << "@" <<
+ fd_table[fd].ipaddr << ": incorrect password for '" <<
+ mgr->action << "'" );
else
- debug(16, 1) ("CACHEMGR: %s@%s: password needed for '%s'\n",
- mgr->user_name ? mgr->user_name : "<unknown>",
- fd_table[fd].ipaddr, mgr->action);
+ debugs(16, 1, "CACHEMGR: " <<
+ (mgr->user_name ? mgr->user_name : "<unknown>") << "@" <<
+ fd_table[fd].ipaddr << ": password needed for '" <<
+ mgr->action << "'" );
rep = errorBuildReply(err);
return;
}
- debug(16, 1) ("CACHEMGR: %s@%s requesting '%s'\n",
- mgr->user_name ? mgr->user_name : "<unknown>",
- fd_table[fd].ipaddr, mgr->action);
+ debugs(16, 1, "CACHEMGR: " <<
+ (mgr->user_name ? mgr->user_name : "<unknown>") << "@" <<
+ fd_table[fd].ipaddr << " requesting '" <<
+ mgr->action << "'" );
/* retrieve object requested */
a = cachemgrFindAction(mgr->action);
assert(a != NULL);
static void
cachemgrShutdown(StoreEntry * entryunused)
{
- debug(16, 0) ("Shutdown by command.\n");
+ debugs(16, 0, "Shutdown by command.");
shut_down(0);
}
cachemgrOfflineToggle(StoreEntry * sentry)
{
Config.onoff.offline = !Config.onoff.offline;
- debug(16, 0) ("offline_mode now %s.\n",
- Config.onoff.offline ? "ON" : "OFF");
+ debugs(16, 0, "offline_mode now " << (Config.onoff.offline ? "ON" : "OFF") << ".");
+
storeAppendPrintf(sentry, "offline_mode is now %s\n",
Config.onoff.offline ? "ON" : "OFF");
}
/*
- * $Id: carp.cc,v 1.25 2006/05/29 00:15:01 robertc Exp $
+ * $Id: carp.cc,v 1.26 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 39 Cache Array Routing Protocol
* AUTHOR: Henrik Nordstrom
key = urlCanonical(request);
/* calculate hash key */
- debug(39, 2) ("carpSelectParent: Calculating hash for %s\n", key);
+ debugs(39, 2, "carpSelectParent: Calculating hash for " << key);
for (c = key; *c != 0; c++)
user_hash += ROTATE_LEFT(user_hash, 19) + *c;
combined_hash += combined_hash * 0x62531965;
combined_hash = ROTATE_LEFT(combined_hash, 21);
score = combined_hash * tp->carp.load_multiplier;
- debug(39, 3) ("carpSelectParent: %s combined_hash %u score %.0f\n",
- tp->host, combined_hash, score);
+ debugs(39, 3, "carpSelectParent: " << tp->host << " combined_hash " << combined_hash <<
+ " score " << std::setprecision(0) << score);
if ((score > high_score) && peerHTTPOkay(tp, request)) {
p = tp;
}
if (p)
- debug(39, 2) ("carpSelectParent: selected %s\n", p->host);
+ debugs(39, 2, "carpSelectParent: selected " << p->host);
return p;
}
/*
- * $Id: cbdata.cc,v 1.75 2006/09/03 21:05:20 hno Exp $
+ * $Id: cbdata.cc,v 1.76 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 45 Callback Data Registry
* ORIGINAL AUTHOR: Duane Wessels
c->calls = Stack<CBDataCall *> ();
c->addHistory("Alloc", file, line);
dlinkAdd(c, &c->link, &cbdataEntries);
- debug(45, 3) ("cbdataAlloc: %p %s:%d\n", p, file, line);
+ debugs(45, 3, "cbdataAlloc: " << p << " " << file << ":" << line);
#endif
return p;
#endif
#if CBDATA_DEBUG
- debug(45, 3) ("cbdataFree: %p %s:%d\n", p, file, line);
+ debugs(45, 3, "cbdataFree: " << p << " " << file << ":" << line);
#else
- debug(45, 9) ("cbdataFree: %p\n", p);
+ debugs(45, 9, "cbdataFree: " << p);
#endif
c->check(__LINE__);
#endif
if (c->locks) {
- debug(45, 9) ("cbdataFree: %p has %d locks, not freeing\n",
- p, c->locks);
+ debugs(45, 9, "cbdataFree: " << p << " has " << c->locks << " locks, not freeing");
return NULL;
}
cbdataCount--;
- debug(45, 9) ("cbdataFree: Freeing %p\n", p);
+ debugs(45, 9, "cbdataFree: Freeing " << p);
#if CBDATA_DEBUG
dlinkDelete(&c->link, &cbdataEntries);
#if CBDATA_DEBUG
- debug(45, 3) ("cbdataLock: %p=%d %s:%d\n", p, c ? c->locks + 1 : -1, file, line);
+ debugs(45, 3, "cbdataLock: " << p << "=" << (c ? c->locks + 1 : -1) << " " << file << ":" << line);
c->addHistory("Reference", file, line);
#else
- debug(45, 9) ("cbdataLock: %p=%d\n", p, c ? c->locks + 1 : -1);
+ debugs(45, 9, "cbdataLock: " << p << "=" << (c ? c->locks + 1 : -1));
#endif
#if CBDATA_DEBUG
- debug(45, 3) ("cbdataUnlock: %p=%d %s:%d\n", p, c ? c->locks - 1 : -1, file, line);
+ debugs(45, 3, "cbdataUnlock: " << p << "=" << (c ? c->locks - 1 : -1) << " " << file << ":" << line);
c->addHistory("Dereference", file, line);
#else
- debug(45, 9) ("cbdataUnlock: %p=%d\n", p, c ? c->locks - 1 : -1);
+ debugs(45, 9, "cbdataUnlock: " << p << "=" << (c ? c->locks - 1 : -1));
#endif
cbdataCount--;
- debug(45, 9) ("cbdataUnlock: Freeing %p\n", p);
+ debugs(45, 9, "cbdataUnlock: Freeing " << p);
#if CBDATA_DEBUG
if (p == NULL)
return 1; /* A NULL pointer cannot become invalid */
- debug(45, 9) ("cbdataReferenceValid: %p\n", p);
+ debugs(45, 9, "cbdataReferenceValid: " << p);
#if HASHED_CBDATA
c = (cbdata *) hash_lookup(cbdata_htable, p);
/*
- * $Id: cf_gen.cc,v 1.58 2006/05/08 23:38:33 robertc Exp $
+ * $Id: cf_gen.cc,v 1.59 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: none Generate squid.conf.default and cf_parser.h
* AUTHOR: Max Okumoto
"parse_line(char *buff)\n"
"{\n"
"\tchar\t*token;\n"
- "\tdebug(0,10)(\"parse_line: %%s\\n\", buff);\n"
+ "\tdebugs(0, 10, \"parse_line: \" << buff << \"\\n\" );\n"
"\tif ((token = strtok(buff, w_space)) == NULL) \n"
"\t\treturn 1;\t/* ignore empty lines */\n"
);
/*
- * $Id: clientStream.cc,v 1.12 2005/09/09 17:31:33 wessels Exp $
+ * $Id: clientStream.cc,v 1.13 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 87 Client-side Stream routines.
* AUTHOR: Robert Collins
assert(list->head);
clientStreamNode *temp = clientStreamNew(func, callback, detach, status, data);
temp->head = list;
- debug(87, 3)
- ("clientStreamInsertHead: Inserted node %p with data %p after head\n",
- temp, data.getRaw());
+ debugs(87, 3, "clientStreamInsertHead: Inserted node " << temp <<
+ " with data " << data.getRaw() << " after head");
if (list->head->next)
temp->readBuffer = ((clientStreamNode *)list->head->next->data)->readBuffer;
assert(thisObject && http && thisObject->node.next);
next = thisObject->next();
- debug(87,
- 3) ("clientStreamCallback: Calling %p with cbdata %p from node %p\n",
- next->callback, next->data.getRaw(), thisObject);
+ debugs(87, 3, "clientStreamCallback: Calling " << next->callback << " with cbdata " <<
+ next->data.getRaw() << " from node " << thisObject);
next->callback(next, http, rep, replyBuffer);
}
assert(thisObject && http && thisObject->prev());
prev = thisObject->prev();
- debug(87, 3) ("clientStreamRead: Calling %p with cbdata %p from node %p\n",
- prev->readfunc, prev->data.getRaw(), thisObject);
+ debugs(87, 3, "clientStreamRead: Calling " << prev->readfunc <<
+ " with cbdata " << prev->data.getRaw() << " from node " << thisObject);
thisObject->readBuffer = readBuffer;
prev->readfunc(prev, http);
}
clientStreamNode *temp = thisObject;
assert(thisObject->node.next == NULL);
- debug(87, 3) ("clientStreamDetach: Detaching node %p\n", thisObject);
+ debugs(87, 3, "clientStreamDetach: Detaching node " << thisObject);
/* And clean up thisObject node */
/* ESI TODO: push refcount class through to head */
clientStreamNode *prev = NULL;
*/
if (prev) {
- debug(87, 3) ("clientStreamDetach: Calling %p with cbdata %p\n",
- prev->detach, prev->data.getRaw());
+ debugs(87, 3, "clientStreamDetach: Calling " << prev->detach << " with cbdata " << prev->data.getRaw());
if (cbdataReferenceValid(prev))
prev->detach(prev, http);
assert(thisObject != NULL);
assert(http != NULL);
list = thisObject->head;
- debug(87, 3) ("clientStreamAbort: Aborting stream with tail %p\n",
- list->tail);
+ debugs(87, 3, "clientStreamAbort: Aborting stream with tail " << list->tail);
if (list->tail) {
clientStreamDetach((clientStreamNode *)list->tail->data, http);
{
clientStreamNode *thisObject = (clientStreamNode *)foo;
- debug(87, 3) ("Freeing clientStreamNode %p\n", thisObject);
+ debugs(87, 3, "Freeing clientStreamNode " << thisObject);
thisObject->removeFromStream();
thisObject->data = NULL;
/*
- * $Id: client_db.cc,v 1.67 2006/08/07 02:28:22 robertc Exp $
+ * $Id: client_db.cc,v 1.68 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 0 Client Database
* AUTHOR: Duane Wessels
if (p < 95.0)
return 0;
- debug(1, 0) ("WARNING: Probable misconfigured neighbor at %s\n", key);
+ debugs(1, 0, "WARNING: Probable misconfigured neighbor at " << key);
- debug(1, 0) ("WARNING: %d of the last %d ICP replies are DENIED\n", ND, NR);
+ debugs(1, 0, "WARNING: " << ND << " of the last " << NR <<
+ " ICP replies are DENIED");
- debug(1, 0) ("WARNING: No replies will be sent for the next %d seconds\n",
- CUTOFF_SECONDS);
+ debugs(1, 0, "WARNING: No replies will be sent for the next " <<
+ CUTOFF_SECONDS << " seconds");
c->cutoff.time = squid_curtime;
eventAdd("client_db garbage collector", clientdbScheduledGC, NULL, 6 * 3600, 0);
}
- debug(49, 2) ("clientdbGC: Removed %d entries\n", cleanup_removed);
+ debugs(49, 2, "clientdbGC: Removed " << cleanup_removed << " entries");
}
}
int aggr = 0;
log_type l;
*ErrP = SNMP_ERR_NOERROR;
- debug(49, 6) ("snmp_meshCtblFn: Current : \n");
+ debugs(49, 6, "snmp_meshCtblFn: Current : ");
snmpDebugOid(6, Var->name, Var->name_length);
snprintf(key, sizeof(key), "%d.%d.%d.%d", Var->name[LEN_SQ_NET + 3], Var->name[LEN_SQ_NET + 4],
Var->name[LEN_SQ_NET + 5], Var->name[LEN_SQ_NET + 6]);
- debug(49, 5) ("snmp_meshCtblFn: [%s] requested!\n", key);
+ debugs(49, 5, "snmp_meshCtblFn: [" << key << "] requested!");
c = (ClientInfo *) hash_lookup(client_table, key);
if (c == NULL) {
- debug(49, 5) ("snmp_meshCtblFn: not found.\n");
+ debugs(49, 5, "snmp_meshCtblFn: not found.");
*ErrP = SNMP_ERR_NOSUCHNAME;
return NULL;
}
default:
*ErrP = SNMP_ERR_NOSUCHNAME;
- debug(49, 5) ("snmp_meshCtblFn: illegal column.\n");
+ debugs(49, 5, "snmp_meshCtblFn: illegal column.");
break;
}
/*
- * $Id: client_side.cc,v 1.750 2007/04/20 22:17:06 wessels Exp $
+ * $Id: client_side.cc,v 1.751 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 33 Client-side Routines
* AUTHOR: Duane Wessels
reading(true);
- debug(33, 4) ("clientReadSomeData: FD %d: reading request...\n", fd);
+ debugs(33, 4, "clientReadSomeData: FD " << fd << ": reading request...");
makeSpaceAvailable();
if (out.size || logType) {
al.icp.opcode = ICP_INVALID;
al.url = log_uri;
- debug(33, 9) ("clientLogRequest: al.url='%s'\n", al.url);
+ debugs(33, 9, "clientLogRequest: al.url='" << al.url << "'");
if (al.reply) {
al.http.code = al.reply->sline.status;
al.http.content_type = loggingEntry()->mem_obj->getReply()->content_type.buf();
}
- debug(33, 9) ("clientLogRequest: http.code='%d'\n", al.http.code);
+ debugs(33, 9, "clientLogRequest: http.code='" << al.http.code << "'");
if (loggingEntry() && loggingEntry()->mem_obj)
al.cache.objectSize = loggingEntry()->contentLen();
void
ConnStateData::close()
{
- debug(33, 3) ("ConnStateData::close: FD %d\n", fd);
+ debugs(33, 3, "ConnStateData::close: FD " << fd);
openReference = NULL;
clientdbEstablished(peer.sin_addr, -1); /* decrement */
assert(areAllContextsForThisConnection());
freeAllContexts();
if (auth_user_request != NULL) {
- debug(33,4)("ConnStateData::close: freeing auth_user_request '%p' (this is '%p')\n",
- auth_user_request,this);
+ debugs(33, 4, "ConnStateData::close: freeing auth_user_request '" << auth_user_request << "' (this is '" << this << "')");
auth_user_request->onConnectionClose(this);
}
}
ConnStateData::~ConnStateData()
{
assert(this != NULL);
- debug(33, 3) ("ConnStateData::~ConnStateData: FD %d\n", fd);
+ debugs(33, 3, "ConnStateData::~ConnStateData: FD " << fd);
if (isOpen())
close();
HttpRequest *request = http->request;
const HttpHeader *req_hdr = &request->header;
- debug(33, 3) ("clientSetKeepaliveFlag: http_ver = %d.%d\n",
- request->http_ver.major, request->http_ver.minor);
- debug(33, 3) ("clientSetKeepaliveFlag: method = %s\n",
- RequestMethodStr[request->method]);
+ debugs(33, 3, "clientSetKeepaliveFlag: http_ver = " <<
+ request->http_ver.major << "." << request->http_ver.minor);
+ debugs(33, 3, "clientSetKeepaliveFlag: method = " <<
+ RequestMethodStr[request->method]);
HttpVersion http_ver(1,0);
/* we are HTTP/1.0, no matter what the client requests... */
void
ClientSocketContext::deferRecipientForLater(clientStreamNode * node, HttpReply * rep, StoreIOBuffer recievedData)
{
- debug(33, 2) ("clientSocketRecipient: Deferring request %s\n", http->uri);
+ debugs(33, 2, "clientSocketRecipient: Deferring request " << http->uri);
assert(flags.deferred == 0);
flags.deferred = 1;
deferredparams.node = node;
clientPackTermBound(String boundary, MemBuf * mb)
{
mb->Printf("\r\n--%s--\r\n", boundary.buf());
- debug(33, 6) ("clientPackTermBound: buf offset: %ld\n", (long int) mb->size);
+ debugs(33, 6, "clientPackTermBound: buf offset: " << (long int) mb->size);
}
/* appends a "part" HTTP header (as in a multi-part/range reply) to the buffer */
assert(spec);
/* put boundary */
- debug(33, 5) ("clientPackRangeHdr: appending boundary: %s\n", boundary.buf());
+ debugs(33, 5, "clientPackRangeHdr: appending boundary: " <<
+ boundary.buf());
/* rfc2046 requires to _prepend_ boundary with <crlf>! */
mb->Printf("\r\n--%s\r\n", boundary.buf());
/*
* append content
*/
- debug(33, 3) ("clientPackRange: appending %ld bytes\n", (long int) copy_sz);
+ debugs(33, 3, "clientPackRange: appending " << (long int) copy_sz << " bytes");
noteSentBodyBytes (copy_sz);
assert(available.size() >= 0 && i->debt() >= 0 || i->debt() == -1);
if (!canPackMoreRanges()) {
- debug(33, 3) ("clientPackRange: Returning because !canPackMoreRanges.\n");
+ debugs(33, 3, "clientPackRange: Returning because !canPackMoreRanges.");
if (i->debt() == 0)
/* put terminating boundary for multiparts */
/* account for range content */
clen += (*pos)->length;
- debug(33, 6) ("clientMRangeCLen: (clen += %ld + %ld) == %d\n",
- (long int) mb.size, (long int) (*pos)->length, clen);
+ debugs(33, 6, "clientMRangeCLen: (clen += " << (long int) mb.size << " + " << (long int) (*pos)->length << ") == " << clen);
++pos;
}
/* got an ETag? */
if (spec.tag.str) {
ETag rep_tag = rep->header.getETag(HDR_ETAG);
- debug(33, 3) ("clientIfRangeMatch: ETags: %s and %s\n",
- spec.tag.str, rep_tag.str ? rep_tag.str : "<none>");
+ debugs(33, 3, "clientIfRangeMatch: ETags: " << spec.tag.str << " and " <<
+ (rep_tag.str ? rep_tag.str : "<none>"));
if (!rep_tag.str)
return 0; /* entity has no etag to compare with! */
if (spec.tag.weak || rep_tag.weak) {
- debug(33, 1) ("clientIfRangeMatch: Weak ETags are not allowed in If-Range: %s ? %s\n",
- spec.tag.str, rep_tag.str);
+ debugs(33, 1, "clientIfRangeMatch: Weak ETags are not allowed in If-Range: " << spec.tag.str << " ? " << rep_tag.str);
return 0; /* must use strong validator for sub-range requests */
}
* offset data, but we won't be requesting it.
* So, we can either re-request, or generate an error
*/
- debug(33, 3) ("clientBuildRangeHeader: will not do ranges: %s.\n", range_err);
+ debugs(33, 3, "clientBuildRangeHeader: will not do ranges: " << range_err << ".");
delete http->request->range;
http->request->range = NULL;
} else {
const int spec_count = http->request->range->specs.count;
int actual_clen = -1;
- debug(33, 3) ("clientBuildRangeHeader: range spec count: %d virgin clen: %d\n",
- spec_count, rep->content_length);
+ debugs(33, 3, "clientBuildRangeHeader: range spec count: " << spec_count << " virgin clen: " << rep->content_length);
assert(spec_count > 0);
/* ETags should not be returned with Partial Content replies? */
hdr->delById(HDR_ETAG);
hdr->putInt(HDR_CONTENT_LENGTH, actual_clen);
- debug(33, 3) ("clientBuildRangeHeader: actual content length: %d\n", actual_clen);
+ debugs(33, 3, "clientBuildRangeHeader: actual content length: " << actual_clen);
/* And start the range iter off */
http->range_iter.updateSpec();
void
ConnStateData::readNextRequest()
{
- debug(33, 5) ("ConnStateData::readNextRequest: FD %d reading next req\n", fd);
+ debugs(33, 5, "ConnStateData::readNextRequest: FD " << fd << " reading next req");
+
fd_note(fd, "Waiting for next request");
/*
* Set the timeout BEFORE calling clientReadRequest().
void
ClientSocketContextPushDeferredIfNeeded(ClientSocketContext::Pointer deferredRequest, ConnStateData::Pointer & conn)
{
- debug(33, 2) ("ClientSocketContextPushDeferredIfNeeded: FD %d Sending next\n",
- conn->fd);
+ debugs(33, 2, "ClientSocketContextPushDeferredIfNeeded: FD " << conn->fd << " Sending next");
+
/* If the client stream is waiting on a socket write to occur, then */
if (deferredRequest->flags.deferred) {
ConnStateData::Pointer conn = http->getConn();
bool do_next_read = false;
- debug(33, 3) ("ClientSocketContext::keepaliveNextRequest: FD %d\n", conn->fd);
+ debugs(33, 3, "ClientSocketContext::keepaliveNextRequest: FD " << conn->fd);
connIsFinished();
/*
*/
if (clientParseRequest(conn, do_next_read)) {
- debug(33, 3) ("clientSocketContext::keepaliveNextRequest: FD %d: parsed next request from buffer\n", conn->fd);
+ debugs(33, 3, "clientSocketContext::keepaliveNextRequest: FD " << conn->fd << ": parsed next request from buffer");
}
/*
* the keepalive "Waiting for next request" state.
*/
if (commIsHalfClosed(conn->fd) && (conn->getConcurrentRequestCount() == 0)) {
- debug(33, 3) ("ClientSocketContext::keepaliveNextRequest: half-closed client with no pending requests, closing\n");
+ debugs(33, 3, "ClientSocketContext::keepaliveNextRequest: half-closed client with no pending requests, closing");
comm_close(conn->fd);
return;
}
*/
if ((deferredRequest = conn->getCurrentContext()).getRaw()) {
- debug(33, 3) ("ClientSocketContext:: FD %d: calling PushDeferredIfNeeded\n", conn->fd);
+ debugs(33, 3, "ClientSocketContext:: FD " << conn->fd << ": calling PushDeferredIfNeeded");
ClientSocketContextPushDeferredIfNeeded(deferredRequest, conn);
} else {
- debug(33, 3) ("ClientSocketContext:: FD %d: calling conn->readNextRequest()\n", conn->fd);
+ debugs(33, 3, "ClientSocketContext:: FD " << conn->fd << ": calling conn->readNextRequest()");
conn->readNextRequest();
}
}
/* first update "i" if needed */
if (!http->range_iter.debt()) {
- debug (33,5)("ClientSocketContext::canPackMoreRanges: At end of current range spec for FD %d\n",fd());
+ debugs(33, 5, "ClientSocketContext::canPackMoreRanges: At end of current range spec for FD " <<
+ fd());
if (http->range_iter.pos.incrementable())
++http->range_iter.pos;
assert(!http->range_iter.debt() == !http->range_iter.currentSpec());
/* paranoid sync condition */
/* continue condition: need_more_data */
- debug (33,5)("ClientSocketContext::canPackMoreRanges: returning %d\n", http->range_iter.currentSpec() ? true : false);
+ debugs(33, 5, "ClientSocketContext::canPackMoreRanges: returning " << (http->range_iter.currentSpec() ? true : false));
return http->range_iter.currentSpec() ? true : false;
}
{
if (http->request->range) {
/* offset in range specs does not count the prefix of an http msg */
- debug (33,5) ("ClientSocketContext::getNextRangeOffset: http offset %lu\n", (long unsigned)http->out.offset);
+ debugs(33, 5, "ClientSocketContext::getNextRangeOffset: http offset " << (long unsigned)http->out.offset);
/* check: reply was parsed and range iterator was initialized */
assert(http->range_iter.valid);
/* filter out data according to range specs */
off_t start; /* offset of still missing data */
assert(http->range_iter.currentSpec());
start = http->range_iter.currentSpec()->offset + http->range_iter.currentSpec()->length - http->range_iter.debt();
- debug(33, 3) ("clientPackMoreRanges: in: offset: %ld\n",
- (long int) http->out.offset);
- debug(33, 3) ("clientPackMoreRanges: out: start: %ld spec[%ld]: [%ld, %ld), len: %ld debt: %ld\n",
- (long int) start, (long int) (http->range_iter.pos - http->request->range->begin()), (long int) http->range_iter.currentSpec()->offset, (long int) (http->range_iter.currentSpec()->offset + http->range_iter.currentSpec()->length), (long int) http->range_iter.currentSpec()->length, (long int) http->range_iter.debt());
+ debugs(33, 3, "clientPackMoreRanges: in: offset: " <<
+ (long int) http->out.offset);
+ debugs(33, 3, "clientPackMoreRanges: out: start: " <<
+ (long int) start << " spec[" <<
+ (long int) (http->range_iter.pos - http->request->range->begin()) <<
+ "]: [" << (long int) http->range_iter.currentSpec()->offset <<
+ ", " <<
+ (long int) (http->range_iter.currentSpec()->offset + http->range_iter.currentSpec()->length) <<
+ "), len: " <<
+ (long int) http->range_iter.currentSpec()->length <<
+ " debt: " << (long int) http->range_iter.debt());
if (http->range_iter.currentSpec()->length != -1)
assert(http->out.offset <= start); /* we did not miss it */
void
ClientSocketContext::pullData()
{
- debug (33,5)("ClientSocketContext::pullData: FD %d attempting to pull upstream data\n", fd());
+ debugs(33, 5, "ClientSocketContext::pullData: FD " << fd() << " attempting to pull upstream data");
+
/* More data will be coming from the stream. */
StoreIOBuffer readBuffer;
/* XXX: Next requested byte in the range sequence */
/* filter out data according to range specs */
if (!canPackMoreRanges()) {
- debug (33,5)("ClientSocketContext::socketState: Range request has hit end of returnable range sequence on FD %d\n", fd());
+ debugs(33, 5, "ClientSocketContext::socketState: Range request has hit end of returnable range sequence on FD " <<
+ fd());
if (http->request->flags.proxy_keepalive)
return STREAM_COMPLETE;
break;
case STREAM_COMPLETE:
- debug(33, 5) ("clientWriteComplete: FD %d Keeping Alive\n", fd);
+ debugs(33, 5, "clientWriteComplete: FD " << fd << " Keeping Alive");
keepaliveNextRequest();
return;
http->uri = (char *)xcalloc(url_sz, 1);
snprintf(http->uri, url_sz, "%s://%s%s",
conn->port->protocol, host, url);
- debug(33, 5) ("ACCEL VHOST REWRITE: '%s'\n", http->uri);
+ debugs(33, 5, "ACCEL VHOST REWRITE: '" << http->uri << "'");
} else if (conn->port->defaultsite) {
int url_sz = strlen(url) + 32 + Config.appendDomainLen +
strlen(conn->port->defaultsite);
http->uri = (char *)xcalloc(url_sz, 1);
snprintf(http->uri, url_sz, "%s://%s%s",
conn->port->protocol, conn->port->defaultsite, url);
- debug(33, 5) ("ACCEL DEFAULTSITE REWRITE: '%s'\n", http->uri);
+ debugs(33, 5, "ACCEL DEFAULTSITE REWRITE: '" << http->uri <<"'");
} else if (vport == -1) {
/* Put the local socket IP address as the hostname. */
int url_sz = strlen(url) + 32 + Config.appendDomainLen;
http->getConn()->port->protocol,
inet_ntoa(http->getConn()->me.sin_addr),
ntohs(http->getConn()->me.sin_port), url);
- debug(33, 5) ("ACCEL VPORT REWRITE: '%s'\n", http->uri);
+ debugs(33, 5, "ACCEL VPORT REWRITE: '" << http->uri << "'");
} else if (vport > 0) {
/* Put the local socket IP address as the hostname, but static port */
int url_sz = strlen(url) + 32 + Config.appendDomainLen;
http->getConn()->port->protocol,
inet_ntoa(http->getConn()->me.sin_addr),
vport, url);
- debug(33, 5) ("ACCEL VPORT REWRITE: '%s'\n", http->uri);
+ debugs(33, 5, "ACCEL VPORT REWRITE: '" << http->uri << "'");
}
}
http->uri = (char *)xcalloc(url_sz, 1);
snprintf(http->uri, url_sz, "%s://%s%s",
conn->port->protocol, host, url);
- debug(33, 5) ("TRANSPARENT HOST REWRITE: '%s'\n", http->uri);
+ debugs(33, 5, "TRANSPARENT HOST REWRITE: '" << http->uri <<"'");
} else {
/* Put the local socket IP address as the hostname. */
int url_sz = strlen(url) + 32 + Config.appendDomainLen;
http->getConn()->port->protocol,
inet_ntoa(http->getConn()->me.sin_addr),
ntohs(http->getConn()->me.sin_port), url);
- debug(33, 5) ("TRANSPARENT REWRITE: '%s'\n", http->uri);
+ debugs(33, 5, "TRANSPARENT REWRITE: '" << http->uri << "'");
}
}
r = HttpParserParseReqLine(hp);
if (r == 0) {
- debug(33, 5) ("Incomplete request, waiting for end of request line\n");
+ debugs(33, 5, "Incomplete request, waiting for end of request line");
return NULL;
}
/* This call scans the entire request, not just the headers */
if (hp->v_maj > 0) {
if ((req_sz = headersEnd(hp->buf, hp->bufsiz)) == 0) {
- debug(33, 5) ("Incomplete request, waiting for end of headers\n");
+ debugs(33, 5, "Incomplete request, waiting for end of headers");
return NULL;
}
} else {
- debug(33, 3) ("parseHttpRequest: Missing HTTP identifier\n");
+ debugs(33, 3, "parseHttpRequest: Missing HTTP identifier");
req_sz = HttpParserReqSz(hp);
}
/* Enforce max_request_size */
if (req_sz >= Config.maxRequestHeaderSize) {
- debug(33, 5) ("parseHttpRequest: Too large request\n");
+ debugs(33, 5, "parseHttpRequest: Too large request");
return parseHttpRequestAbort(conn, "error:request-too-large");
}
if (*method_p == METHOD_NONE) {
/* XXX need a way to say "this many character length string" */
- debug(33, 1) ("clientParseRequestMethod: Unsupported method in request '%s'\n", hp->buf);
+ debugs(33, 1, "clientParseRequestMethod: Unsupported method in request '" << hp->buf << "'");
+
/* XXX where's the method set for this error? */
return parseHttpRequestAbort(conn, "error:unsupported-request-method");
}
/* XXX this code should be modified to take a const char * later! */
req_hdr = (char *) hp->buf + hp->req_end + 1;
- debug(33, 3) ("parseHttpRequest: req_hdr = {%s}\n", req_hdr);
+ debugs(33, 3, "parseHttpRequest: req_hdr = {" << req_hdr << "}");
end = (char *) hp->buf + hp->hdr_end;
- debug(33, 3) ("parseHttpRequest: end = {%s}\n", end);
+ debugs(33, 3, "parseHttpRequest: end = {" << end << "}");
if (strstr(req_hdr, "\r\r\n")) {
- debug(33, 1) ("WARNING: suspicious HTTP request contains double CR\n");
+ debugs(33, 1, "WARNING: suspicious HTTP request contains double CR");
xfree(url);
return parseHttpRequestAbort(conn, "error:double-CR");
}
- debug(33, 3) ("parseHttpRequest: prefix_sz = %d, req_line_sz = %d\n",
- (int) HttpParserRequestLen(hp), HttpParserReqSz(hp));
+ debugs(33, 3, "parseHttpRequest: prefix_sz = " <<
+ (int) HttpParserRequestLen(hp) << ", req_line_sz = " <<
+ HttpParserReqSz(hp));
/* Ok, all headers are received */
http = new ClientHttpRequest(conn);
clientReplyStatus, newServer, clientSocketRecipient,
clientSocketDetach, newClient, tempBuffer);
- debug(33, 5) ("parseHttpRequest: Request Header is\n%s\n",
- (hp->buf) + hp->hdr_start);
+ debugs(33, 5, "parseHttpRequest: Request Header is\n" <<(hp->buf) + hp->hdr_start);
#if THIS_VIOLATES_HTTP_SPECS_ON_URL_TRANSFORMATION
}
setLogUri(http, http->uri);
- debug(33, 5) ("parseHttpRequest: Complete request received\n");
+ debugs(33, 5, "parseHttpRequest: Complete request received");
result->flags.parsed_ok = 1;
xfree(url);
return result;
{
if (getAvailableBufferLength() < 2) {
in.buf = (char *)memReallocBuf(in.buf, in.allocatedSize * 2, &in.allocatedSize);
- debug(33, 2) ("growing request buffer: notYetUsed=%ld size=%ld\n",
- (long) in.notYetUsed, (long) in.allocatedSize);
+ debugs(33, 2, "growing request buffer: notYetUsed=" << (long) in.notYetUsed << " size=" << (long) in.allocatedSize);
}
}
connReadWasError(ConnStateData::Pointer & conn, comm_err_t flag, int size, int xerrno)
{
if (flag != COMM_OK) {
- debug(33, 2) ("connReadWasError: FD %d: got flag %d\n", conn->fd, flag);
+ debugs(33, 2, "connReadWasError: FD " << conn->fd << ": got flag " << flag);
return 1;
}
if (size < 0) {
if (!ignoreErrno(xerrno)) {
- debug(33, 2) ("connReadWasError: FD %d: %s\n", conn->fd, xstrerr(xerrno));
+ debugs(33, 2, "connReadWasError: FD " << conn->fd << ": " << xstrerr(xerrno));
return 1;
} else if (conn->in.notYetUsed == 0) {
- debug(33, 2) ("connReadWasError: FD %d: no data to process (%s)\n",
- conn->fd, xstrerr(xerrno));
+ debugs(33, 2, "connReadWasError: FD " << conn->fd << ": no data to process (" << xstrerr(xerrno) << ")");
}
}
if (size == 0) {
if (conn->getConcurrentRequestCount() == 0 && conn->in.notYetUsed == 0) {
/* no current or pending requests */
- debug(33, 4) ("connFinishedWithConn: FD %d closed\n", conn->fd);
+ debugs(33, 4, "connFinishedWithConn: FD " << conn->fd << " closed");
return 1;
} else if (!Config.onoff.half_closed_clients) {
/* admin doesn't want to support half-closed client sockets */
- debug(33, 3) ("connFinishedWithConn: FD %d aborted (half_closed_clients disabled)\n", conn->fd);
+ debugs(33, 3, "connFinishedWithConn: FD " << conn->fd << " aborted (half_closed_clients disabled)");
return 1;
}
}
ClientSocketContext *context = parseHttpRequestAbort(conn, "error:request-too-large");
clientStreamNode *node = context->getClientReplyContext();
assert(!connKeepReadingIncompleteRequest(conn));
- debug(33, 1) ("Request header is too large (%u bytes)\n",
- (unsigned) conn->in.notYetUsed);
- debug(33, 1) ("Config 'request_header_max_size'= %ld bytes.\n",
- (long int) Config.maxRequestHeaderSize);
+ debugs(33, 1, "Request header is too large (" << (unsigned) conn->in.notYetUsed << " bytes)");
+ debugs(33, 1, "Config 'request_header_max_size'= " << (long int) Config.maxRequestHeaderSize << " bytes.");
clientReplyContext *repContext = dynamic_cast<clientReplyContext *>(node->data.getRaw());
assert (repContext);
repContext->setReplyToError(ERR_TOO_BIG,
if (fd_table[fd].flags.socket_eof) {
if ((ssize_t) conn->in.notYetUsed < conn->bodySizeLeft()) {
/* Partial request received. Abort client connection! */
- debug(33, 3) ("clientAfterReadingRequests: FD %d aborted, partial request\n", fd);
+ debugs(33, 3, "clientAfterReadingRequests: FD " << fd << " aborted, partial request");
comm_close(fd);
return;
}
if (context->flags.parsed_ok == 0) {
clientStreamNode *node = context->getClientReplyContext();
- debug(33, 1) ("clientProcessRequest: Invalid Request\n");
+ debugs(33, 1, "clientProcessRequest: Invalid Request");
clientReplyContext *repContext = dynamic_cast<clientReplyContext *>(node->data.getRaw());
assert (repContext);
repContext->setReplyToError(ERR_INVALID_REQ, HTTP_BAD_REQUEST, method, NULL,
if ((request = HttpRequest::CreateFromUrlAndMethod(http->uri, method)) == NULL) {
clientStreamNode *node = context->getClientReplyContext();
- debug(33, 5) ("Invalid URL: %s\n", http->uri);
+ debugs(33, 5, "Invalid URL: " << http->uri);
clientReplyContext *repContext = dynamic_cast<clientReplyContext *>(node->data.getRaw());
assert (repContext);
repContext->setReplyToError(
/* XXX should actually know the damned buffer size here */
if (!request->parseHeader(HttpParserHdrBuf(hp), HttpParserHdrSz(hp))) {
clientStreamNode *node = context->getClientReplyContext();
- debug(33, 5) ("Failed to parse request headers:\n%s\n", HttpParserHdrBuf(hp));
+ debugs(33, 5, "Failed to parse request headers:\n" << HttpParserHdrBuf(hp));
clientReplyContext *repContext = dynamic_cast<clientReplyContext *>(node->data.getRaw());
assert (repContext);
repContext->setReplyToError(
int result = conn->getConcurrentRequestCount() < (Config.onoff.pipeline_prefetch ? 2 : 1);
if (!result) {
- debug(33, 3) ("connOkToAddRequest: FD %d max concurrent requests reached\n",
- conn->fd);
- debug(33, 5) ("connOkToAddRequest: FD %d defering new request until one is done\n",
- conn->fd);
+ debugs(33, 3, "connOkToAddRequest: FD " << conn->fd <<
+ " max concurrent requests reached");
+ debugs(33, 5, "connOkToAddRequest: FD " << conn->fd <<
+ " defering new request until one is done");
}
return result;
HttpVersion http_ver;
HttpParser hp;
- debug(33, 5) ("clientParseRequest: FD %d: attempting to parse\n", conn->fd);
+ debugs(33, 5, "clientParseRequest: FD " << conn->fd << ": attempting to parse");
while (conn->in.notYetUsed > 0 && conn->bodySizeLeft() == 0) {
connStripBufferWhitespace (conn);
/* status -1 or 1 */
if (context) {
- debug(33, 5) ("clientParseRequest: FD %d: parsed a request\n", conn->fd);
+ debugs(33, 5, "clientParseRequest: FD " << conn->fd << ": parsed a request");
commSetTimeout(conn->fd, Config.Timeout.lifetime, clientLifetimeTimeout,
context->http);
parsed_req = true;
if (context->mayUseConnection()) {
- debug (33, 3) ("clientParseRequest: Not reading, as this request may need the connection\n");
+ debugs(33, 3, "clientParseRequest: Not reading, as this request may need the connection");
do_next_read = 0;
break;
}
conn->handleReadData(buf, size);
} else if (size == 0) {
- debug(33, 5) ("clientReadRequest: FD %d closed?\n", fd);
+ debugs(33, 5, "clientReadRequest: FD " << fd << " closed?");
if (connFinishedWithConn(conn, size)) {
comm_close(fd);
*/
if (conn->getConcurrentRequestCount() == 0 && commIsHalfClosed(fd)) {
- debug(33, 5) ("clientReadRequest: FD %d: half-closed connection, no completed request parsed, connection closing.\n", fd);
+ debugs(33, 5, "clientReadRequest: FD " << fd << ": half-closed connection, no completed request parsed, connection closing.");
comm_close(fd);
}
{
#if THIS_CONFUSES_PERSISTENT_CONNECTION_AWARE_BROWSERS_AND_USERS
ConnStateData *conn = data;
- debug(33, 3) ("requestTimeout: FD %d: lifetime is expired.\n", fd);
+ debugs(33, 3, "requestTimeout: FD " << fd << ": lifetime is expired.");
if (COMMIO_FD_WRITECB(fd)->active) {
/* FIXME: If this code is reinstated, check the conn counters,
* the open has already been completed on another
* connection)
*/
- debug(33, 3) ("requestTimeout: FD %d: lifetime is expired.\n", fd);
+ debugs(33, 3, "requestTimeout: FD " << fd << ": lifetime is expired.");
comm_close(fd);
clientLifetimeTimeout(int fd, void *data)
{
ClientHttpRequest *http = (ClientHttpRequest *)data;
- debug(33,
- 1) ("WARNING: Closing client %s connection due to lifetime timeout\n",
- inet_ntoa(http->getConn()->peer.sin_addr));
- debug(33, 1) ("\t%s\n", http->uri);
+ debugs(33, 1, "WARNING: Closing client " << inet_ntoa(http->getConn()->peer.sin_addr) <<
+ " connection due to lifetime timeout");
+ debugs(33, 1, "\t" << http->uri);
comm_close(fd);
}
static int reported = 0;
if (!reported) {
- debug(33, 1) ("Notice: httpd_accel_no_pmtu_disc not supported on your platform\n");
+ debugs(33, 1, "Notice: httpd_accel_no_pmtu_disc not supported on your platform");
reported = 1;
}
comm_accept(sock, httpAccept, data);
if (flag != COMM_OK) {
- debug(33, 1) ("httpAccept: FD %d: accept failure: %s\n",
- sock, xstrerr(xerrno));
+ debugs(33, 1, "httpAccept: FD " << sock << ": accept failure: " << xstrerr(xerrno));
return;
}
- debug(33, 4) ("httpAccept: FD %d: accepted\n", newfd);
+ debugs(33, 4, "httpAccept: FD " << newfd << ": accepted");
fd_note(newfd, "client http connect");
connState = connStateCreate(&details->peer, &details->me, newfd, s);
comm_add_close_handler(newfd, connStateFree, connState);
case SSL_ERROR_SYSCALL:
if (ret == 0) {
- debug(83, 2) ("clientNegotiateSSL: Error negotiating SSL connection on FD %d: Aborted by client\n", fd);
+ debugs(83, 2, "clientNegotiateSSL: Error negotiating SSL connection on FD " << fd << ": Aborted by client");
comm_close(fd);
return;
} else {
if (errno == ECONNRESET)
hard = 0;
- debug(83, hard ? 1 : 2) ("clientNegotiateSSL: Error negotiating SSL connection on FD %d: %s (%d)\n",
- fd, strerror(errno), errno);
+ debugs(83, hard ? 1 : 2, "clientNegotiateSSL: Error negotiating SSL connection on FD " <<
+ fd << ": " << strerror(errno) << " (" << errno << ")");
comm_close(fd);
}
case SSL_ERROR_ZERO_RETURN:
- debug(83, 1) ("clientNegotiateSSL: Error negotiating SSL connection on FD %d: Closed by client\n", fd);
+ debugs(83, 1, "clientNegotiateSSL: Error negotiating SSL connection on FD " << fd << ": Closed by client");
comm_close(fd);
return;
default:
- debug(83, 1) ("clientNegotiateSSL: Error negotiating SSL connection on FD %d: %s (%d/%d)\n",
- fd, ERR_error_string(ERR_get_error(), NULL), ssl_error, ret);
+ debugs(83, 1, "clientNegotiateSSL: Error negotiating SSL connection on FD " <<
+ fd << ": " << ERR_error_string(ERR_get_error(), NULL) <<
+ " (" << ssl_error << "/" << ret << ")");
comm_close(fd);
return;
}
}
if (SSL_session_reused(ssl)) {
- debug(83, 2) ("clientNegotiateSSL: Session %p reused on FD %d (%s:%d)\n", SSL_get_session(ssl), fd, fd_table[fd].ipaddr, (int)fd_table[fd].remote_port);
+ debugs(83, 2, "clientNegotiateSSL: Session " << SSL_get_session(ssl) <<
+ " reused on FD " << fd << " (" << fd_table[fd].ipaddr << ":" << (int)fd_table[fd].remote_port << ")");
} else {
if (do_debug(83, 4)) {
/* Write out the SSL session details.. actually the call below, but
#else
- debug(83, 4) ("With " OPENSSL_VERSION_TEXT ", session details are available only defining ALLOW_ALWAYS_SSL_SESSION_DETAIL=1 in the source.\n");
+ debugs(83, 4, "With " OPENSSL_VERSION_TEXT ", session details are available only defining ALLOW_ALWAYS_SSL_SESSION_DETAIL=1 in the source." );
#endif
/* Note: This does not automatically fflush the log file.. */
}
- debug(83, 2) ("clientNegotiateSSL: New session %p on FD %d (%s:%d)\n", SSL_get_session(ssl), fd, fd_table[fd].ipaddr, (int)fd_table[fd].remote_port);
+ debugs(83, 2, "clientNegotiateSSL: New session " <<
+ SSL_get_session(ssl) << " on FD " << fd << " (" <<
+ fd_table[fd].ipaddr << ":" << (int)fd_table[fd].remote_port <<
+ ")");
}
- debug(83, 3) ("clientNegotiateSSL: FD %d negotiated cipher %s\n", fd,
- SSL_get_cipher(ssl));
+ debugs(83, 3, "clientNegotiateSSL: FD " << fd << " negotiated cipher " <<
+ SSL_get_cipher(ssl));
client_cert = SSL_get_peer_certificate(ssl);
if (client_cert != NULL) {
- debug(83, 3) ("clientNegotiateSSL: FD %d client certificate: subject: %s\n",
- fd, X509_NAME_oneline(X509_get_subject_name(client_cert), 0, 0));
+ debugs(83, 3, "clientNegotiateSSL: FD " << fd <<
+ " client certificate: subject: " <<
+ X509_NAME_oneline(X509_get_subject_name(client_cert), 0, 0));
+
+ debugs(83, 3, "clientNegotiateSSL: FD " << fd <<
+ " client certificate: issuer: " <<
+ X509_NAME_oneline(X509_get_issuer_name(client_cert), 0, 0));
- debug(83, 3) ("clientNegotiateSSL: FD %d client certificate: issuer: %s\n",
- fd, X509_NAME_oneline(X509_get_issuer_name(client_cert), 0, 0));
X509_free(client_cert);
} else {
- debug(83, 5) ("clientNegotiateSSL: FD %d has no certificate.\n", fd);
+ debugs(83, 5, "clientNegotiateSSL: FD " << fd <<
+ " has no certificate.");
}
conn->readSomeData();
if (flag != COMM_OK) {
errno = xerrno;
- debug(33, 1) ("httpsAccept: FD %d: accept failure: %s\n",
- sock, xstrerr(xerrno));
+ debugs(33, 1, "httpsAccept: FD " << sock << ": accept failure: " << xstrerr(xerrno));
return;
}
if ((ssl = SSL_new(sslContext)) == NULL) {
ssl_error = ERR_get_error();
- debug(83, 1) ("httpsAccept: Error allocating handle: %s\n",
- ERR_error_string(ssl_error, NULL));
+ debugs(83, 1, "httpsAccept: Error allocating handle: " << ERR_error_string(ssl_error, NULL) );
comm_close(newfd);
return;
}
fd_table[newfd].read_method = &ssl_read_method;
fd_table[newfd].write_method = &ssl_write_method;
- debug(33, 5) ("httpsAccept: FD %d accepted, starting SSL negotiation.\n", newfd);
+ debugs(33, 5, "httpsAccept: FD " << newfd << " accepted, starting SSL negotiation.");
fd_note(newfd, "client https connect");
connState = connStateCreate(&details->peer, &details->me, newfd, (http_port_list *)s);
comm_add_close_handler(newfd, connStateFree, connState);
for (s = Config.Sockaddr.http; s; s = s->next) {
if (MAXHTTPPORTS == NHttpSockets) {
- debug(1, 1) ("WARNING: You have too many 'http_port' lines.\n");
- debug(1, 1) (" The limit is %d\n", MAXHTTPPORTS);
+ debugs(1, 1, "WARNING: You have too many 'http_port' lines.");
+ debugs(1, 1, " The limit is " << MAXHTTPPORTS);
continue;
}
comm_accept(fd, httpAccept, s);
- debug(1, 1) ("Accepting %s HTTP connections at %s, port %d, FD %d.\n",
- s->transparent ? "transparently proxied" :
- s->accel ? "accelerated" :
- "",
- inet_ntoa(s->s.sin_addr), (int) ntohs(s->s.sin_port), fd);
+ debugs(1, 1, "Accepting " <<
+ (s->transparent ? "transparently proxied" :
+ s->accel ? "accelerated" : "" )
+ << " HTTP connections at "
+ << inet_ntoa(s->s.sin_addr) << ", port "
+ << (int) ntohs(s->s.sin_port) << ", FD " << fd << "." );
HttpSockets[NHttpSockets++] = fd;
}
for (s = Config.Sockaddr.https; s; s = (https_port_list *)s->http.next) {
if (MAXHTTPPORTS == NHttpSockets) {
- debug(1, 1) ("WARNING: You have too many 'https_port' lines.\n");
- debug(1, 1) (" The limit is %d\n", MAXHTTPPORTS);
+ debugs(1, 1, "WARNING: You have too many 'https_port' lines.");
+ debugs(1, 1, " The limit is " << MAXHTTPPORTS);
continue;
}
if (s->sslContext == NULL) {
- debug(1, 1) ("Can not accept HTTPS connections at %s, port %d\n",
- inet_ntoa(s->http.s.sin_addr), (int) ntohs(s->http.s.sin_port));
+ debugs(1, 1, "Can not accept HTTPS connections at " <<
+ inet_ntoa(s->http.s.sin_addr) << ", port " <<
+ (int) ntohs(s->http.s.sin_port));
}
enter_suid();
comm_accept(fd, httpsAccept, s);
- debug(1, 1) ("Accepting HTTPS connections at %s, port %d, FD %d.\n",
- inet_ntoa(s->http.s.sin_addr), (int) ntohs(s->http.s.sin_port), fd);
+ debugs(1, 1, "Accepting HTTPS connections at " <<
+ inet_ntoa(s->http.s.sin_addr) << ", port " <<
+ (int) ntohs(s->http.s.sin_port) << ", FD " << fd << ".");
HttpSockets[NHttpSockets++] = fd;
}
for (i = 0; i < NHttpSockets; i++) {
if (HttpSockets[i] >= 0) {
- debug(1, 1) ("FD %d Closing HTTP connection\n", HttpSockets[i]);
+ debugs(1, 1, "FD " << HttpSockets[i] <<
+ " Closing HTTP connection");
comm_close(HttpSockets[i]);
HttpSockets[i] = -1;
}
if (!has_vary || !entry->mem_obj->vary_headers) {
if (vary) {
/* Oops... something odd is going on here.. */
- debug(33,
- 1)
- ("varyEvaluateMatch: Oops. Not a Vary object on second attempt, '%s' '%s'\n",
- entry->mem_obj->url, vary);
+ debugs(33, 1, "varyEvaluateMatch: Oops. Not a Vary object on second attempt, '" <<
+ entry->mem_obj->url << "' '" << vary << "'");
safe_free(request->vary_headers);
return VARY_CANCEL;
}
/* Oops.. we have already been here and still haven't
* found the requested variant. Bail out
*/
- debug(33, 1) ("varyEvaluateMatch: Oops. Not a Vary match on second attempt, '%s' '%s'\n",
- entry->mem_obj->url, vary);
+ debugs(33, 1, "varyEvaluateMatch: Oops. Not a Vary match on second attempt, '" <<
+ entry->mem_obj->url << "' '" << vary << "'");
return VARY_CANCEL;
}
}
/*
- * $Id: client_side_reply.cc,v 1.120 2007/04/21 07:14:13 wessels Exp $
+ * $Id: client_side_reply.cc,v 1.121 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 88 Client-side Reply Routines
* AUTHOR: Robert Collins (Originally Duane Wessels in client_side.c)
clientReplyContext::saveState()
{
assert(old_sc == NULL);
- debug(88, 3)("clientReplyContext::saveState: saving store context\n");
+ debugs(88, 3, "clientReplyContext::saveState: saving store context");
old_entry = http->storeEntry();
old_sc = sc;
old_reqsize = reqsize;
clientReplyContext::restoreState()
{
assert(old_sc != NULL);
- debug(88, 3)("clientReplyContext::restoreState: Restoring store context\n");
+ debugs(88, 3, "clientReplyContext::restoreState: Restoring store context");
removeClientStoreReference(&sc, http);
http->storeEntry(old_entry);
sc = old_sc;
{
char *url = http->uri;
StoreEntry *entry = NULL;
- debug(88, 3)("clientReplyContext::processExpired: '%s'", http->uri);
+ debugs(88, 3, "clientReplyContext::processExpired: '" << http->uri << "'");
assert(http->storeEntry()->lastmod >= 0);
/*
* check if we are allowed to contact other servers
#endif
http->request->lastmod = old_entry->lastmod;
- debug(88, 5)("clientReplyContext::processExpired : lastmod %ld",
- (long int) entry->lastmod);
+ debugs(88, 5, "clientReplyContext::processExpired : lastmod " << (long int) entry->lastmod );
http->storeEntry(entry);
assert(http->out.offset == 0);
/* Register with storage manager to receive updates when data comes in. */
if (EBIT_TEST(entry->flags, ENTRY_ABORTED))
- debug(88, 0) ("clientReplyContext::processExpired: Found ENTRY_ABORTED object");
+ debugs(88, 0, "clientReplyContext::processExpired: Found ENTRY_ABORTED object");
{
/* start counting the length from 0 */
if (deleting)
return;
- debug(88, 3) ("handleIMSReply: %s, %lu bytes\n",
- http->storeEntry()->url(),
- (long unsigned) result.length);
+ debugs(88, 3, "handleIMSReply: " << http->storeEntry()->url() << ", " << (long unsigned) result.length << " bytes" );
if (http->storeEntry() == NULL)
return;
// request to origin was aborted
if (EBIT_TEST(http->storeEntry()->flags, ENTRY_ABORTED)) {
- debug(88, 3) ("handleIMSReply: request to origin aborted '%s', sending old entry to client\n", http->storeEntry()->url());
+ debugs(88, 3, "handleIMSReply: request to origin aborted '" << http->storeEntry()->url() << "', sending old entry to client" );
http->logType = LOG_TCP_REFRESH_FAIL;
sendClientOldEntry();
}
// header is too large, send old entry
if (reqsize >= HTTP_REQBUF_SZ) {
- debug(88, 3) ("handleIMSReply: response from origin is too large '%s', sending old entry to client\n", http->storeEntry()->url());
+ debugs(88, 3, "handleIMSReply: response from origin is too large '" << http->storeEntry()->url() << "', sending old entry to client" );
http->logType = LOG_TCP_REFRESH_FAIL;
sendClientOldEntry();
}
// everything looks fine, we're just waiting for more data
else {
- debug(88, 3) ("handleIMSReply: incomplete headers for '%s', waiting for more data\n", http->storeEntry()->url());
+ debugs(88, 3, "handleIMSReply: incomplete headers for '" << http->storeEntry()->url() << "', waiting for more data" );
reqofs = reqsize;
waitForMoreData();
}
if (http->request->flags.ims) {
// forward the 304 from origin
- debug(88,3) ("handleIMSReply: origin replied 304, revalidating existing entry and forwarding 304 to client\n");
+ debugs(88, 3, "handleIMSReply: origin replied 304, revalidating existing entry and forwarding 304 to client");
sendClientUpstreamResponse();
} else {
// send existing entry, it's still valid
- debug(88,3) ("handleIMSReply: origin replied 304, revalidating existing entry and sending %d to client\n", old_rep->sline.status);
+ debugs(88, 3, "handleIMSReply: origin replied 304, revalidating existing entry and sending " <<
+ old_rep->sline.status << " to client");
sendClientOldEntry();
}
}
else if (status > HTTP_STATUS_NONE && status < HTTP_INTERNAL_SERVER_ERROR) {
// forward response from origin
http->logType = LOG_TCP_REFRESH_MODIFIED;
- debug(88,3) ("handleIMSReply: origin replied %d, replacing existing entry and forwarding to client\n", status);
+ debugs(88, 3, "handleIMSReply: origin replied " << status << ", replacing existing entry and forwarding to client");
sendClientUpstreamResponse();
}
else {
// ignore and let client have old entry
http->logType = LOG_TCP_REFRESH_FAIL;
- debug(88,3) ("handleIMSReply: origin replied with error %d, sending old entry (%d) to client\n", status, old_rep->sline.status);
+ debugs(88, 3, "handleIMSReply: origin replied with error " <<
+ status << ", sending old entry (" << old_rep->sline.status << ") to client");
sendClientOldEntry();
}
}
HttpRequest *r = http->request;
- debug(88, 3) ("clientCacheHit: %s, %u bytes\n", http->uri, (unsigned int)result.length);
+ debugs(88, 3, "clientCacheHit: " << http->uri << ", " << (unsigned int)result.length << " bytes");
if (http->storeEntry() == NULL) {
- debug(88, 3) ("clientCacheHit: request aborted\n");
+ debugs(88, 3, "clientCacheHit: request aborted");
return;
} else if (result.flags.error) {
/* swap in failure */
- debug(88, 3) ("clientCacheHit: swapin failure for %s\n", http->uri);
+ debugs(88, 3, "clientCacheHit: swapin failure for " << http->uri);
http->logType = LOG_TCP_SWAPFAIL_MISS;
removeClientStoreReference(&sc, http);
processMiss();
&& http->out.offset == 0) {
processMiss();
} else {
- debug(88, 3) ("clientCacheHit: waiting for HTTP reply headers\n");
+ debugs(88, 3, "clientCacheHit: waiting for HTTP reply headers");
reqofs += result.length;
assert(reqofs <= HTTP_REQBUF_SZ);
/* get the next users' buffer */
case VARY_MATCH:
/* This is the correct entity for this request. Continue */
- debug(88, 2) ("clientProcessHit: Vary MATCH!\n");
+ debugs(88, 2, "clientProcessHit: Vary MATCH!");
break;
case VARY_OTHER:
/* Note: varyEvalyateMatch updates the request with vary information
* so we only get here once. (it also takes care of cancelling loops)
*/
- debug(88, 2) ("clientProcessHit: Vary detected!\n");
+ debugs(88, 2, "clientProcessHit: Vary detected!");
clientGetMoreData(ourNode, http);
return;
case VARY_CANCEL:
/* varyEvaluateMatch found a object loop. Process as miss */
- debug(88, 1) ("clientProcessHit: Vary object loop!\n");
+ debugs(88, 1, "clientProcessHit: Vary object loop!");
processMiss();
return;
}
http->logType = LOG_TCP_NEGATIVE_HIT;
sendMoreData(result);
} else if (!Config.onoff.offline && refreshCheckHTTP(e, r) && !http->flags.internal) {
- debug(88, 5) ("clientCacheHit: in refreshCheck() block\n");
+ debugs(88, 5, "clientCacheHit: in refreshCheck() block");
/*
* We hold a stale copy; it needs to be validated
*/
*/
if (e->getReply()->sline.status != HTTP_OK) {
- debug(88, 4) ("clientCacheHit: Reply code %d != 200\n",
- e->getReply()->sline.status);
+ debugs(88, 4, "clientCacheHit: Reply code " <<
+ e->getReply()->sline.status << " != 200");
http->logType = LOG_TCP_MISS;
processMiss();
} else if (e->modifiedSince(http->request)) {
char *url = http->uri;
HttpRequest *r = http->request;
ErrorState *err = NULL;
- debug(88, 4) ("clientProcessMiss: '%s %s'\n",
- RequestMethodStr[r->method], url);
+ debugs(88, 4, "clientProcessMiss: '" << RequestMethodStr[r->method] << " " << url << "'");
/*
* We might have a left-over StoreEntry from a failed cache hit
* or IMS request.
if (http->storeEntry()) {
if (EBIT_TEST(http->storeEntry()->flags, ENTRY_SPECIAL)) {
- debug(88, 0) ("clientProcessMiss: miss on a special object (%s).\n",
- url);
- debug(88, 0) ("\tlog_type = %s\n", log_tags[http->logType]);
+ debugs(88, 0, "clientProcessMiss: miss on a special object (" << url << ").");
+ debugs(88, 0, "\tlog_type = " << log_tags[http->logType]);
http->storeEntry()->dump(1);
}
clientReplyContext::processOnlyIfCachedMiss()
{
ErrorState *err = NULL;
- debug(88, 4) ("clientProcessOnlyIfCachedMiss: '%s %s'\n",
- RequestMethodStr[http->request->method], http->uri);
+ debugs(88, 4, "clientProcessOnlyIfCachedMiss: '" <<
+ RequestMethodStr[http->request->method] << " " << http->uri << "'");
http->al.http.code = HTTP_GATEWAY_TIMEOUT;
err = clientBuildError(ERR_ONLY_IF_CACHED_MISS, HTTP_GATEWAY_TIMEOUT, NULL,
&http->getConn()->peer.sin_addr, http->request);
void
clientReplyContext::purgeRequest()
{
- debug(88, 3) ("Config2.onoff.enable_purge = %d\n",
- Config2.onoff.enable_purge);
+ debugs(88, 3, "Config2.onoff.enable_purge = " <<
+ Config2.onoff.enable_purge);
if (!Config2.onoff.enable_purge) {
http->logType = LOG_TCP_DENIED;
if (!newEntry->isNull()) {
/* Release the cached URI */
- debug(88, 4) ("clientPurgeRequest: GET '%s'\n", newEntry->url());
+ debugs(88, 4, "clientPurgeRequest: GET '" << newEntry->url() << "'" );
newEntry->release();
purgeStatus = HTTP_OK;
}
clientReplyContext::purgeDoPurgeHead(StoreEntry *newEntry)
{
if (newEntry && !newEntry->isNull()) {
- debug(88, 4) ("clientPurgeRequest: HEAD '%s'\n", newEntry->url());
+ debugs(88, 4, "clientPurgeRequest: HEAD '" << newEntry->url() << "'" );
newEntry->release();
purgeStatus = HTTP_OK;
}
StoreEntry *entry = storeGetPublic(urlCanonical(http->request), METHOD_GET);
if (entry) {
- debug(88, 4) ("clientPurgeRequest: Vary GET '%s'\n",
- entry->url());
+ debugs(88, 4, "clientPurgeRequest: Vary GET '" << entry->url() << "'" );
entry->release();
purgeStatus = HTTP_OK;
}
entry = storeGetPublic(urlCanonical(http->request), METHOD_HEAD);
if (entry) {
- debug(88, 4) ("clientPurgeRequest: Vary HEAD '%s'\n",
- entry->url());
+ debugs(88, 4, "clientPurgeRequest: Vary HEAD '" << entry->url() << "'" );
entry->release();
purgeStatus = HTTP_OK;
}
#if SIZEOF_SIZE_T == 4
if (http->out.size > 0x7FFF0000) {
- debug(88, 1) ("WARNING: closing FD %d to prevent counter overflow\n",
- fd);
- debug(88, 1) ("\tclient %s\n",
- inet_ntoa(http->getConn() != NULL ? http->getConn()->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);
+ debugs(88, 1, "WARNING: closing FD " << fd << " to prevent counter overflow" );
+ debugs(88, 1, "\tclient " << (inet_ntoa(http->getConn() != NULL ? http->getConn()->peer.sin_addr : no_addr)) );
+ debugs(88, 1, "\treceived " << (int) http->out.size << " bytes" );
+ debugs(88, 1, "\tURI " << http->log_uri );
return 1;
}
#endif
#if SIZEOF_OFF_T == 4
if (http->out.offset > 0x7FFF0000) {
- debug(88, 1) ("WARNING: closing FD %d to prevent counter overflow\n",
- fd);
- debug(88, 1) ("\tclient %s\n",
- inet_ntoa(http->getConn() != NULL ? http->getConn()->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);
+ debugs(88, 1, "WARNING: closing FD " << fd << " to prevent counter overflow" );
+ debugs(88, 1, "\tclient " << (inet_ntoa(http->getConn() != NULL ? http->getConn()->peer.sin_addr : no_addr)) );
+ debugs(88, 1, "\treceived " << (int) http->out.size << " bytes (offset " << (int) http->out.offset << ")" );
+ debugs(88, 1, "\tURI " << http->log_uri );
return 1;
}
return STREAM_FAILED;
if ((done = checkTransferDone()) != 0 || flags.complete) {
- debug(88, 5) ("clientReplyStatus: transfer is DONE\n");
+ debugs(88, 5, "clientReplyStatus: transfer is DONE");
/* Ok we're finished, but how? */
if (http->storeEntry()->getReply()->bodySize(http->request->method) < 0) {
- debug(88, 5) ("clientReplyStatus: closing, content_length < 0\n");
+ debugs(88, 5, "clientReplyStatus: closing, content_length < 0");
return STREAM_FAILED;
}
if (!done) {
- debug(88, 5) ("clientReplyStatus: closing, !done, but read 0 bytes\n");
+ debugs(88, 5, "clientReplyStatus: closing, !done, but read 0 bytes");
return STREAM_FAILED;
}
if (!http->gotEnough()) {
- debug(88, 5) ("clientReplyStatus: client didn't get all it expected\n");
+ debugs(88, 5, "clientReplyStatus: client didn't get all it expected");
return STREAM_UNPLANNED_COMPLETE;
}
if (http->request->flags.proxy_keepalive) {
- debug(88, 5) ("clientReplyStatus: stream complete and can keepalive\n");
+ debugs(88, 5, "clientReplyStatus: stream complete and can keepalive");
return STREAM_COMPLETE;
}
- debug(88, 5) ("clientReplyStatus: stream was not expected to complete!\n");
+ debugs(88, 5, "clientReplyStatus: stream was not expected to complete!");
return STREAM_UNPLANNED_COMPLETE;
}
if (http->isReplyBodyTooLarge(http->out.offset - 4096)) {
/* 4096 is a margin for the HTTP headers included in out.offset */
- debug(88, 5) ("clientReplyStatus: client reply body is too large\n");
+ debugs(88, 5, "clientReplyStatus: client reply body is too large");
return STREAM_FAILED;
}
#endif
if (reply->bodySize(request->method) < 0) {
- debug(88,
- 3)
- ("clientBuildReplyHeader: can't keep-alive, unknown body size\n");
+ debugs(88, 3, "clientBuildReplyHeader: can't keep-alive, unknown body size" );
request->flags.proxy_keepalive = 0;
}
if (fdUsageHigh()&& !request->flags.must_keepalive) {
- debug(88, 3) ("clientBuildReplyHeader: Not many unused FDs, can't keep-alive\n");
+ debugs(88, 3, "clientBuildReplyHeader: Not many unused FDs, can't keep-alive");
request->flags.proxy_keepalive = 0;
}
if (!Config.onoff.error_pconns && reply->sline.status >= 400 && !request->flags.must_keepalive) {
- debug(33, 3) ("clientBuildReplyHeader: Error, don't keep-alive\n");
+ debugs(33, 3, "clientBuildReplyHeader: Error, don't keep-alive");
request->flags.proxy_keepalive = 0;
}
if (NULL == http->storeEntry()) {
/* this object isn't in the cache */
- debug(85, 3) ("clientProcessRequest2: storeGet() MISS\n");
+ debugs(85, 3, "clientProcessRequest2: storeGet() MISS");
http->logType = LOG_TCP_MISS;
doGetMoreData();
return;
}
if (Config.onoff.offline) {
- debug(85, 3) ("clientProcessRequest2: offline HIT\n");
+ debugs(85, 3, "clientProcessRequest2: offline HIT");
http->logType = LOG_TCP_HIT;
doGetMoreData();
return;
}
if (!e->validToSend()) {
- debug(85, 3) ("clientProcessRequest2: !validToSend MISS\n");
+ debugs(85, 3, "clientProcessRequest2: !storeEntryValidToSend MISS" );
http->storeEntry(NULL);
http->logType = LOG_TCP_MISS;
doGetMoreData();
if (EBIT_TEST(e->flags, ENTRY_SPECIAL)) {
/* Special entries are always hits, no matter what the client says */
- debug(85, 3) ("clientProcessRequest2: ENTRY_SPECIAL HIT\n");
+ debugs(85, 3, "clientProcessRequest2: ENTRY_SPECIAL HIT");
http->logType = LOG_TCP_HIT;
doGetMoreData();
return;
}
if (r->flags.nocache) {
- debug(85, 3) ("clientProcessRequest2: no-cache REFRESH MISS\n");
+ debugs(85, 3, "clientProcessRequest2: no-cache REFRESH MISS");
http->storeEntry(NULL);
http->logType = LOG_TCP_CLIENT_REFRESH_MISS;
doGetMoreData();
return;
}
- debug(85, 3) ("clientProcessRequest2: default HIT\n");
+ debugs(85, 3, "clientProcessRequest2: default HIT");
http->logType = LOG_TCP_HIT;
doGetMoreData();
}
/* We call into the stream, because we don't know that there is a
* client socket!
*/
- debug(88,5)("clientReplyContext::sendStreamError: A stream error has occured, marking as complete and sending no data.\n");
+ debugs(88, 5, "clientReplyContext::sendStreamError: A stream error has occured, marking as complete and sending no data.");
StoreIOBuffer tempBuffer;
flags.complete = 1;
tempBuffer.flags.error = result.flags.error;
StoreIOBuffer tempBuffer;
if (result.length == 0) {
- debug (88,5)("clientReplyContext::pushStreamData: marking request as complete due to 0 length store result\n");
+ debugs(88, 5, "clientReplyContext::pushStreamData: marking request as complete due to 0 length store result");
flags.complete = 1;
}
void
clientReplyContext::waitForMoreData ()
{
- debug(88,5)("clientReplyContext::waitForMoreData: Waiting for more data to parse reply headers in client side.\n");
+ debugs(88, 5, "clientReplyContext::waitForMoreData: Waiting for more data to parse reply headers in client side.");
/* We don't have enough to parse the metadata yet */
/* TODO: the store should give us out of band metadata and
* obsolete this routine
void
clientReplyContext::startSendProcess()
{
- debug(88,5)("clientReplyContext::startSendProcess: triggering store read to SendMoreData\n");
+ debugs(88, 5, "clientReplyContext::startSendProcess: triggering store read to SendMoreData");
assert(reqofs <= HTTP_REQBUF_SZ);
/* TODO: copy into the supplied buffer */
StoreIOBuffer tempBuffer;
for (l = Config.ReplyBodySize; l; l = l -> next) {
if (ch->matchAclListFast(l->aclList)) {
if (l->size != static_cast<size_t>(-1)) {
- debug(58, 3) ("clientReplyContext: Setting maxBodySize to %ld\n", (long int) l->size);
+ debugs(58, 3, "clientReplyContext: Setting maxBodySize to " << (long int) l->size);
http->maxReplyBodySize(l->size);
}
void
clientReplyContext::processReplyAccessResult(bool accessAllowed)
{
- debug(88, 2) ("The reply for %s %s is %s, because it matched '%s'\n",
- RequestMethodStr[http->request->method], http->uri,
- accessAllowed ? "ALLOWED" : "DENIED",
- AclMatchedName ? AclMatchedName : "NO ACL's");
+ debugs(88, 2, "The reply for " << RequestMethodStr[http->request->method]
+ << " " << http->uri << " is "
+ << ( accessAllowed ? "ALLOWED" : "DENIED")
+ << ", because it matched '"
+ << (AclMatchedName ? AclMatchedName : "NO ACL's") << "'" );
if (!accessAllowed && reply->sline.status != HTTP_FORBIDDEN
&& !alwaysAllowResponse(reply->sline.status)) {
assert(body_size >= 0);
- debug(88,3)
- ("clientReplyContext::sendMoreData: Appending %d bytes after %d bytes of headers\n",
- (int) body_size, reply->hdr_sz);
+ debugs(88, 3, "clientReplyContext::sendMoreData: Appending " <<
+ (int) body_size << " bytes after " << reply->hdr_sz <<
+ " bytes of headers");
#if ESI
if (http->flags.accel && reply->sline.status != HTTP_FORBIDDEN &&
!alwaysAllowResponse(reply->sline.status) &&
esiEnableProcessing(reply)) {
- debug(88, 2) ("Enabling ESI processing for %s\n", http->uri);
+ debugs(88, 2, "Enabling ESI processing for " << http->uri);
clientStreamInsertHead(&http->client_stream, esiStreamRead,
esiProcessStream, esiStreamDetach, esiStreamStatus, NULL);
}
#if ICAP_CLIENT_RESPMOD_POSTCACHE
- debug(88, 0) ("Enabling ICAP processing for %s\n", http->uri);
+ debugs(88, 0, "Enabling ICAP processing for " << http->uri);
clientStreamInsertHead(&http->client_stream, icapclientStreamRead,
icapclientProcessStream,
makeThisHead();
- debug(88, 5) ("clientReplyContext::sendMoreData: %s, %d bytes (%u new bytes)\n",
- http->uri, (int) reqofs, (unsigned int)result.length);
-
- debug(88, 5) ("clientReplyContext::sendMoreData: FD %d '%s', out.offset=%ld \n",
- fd, entry->url(), (long int) http->out.offset);
+ debugs(88, 5, "clientReplyContext::sendMoreData: " << http->uri << ", " <<
+ (int) reqofs << " bytes (" << (unsigned int)result.length <<
+ " new bytes)");
+ debugs(88, 5, "clientReplyContext::sendMoreData: FD " << fd << " '" << entry->url() << "', out.offset=" << (long int) http->out.offset << " " );
/* update size of the request */
reqsize = reqofs;
* webservers are seriously broken, this is probably not
* going to get fixed.. perhapos we should remove it?
*/
- debug (88,0)("Broken head response - probably phttpd/0.99.72\n");
+ debugs(88, 0, "Broken head response - probably phttpd/0.99.72");
http->flags.done_copying = 1;
flags.complete = 1;
/*
clientStreamCallback((clientStreamNode *)http->client_stream.head->data,
http, NULL, tempBuffer);
} else {
- debug (88,0)("clientReplyContext::sendMoreData: Unable to parse reply headers within a single HTTP_REQBUF_SZ length buffer\n");
+ debugs(88, 0, "clientReplyContext::sendMoreData: Unable to parse reply headers within a single HTTP_REQBUF_SZ length buffer");
StoreIOBuffer tempBuffer;
tempBuffer.flags.error = 1;
/* XXX FIXME: make an html error page here */
/*
- * $Id: client_side_request.cc,v 1.82 2007/04/20 23:53:41 wessels Exp $
+ * $Id: client_side_request.cc,v 1.83 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 85 Client-side Request Routines
* AUTHOR: Robert Collins (Originally Duane Wessels in client_side.c)
if (request_failure_ratio < 1.0)
return;
- debug(33, 0) ("Failure Ratio at %4.2f\n", request_failure_ratio);
+ debugs(33, 0, "Failure Ratio at "<< std::setw(4)<<
+ std::setprecision(3) << request_failure_ratio);
- debug(33, 0) ("Going into hit-only-mode for %d minutes...\n",
- FAILURE_MODE_TIME / 60);
+ debugs(33, 0, "Going into hit-only-mode for " <<
+ FAILURE_MODE_TIME / 60 << " minutes...");
hit_only_mode_until = squid_curtime + FAILURE_MODE_TIME;
ClientHttpRequest::~ClientHttpRequest()
{
- debug(33, 3) ("httpRequestFree: %s\n", uri);
+ debugs(33, 3, "httpRequestFree: " << uri);
PROF_start(httpRequestFree);
// Even though freeResources() below may destroy the request,
strcpy(http->uri, url);
if ((request = HttpRequest::CreateFromUrlAndMethod(http->uri, method)) == NULL) {
- debug(85, 5) ("Invalid URL: %s\n", http->uri);
+ debugs(85, 5, "Invalid URL: " << http->uri);
return -1;
}
acl_checklist = NULL;
err_type page_id;
http_status status;
- 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");
+ debugs(85, 2, "The request " <<
+ RequestMethodStr[http->request->method] << " " <<
+ http->uri << " is " <<
+ (answer == ACCESS_ALLOWED ? "ALLOWED" : "DENIED") <<
+ ", because it matched '" <<
+ (AclMatchedName ? AclMatchedName : "NO ACL's") << "'" );
char const *proxy_auth_msg = "<null>";
if (http->getConn() != NULL && http->getConn()->auth_user_request != NULL)
if (answer != ACCESS_ALLOWED) {
/* Send an error */
int require_auth = (answer == ACCESS_REQ_PROXY_AUTH || aclIsProxyAuth(AclMatchedName));
- debug(85, 5) ("Access Denied: %s\n", http->uri);
- debug(85, 5) ("AclMatchedName = %s\n",
- AclMatchedName ? AclMatchedName : "<null>");
+ debugs(85, 5, "Access Denied: " << http->uri);
+ debugs(85, 5, "AclMatchedName = " << (AclMatchedName ? AclMatchedName : "<null>"));
if (require_auth)
- debug(33, 5) ("Proxy Auth Message = %s\n",
- proxy_auth_msg ? proxy_auth_msg : "<null>");
+ debugs(33, 5, "Proxy Auth Message = " << (proxy_auth_msg ? proxy_auth_msg : "<null>"));
/*
* NOTE: get page_id here, based on AclMatchedName because if
void
ClientRequestContext::clientRedirectStart()
{
- debug(33, 5) ("clientRedirectStart: '%s'\n", http->uri);
+ debugs(33, 5, "clientRedirectStart: '" << http->uri << "'");
if (Config.accessList.redirector) {
acl_checklist = clientAclChecklistCreate(Config.accessList.redirector, http);
if (clientHierarchical(http))
request->flags.hierarchical = 1;
- debug(85, 5) ("clientInterpretRequestHeaders: REQ_NOCACHE = %s\n",
- request->flags.nocache ? "SET" : "NOT SET");
+ debugs(85, 5, "clientInterpretRequestHeaders: REQ_NOCACHE = " <<
+ (request->flags.nocache ? "SET" : "NOT SET"));
+ debugs(85, 5, "clientInterpretRequestHeaders: REQ_CACHABLE = " <<
+ (request->flags.cachable ? "SET" : "NOT SET"));
+ debugs(85, 5, "clientInterpretRequestHeaders: REQ_HIERARCHICAL = " <<
+ (request->flags.hierarchical ? "SET" : "NOT SET"));
- debug(85, 5) ("clientInterpretRequestHeaders: REQ_CACHABLE = %s\n",
- request->flags.cachable ? "SET" : "NOT SET");
-
- debug(85, 5) ("clientInterpretRequestHeaders: REQ_HIERARCHICAL = %s\n",
- request->flags.hierarchical ? "SET" : "NOT SET");
}
void
{
HttpRequest *new_request = NULL;
HttpRequest *old_request = http->request;
- debug(85, 5) ("clientRedirectDone: '%s' result=%s\n", http->uri,
- result ? result : "NULL");
+ debugs(85, 5, "clientRedirectDone: '" << http->uri << "' result=" << (result ? result : "NULL"));
assert(redirect_state == REDIRECT_PENDING);
redirect_state = REDIRECT_DONE;
http->redirect.status = status;
http->redirect.location = xstrdup(t + 1);
} else {
- debug(85, 1) ("clientRedirectDone: bad input: %s\n", result);
+ debugs(85, 1, "clientRedirectDone: bad input: " << result);
}
} else if (strcmp(result, http->uri))
new_request = HttpRequest::CreateFromUrlAndMethod(result, old_request->method);
void
ClientHttpRequest::processRequest()
{
- debug(85, 4) ("clientProcessRequest: %s '%s'\n",
- RequestMethodStr[request->method], uri);
+ debugs(85, 4, "clientProcessRequest: " << RequestMethodStr[request->method] << " '" << uri << "'");
if (request->method == METHOD_CONNECT && !redirect.status) {
logType = LOG_TCP_MISS;
{
PROF_start(httpStart);
logType = LOG_TAG_NONE;
- debug(85, 4) ("ClientHttpRequest::httpStart: %s for '%s'\n",
- log_tags[logType], uri);
+ debugs(85, 4, "ClientHttpRequest::httpStart: " << log_tags[logType] << " for '" << uri << "'");
+
/* no one should have touched this */
assert(out.offset == 0);
/* Use the Stream Luke */
{
debugs(85, 3, HERE << this << " ClientHttpRequest::startIcap() called");
if (!service) {
- debug(85,3)("ClientHttpRequest::startIcap fails: lack of service\n");
+ debugs(85, 3, "ClientHttpRequest::startIcap fails: lack of service");
return false;
}
if (service->broken()) {
- debug(85,3)("ClientHttpRequest::startIcap fails: broken service\n");
+ debugs(85, 3, "ClientHttpRequest::startIcap fails: broken service");
return false;
}
// XXX: we must not try to recover if the ICAP service is not bypassable!
if (!usedStore && !usedPipe) {
- debug(85,2)("WARNING: ICAP REQMOD callout failed, proceeding with original request\n");
+ debugs(85, 2, "WARNING: ICAP REQMOD callout failed, proceeding with original request");
if (calloutContext)
doCallouts();
return;
/*
- * $Id: comm.cc,v 1.428 2006/10/31 23:30:57 wessels Exp $
+ * $Id: comm.cc,v 1.429 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 5 Socket Functions
* AUTHOR: Harvest Derived
void
commio_complete_callback(int fd, comm_io_callback_t *ccb, comm_err_t code, int xerrno)
{
- debug(5, 3) ("commio_complete_callback: called for %d (%d, %d)\n", fd, code, xerrno);
+ debugs(5, 3, "commio_complete_callback: called for " << fd << " (" << code << ", " << xerrno << ")");
assert(ccb->active == true);
assert(ccb->fd == fd);
ccb->errcode = code;
void
commio_cancel_callback(int fd, comm_io_callback_t *ccb)
{
- debug(5, 3) ("commio_cancel_callback: called for %d\n", fd);
+ debugs(5, 3, "commio_cancel_callback: called for " << fd);
assert(ccb->fd == fd);
assert(ccb->active == true);
void *cbdata;
assert(cb.active == true);
assert(cb.completed == true);
- debug(5, 3) ("commio_call_callback: called for %d\n", ccb->fd);
+ debugs(5, 3, "commio_call_callback: called for " << ccb->fd);
/* We've got a copy; blow away the real one */
/* XXX duplicate code from commio_cancel_callback! */
*/
PROF_start(comm_calliocallback);
- debug(5, 7) ("comm_calliocallback: %p\n", CommCallbackList.head);
+ debugs(5, 7, "comm_calliocallback: " << CommCallbackList.head);
while (CommCallbackList.head != NULL && oldseqnum != ((CommCallbackData *)CommCallbackList.head->data)->result.seqnum) {
dlink_node *node = (dlink_node *)CommCallbackList.head;
bool
comm_iocallbackpending(void)
{
- debug(5, 7) ("comm_iocallbackpending: %p\n", CommCallbackList.head);
+ debugs(5, 7, "comm_iocallbackpending: " << CommCallbackList.head);
return (CommCallbackList.head != NULL) || (commfd_completed_events.head != NULL);
}
errno = 0;
int retval;
retval = FD_READ_METHOD(fd, ccb->buf, ccb->size);
- debug(5, 3) ("comm_read_try: FD %d, size %d, retval %d, errno %d\n",
- fd, ccb->size, retval, errno);
+ debugs(5, 3, "comm_read_try: FD " << fd << ", size " << ccb->size << ", retval " << retval << ", errno " << errno);
if (retval < 0 && !ignoreErrno(errno)) {
- debug(5, 3) ("comm_read_try: scheduling COMM_ERROR\n");
+ debugs(5, 3, "comm_read_try: scheduling COMM_ERROR");
ccb->offset = 0;
commio_complete_callback(fd, ccb, COMM_ERROR, errno);
return;
assert(fdc_table[fd].active == 1);
assert(!fd_table[fd].flags.closing);
- debug(5,4)("comm_read, queueing read for FD %d\n",fd);
+ debugs(5, 4, "comm_read, queueing read for FD " << fd);
/* Queue the read */
/* XXX ugly */
/* If the fd is closed already, just return */
if (!F->flags.open) {
- debug(5, 0) ("comm_local_port: FD %d has been closed.\n", fd);
+ debugs(5, 0, "comm_local_port: FD " << fd << " has been closed.");
return 0;
}
addr_len = sizeof(addr);
if (getsockname(fd, (struct sockaddr *) &addr, &addr_len)) {
- debug(50, 1) ("comm_local_port: Failed to retrieve TCP/UDP port number for socket: FD %d: %s\n", fd, xstrerror());
+ debugs(50, 1, "comm_local_port: Failed to retrieve TCP/UDP port number for socket: FD " << fd << ": " << xstrerror());
return 0;
}
F->local_port = ntohs(addr.sin_port);
- debug(5, 6) ("comm_local_port: FD %d: port %d\n", fd, (int) F->local_port);
+ debugs(5, 6, "comm_local_port: FD " << fd << ": port " << (int) F->local_port);
return F->local_port;
}
if (bind(s, (struct sockaddr *) &S, sizeof(S)) == 0)
return COMM_OK;
- debug(50, 0) ("commBind: Cannot bind socket FD %d to %s:%d: %s\n",
- s,
- S.sin_addr.s_addr == INADDR_ANY ? "*" : inet_ntoa(S.sin_addr),
- (int) port,
- xstrerror());
+ debugs(50, 0, "commBind: Cannot bind socket FD " << s << " to " <<
+ (S.sin_addr.s_addr == INADDR_ANY ? "*" : inet_ntoa(S.sin_addr)) <<
+ ":" << (int) port << ": " << xstrerror());
return COMM_ERROR;
}
* limits the number of simultaneous clients */
if (limitError(errno)) {
- debug(50, 1) ("comm_open: socket failure: %s\n", xstrerror());
+ debugs(50, 1, "comm_open: socket failure: " << xstrerror());
fdAdjustReserved();
} else {
- debug(50, 0) ("comm_open: socket failure: %s\n", xstrerror());
+ debugs(50, 0, "comm_open: socket failure: " << xstrerror());
}
PROF_stop(comm_open);
#ifdef IP_TOS
tos = TOS;
- if (setsockopt(new_socket, IPPROTO_IP, IP_TOS, (char *) &tos, sizeof(int)) < 0)
- debug(50, 1) ("comm_open: setsockopt(IP_TOS) on FD %d: %s\n",
- new_socket, xstrerror());
+ if (setsockopt(new_socket, IPPROTO_IP, IP_TOS, (char *) &tos, sizeof(int)) < 0) {
+ debugs(50, 1, "comm_open: setsockopt(IP_TOS) on FD " << new_socket << ": " << xstrerror());
+ }
#else
- debug(50, 0) ("comm_open: setsockopt(IP_TOS) not supported on this platform\n");
+ debugs(50, 0, "comm_open: setsockopt(IP_TOS) not supported on this platform");
#endif
}
/* update fdstat */
- debug(5, 5) ("comm_open: FD %d is a new socket\n", new_socket);
+ debugs(5, 5, "comm_open: FD " << new_socket << " is a new socket");
fd_open(new_socket, FD_SOCKET, note);
commConnectStart(int fd, const char *host, u_short port, CNCB * callback, void *data)
{
ConnectStateData *cs;
- debug(5, 3) ("commConnectStart: FD %d, data %p, %s:%d\n", fd, data, host, (int) port);
+ debugs(5, 3, "commConnectStart: FD " << fd << ", data " << data << ", " << host << ":" << (int) port);
cs = new ConnectStateData;
cs->fd = fd;
cs->host = xstrdup(host);
ConnectStateData *cs = (ConnectStateData *)data;
if (ia == NULL) {
- debug(5, 3) ("commConnectDnsHandle: Unknown host: %s\n", cs->host);
+ debugs(5, 3, "commConnectDnsHandle: Unknown host: " << cs->host);
if (!dns_error_message) {
dns_error_message = "Unknown DNS error";
- debug(5, 1) ("commConnectDnsHandle: Bad dns_error_message\n");
+ debugs(5, 1, "commConnectDnsHandle: Bad dns_error_message");
}
assert(dns_error_message != NULL);
void
ConnectStateData::callCallback(comm_err_t status, int xerrno)
{
- debug(5, 3) ("commConnectCallback: FD %d, data %p\n", fd, callback.data);
+ debugs(5, 3, "commConnectCallback: FD " << fd << ", data " << callback.data);
+
comm_remove_close_handler(fd, commConnectFree, this);
CallBack<CNCB> aCallback = callback;
callback = CallBack<CNCB>();
commConnectFree(int fd, void *data)
{
ConnectStateData *cs = (ConnectStateData *)data;
- debug(5, 3) ("commConnectFree: FD %d\n", fd);
+ debugs(5, 3, "commConnectFree: FD " << fd);
cs->callback = CallBack<CNCB>();
safe_free(cs->host);
delete cs;
int fd2 = socket(AF_INET, SOCK_STREAM, 0);
if (fd2 < 0) {
- debug(5, 0) ("commResetFD: socket: %s\n", xstrerror());
+ debugs(5, 0, "commResetFD: socket: " << xstrerror());
if (ENFILE == errno || EMFILE == errno)
fdAdjustReserved();
#endif
if (dup2(fd2, fd) < 0) {
- debug(5, 0) ("commResetFD: dup2: %s\n", xstrerror());
+ debugs(5, 0, "commResetFD: dup2: " << xstrerror());
if (ENFILE == errno || EMFILE == errno)
fdAdjustReserved();
*/
if (commBind(fd, F->local_addr, F->local_port) != COMM_OK) {
- debug(5, 0) ("commResetFD: bind: %s\n", xstrerror());
+ debugs(5, 0, "commResetFD: bind: " << xstrerror());
return 0;
}
#ifdef IP_TOS
if (F->tos) {
if (setsockopt(fd, IPPROTO_IP, IP_TOS, (char *) &F->tos, sizeof(int)) < 0)
- debug(50, 1) ("commResetFD: setsockopt(IP_TOS) on FD %d: %s\n", fd, xstrerror());
+ debugs(50, 1, "commResetFD: setsockopt(IP_TOS) on FD " << fd << ": " << xstrerror());
}
#endif
switch (comm_connect_addr(fd, &S)) {
case COMM_INPROGRESS:
- debug(5, 5) ("ConnectStateData::connect: FD %d: COMM_INPROGRESS\n", fd);
+ debugs(5, 5, "ConnectStateData::connect: FD " << fd << ": COMM_INPROGRESS");
commSetSelect(fd, COMM_SELECT_WRITE, ConnectStateData::Connect, this, 0);
break;
int
commSetTimeout(int fd, int timeout, PF * handler, void *data)
{
- debug(5, 3) ("commSetTimeout: FD %d timeout %d\n", fd, timeout);
+ debugs(5, 3, "commSetTimeout: FD " << fd << " timeout " << timeout);
assert(fd >= 0);
assert(fd < Squid_MaxFD);
fde *F = &fd_table[fd];
x = connect(sock, (struct sockaddr *) address, sizeof(*address));
if (x < 0)
- debug(5, 9) ("connect FD %d: %s\n", sock, xstrerror());
+ debugs(5, 9, "connect FD " << sock << ": " << xstrerror());
} else
{
#if defined(_SQUID_NEWSOS6_)
if (status == COMM_OK)
{
- debug(5, 10) ("comm_connect_addr: FD %d connected to %s:%d\n",
- sock, F->ipaddr, F->remote_port);
+ debugs(5, 10, "comm_connect_addr: FD " << sock << " connected to " << F->ipaddr << ":" << F->remote_port);
} else if (status == COMM_INPROGRESS)
{
- debug(5, 10) ("comm_connect_addr: FD %d connection pending\n", sock);
+ debugs(5, 10, "comm_connect_addr: FD " << sock << " connection pending");
}
return status;
if (ignoreErrno(errno))
{
- debug(50, 5) ("comm_old_accept: FD %d: %s\n", fd, xstrerror());
+ debugs(50, 5, "comm_old_accept: FD " << fd << ": " << xstrerror());
return COMM_NOMESSAGE;
} else if (ENFILE == errno || EMFILE == errno)
{
- debug(50, 3) ("comm_old_accept: FD %d: %s\n", fd, xstrerror());
+ debugs(50, 3, "comm_old_accept: FD " << fd << ": " << xstrerror());
return COMM_ERROR;
} else
{
- debug(50, 1) ("comm_old_accept: FD %d: %s\n", fd, xstrerror());
+ debugs(50, 1, "comm_old_accept: FD " << fd << ": " << xstrerror());
return COMM_ERROR;
}
}
commCallCloseHandlers(int fd)
{
fde *F = &fd_table[fd];
- debug(5, 5) ("commCallCloseHandlers: FD %d\n", fd);
+ debugs(5, 5, "commCallCloseHandlers: FD " << fd);
while (F->closeHandler != NULL) {
close_handler ch = *F->closeHandler;
conn_close_pool->free(F->closeHandler); /* AAA */
F->closeHandler = ch.next;
ch.next = NULL;
- debug(5, 5) ("commCallCloseHandlers: ch->handler=%p data=%p\n", ch.handler, ch.data);
+ debugs(5, 5, "commCallCloseHandlers: ch->handler=" << ch.handler << " data=" << ch.data);
if (cbdataReferenceValid(ch.data))
ch.handler(fd, ch.data);
n = FD_READ_METHOD(fd, buf, 1024);
if (n < 0)
- debug(5, 3) ("commLingerClose: FD %d read: %s\n", fd, xstrerror());
+ debugs(5, 3, "commLingerClose: FD " << fd << " read: " << xstrerror());
comm_close(fd);
}
static void
commLingerTimeout(int fd, void *unused)
{
- debug(5, 3) ("commLingerTimeout: FD %d\n", fd);
+ debugs(5, 3, "commLingerTimeout: FD " << fd);
comm_close(fd);
}
L.l_linger = 0;
if (setsockopt(fd, SOL_SOCKET, SO_LINGER, (char *) &L, sizeof(L)) < 0)
- debug(50, 0) ("commResetTCPClose: FD %d: %s\n", fd, xstrerror());
+ debugs(50, 0, "commResetTCPClose: FD " << fd << ": " << xstrerror());
comm_close(fd);
}
dlink_node *node;
CommCallbackData *cio;
- debug(5, 5) ("comm_close: FD %d\n", fd);
+ debugs(5, 5, "comm_close: FD " << fd);
assert(fd >= 0);
assert(fd < Squid_MaxFD);
F = &fd_table[fd];
if (ECONNREFUSED != errno)
#endif
- debug(50, 1) ("comm_udp_sendto: FD %d, %s, port %d: %s\n",
- fd,
- inet_ntoa(to_addr->sin_addr),
- (int) htons(to_addr->sin_port),
- xstrerror());
+ debugs(50, 1, "comm_udp_sendto: FD " << fd << ", " <<
+ inet_ntoa(to_addr->sin_addr) << ", port " <<
+ (int) htons(to_addr->sin_port) << ": " << xstrerror());
return COMM_ERROR;
}
{
close_handler *newHandler = (close_handler *)conn_close_pool->alloc(); /* AAA */
close_handler *c;
- debug(5, 5) ("comm_add_close_handler: FD %d, handler=%p, data=%p\n",
- fd, handler, data);
+ debugs(5, 5, "comm_add_close_handler: FD " << fd << ", handler=" <<
+ handler << ", data=" << data);
for (c = fd_table[fd].closeHandler; c; c = c->next)
assert(c->handler != handler || c->data != data);
close_handler *p;
close_handler *last = NULL;
/* Find handler in list */
- debug(5, 5) ("comm_remove_close_handler: FD %d, handler=%p, data=%p\n",
- fd, handler, data);
+ debugs(5, 5, "comm_remove_close_handler: FD " << fd << ", handler=" <<
+ handler << ", data=" << data);
for (p = fd_table[fd].closeHandler; p != NULL; last = p, p = p->next)
if (p->handler == handler && p->data == data)
L.l_linger = 0;
if (setsockopt(fd, SOL_SOCKET, SO_LINGER, (char *) &L, sizeof(L)) < 0)
- debug(50, 0) ("commSetNoLinger: FD %d: %s\n", fd, xstrerror());
+ debugs(50, 0, "commSetNoLinger: FD " << fd << ": " << xstrerror());
fd_table[fd].flags.nolinger = 1;
}
int on = 1;
if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (char *) &on, sizeof(on)) < 0)
- debug(50, 1) ("commSetReuseAddr: FD %d: %s\n", fd, xstrerror());
+ debugs(50, 1, "commSetReuseAddr: FD " << fd << ": " << xstrerror());
}
static void
commSetTcpRcvbuf(int fd, int size)
{
if (setsockopt(fd, SOL_SOCKET, SO_RCVBUF, (char *) &size, sizeof(size)) < 0)
- debug(50, 1) ("commSetTcpRcvbuf: FD %d, SIZE %d: %s\n",
- fd, size, xstrerror());
+ debugs(50, 1, "commSetTcpRcvbuf: FD " << fd << ", SIZE " << size << ": " << xstrerror());
}
int
#endif
if (ioctl(fd, FIONBIO, &nonblocking) < 0) {
- debug(50, 0) ("commSetNonBlocking: FD %d: %s %d\n", fd, xstrerror(), fd_table[fd].type);
+ debugs(50, 0, "commSetNonBlocking: FD " << fd << ": " << xstrerror() << " " << fd_table[fd].type);
return COMM_ERROR;
}
#ifndef _SQUID_MSWIN_
if ((flags = fcntl(fd, F_GETFL, dummy)) < 0) {
- debug(50, 0) ("FD %d: fcntl F_GETFL: %s\n", fd, xstrerror());
+ debugs(50, 0, "FD " << fd << ": fcntl F_GETFL: " << xstrerror());
return COMM_ERROR;
}
if (fcntl(fd, F_SETFL, flags | SQUID_NONBLOCK) < 0) {
- debug(50, 0) ("commSetNonBlocking: FD %d: %s\n", fd, xstrerror());
+ debugs(50, 0, "commSetNonBlocking: FD " << fd << ": " << xstrerror());
return COMM_ERROR;
}
int dummy = 0;
if ((flags = fcntl(fd, F_GETFL, dummy)) < 0) {
- debug(50, 0) ("FD %d: fcntl F_GETFL: %s\n", fd, xstrerror());
+ debugs(50, 0, "FD " << fd << ": fcntl F_GETFL: " << xstrerror());
return COMM_ERROR;
}
if (fcntl(fd, F_SETFL, flags & (~SQUID_NONBLOCK)) < 0) {
#endif
- debug(50, 0) ("commUnsetNonBlocking: FD %d: %s\n", fd, xstrerror());
+ debugs(50, 0, "commUnsetNonBlocking: FD " << fd << ": " << xstrerror());
return COMM_ERROR;
}
int dummy = 0;
if ((flags = fcntl(fd, F_GETFL, dummy)) < 0) {
- debug(50, 0) ("FD %d: fcntl F_GETFL: %s\n", fd, xstrerror());
+ debugs(50, 0, "FD " << fd << ": fcntl F_GETFL: " << xstrerror());
return;
}
if (fcntl(fd, F_SETFD, flags | FD_CLOEXEC) < 0)
- debug(50, 0) ("FD %d: set close-on-exec failed: %s\n", fd, xstrerror());
+ debugs(50, 0, "FD " << fd << ": set close-on-exec failed: " << xstrerror());
fd_table[fd].flags.close_on_exec = 1;
int on = 1;
if (setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, (char *) &on, sizeof(on)) < 0)
- debug(50, 1) ("commSetTcpNoDelay: FD %d: %s\n", fd, xstrerror());
+ debugs(50, 1, "commSetTcpNoDelay: FD " << fd << ": " << xstrerror());
fd_table[fd].flags.nodelay = 1;
}
assert(state == COMMIO_FD_WRITECB(fd));
PROF_start(commHandleWrite);
- debug(5, 5) ("commHandleWrite: FD %d: off %ld, sz %ld.\n",
- fd, (long int) state->offset, (long int) state->size);
+ debugs(5, 5, "commHandleWrite: FD " << fd << ": off " <<
+ (long int) state->offset << ", sz " << (long int) state->size << ".");
nleft = state->size - state->offset;
len = FD_WRITE_METHOD(fd, state->buf + state->offset, nleft);
- debug(5, 5) ("commHandleWrite: write() returns %d\n", len);
+ debugs(5, 5, "commHandleWrite: write() returns " << len);
fd_bytes(fd, len, FD_WRITE);
statCounter.syscalls.sock.writes++;
/* We're done */
if (nleft != 0)
- debug(5, 1) ("commHandleWrite: FD %d: write failure: connection closed with %d bytes remaining.\n", fd, nleft);
+ debugs(5, 1, "commHandleWrite: FD " << fd << ": write failure: connection closed with " << nleft << " bytes remaining.");
commio_complete_callback(fd, COMMIO_FD_WRITECB(fd), nleft ? COMM_ERROR : COMM_OK, errno);
} else if (len < 0) {
/* An error */
if (fd_table[fd].flags.socket_eof) {
- debug(50, 2) ("commHandleWrite: FD %d: write failure: %s.\n",
- fd, xstrerror());
+ debugs(50, 2, "commHandleWrite: FD " << fd << ": write failure: " << xstrerror() << ".");
commio_complete_callback(fd, COMMIO_FD_WRITECB(fd), nleft ? COMM_ERROR : COMM_OK, errno);
} else if (ignoreErrno(errno)) {
- debug(50, 10) ("commHandleWrite: FD %d: write failure: %s.\n",
- fd, xstrerror());
+ debugs(50, 10, "commHandleWrite: FD " << fd << ": write failure: " << xstrerror() << ".");
commSetSelect(fd,
COMM_SELECT_WRITE,
commHandleWrite,
state,
0);
} else {
- debug(50, 2) ("commHandleWrite: FD %d: write failure: %s.\n",
- fd, xstrerror());
+ debugs(50, 2, "commHandleWrite: FD " << fd << ": write failure: " << xstrerror() << ".");
commio_complete_callback(fd, COMMIO_FD_WRITECB(fd), nleft ? COMM_ERROR : COMM_OK, errno);
}
} else {
{
assert(!fd_table[fd].flags.closing);
- debug(5, 5) ("comm_write: FD %d: sz %d: hndl %p: data %p.\n",
- fd, size, handler, handler_data);
+ debugs(5, 5, "comm_write: FD " << fd << ": sz " << size << ": hndl " << handler << ": data " << handler_data << ".");
if (commio_has_callback(fd, IOCB_WRITE, COMMIO_FD_WRITECB(fd))) {
/* This means that the write has been scheduled, but has not
PF *callback = F->timeout_handler;
void *cbdata = NULL;
F->timeout_handler = NULL;
- debug(5, 5) ("commCloseAllSockets: FD %d: Calling timeout handler\n",
- fd);
+ debugs(5, 5, "commCloseAllSockets: FD " << fd << ": Calling timeout handler");
if (cbdataReferenceValidDone(F->timeout_data, &cbdata))
callback(fd, cbdata);
} else {
- debug(5, 5) ("commCloseAllSockets: FD %d: calling comm_close()\n", fd);
+ debugs(5, 5, "commCloseAllSockets: FD " << fd << ": calling comm_close()");
comm_close(fd);
}
}
if (AlreadyTimedOut(F))
continue;
- debug(5, 5) ("checkTimeouts: FD %d Expired\n", fd);
+ debugs(5, 5, "checkTimeouts: FD " << fd << " Expired");
if (F->timeout_handler) {
- debug(5, 5) ("checkTimeouts: FD %d: Call timeout handler\n", fd);
+ debugs(5, 5, "checkTimeouts: FD " << fd << ": Call timeout handler");
callback = F->timeout_handler;
F->timeout_handler = NULL;
callback(fd, F->timeout_data);
} else {
- debug(5, 5) ("checkTimeouts: FD %d: Forcing comm_close()\n", fd);
+ debugs(5, 5, "checkTimeouts: FD " << fd << ": Forcing comm_close()");
comm_close(fd);
}
}
int x;
if ((x = listen(sock, Squid_MaxFD >> 2)) < 0) {
- debug(50, 0) ("comm_listen: listen(%d, %d): %s\n",
- Squid_MaxFD >> 2,
- sock, xstrerror());
+ debugs(50, 0, "comm_listen: listen(" << (Squid_MaxFD >> 2) << ", " << sock << "): " << xstrerror());
return x;
}
// If there is no callback and we accept, we will leak the accepted FD.
// When we are running out of FDs, there is often no callback.
if (!accept.accept.callback.handler) {
- debug (5,5) ("fdc_t::acceptOne orphaned: FD %d\n", fd);
+ debugs(5, 5, "fdc_t::acceptOne orphaned: FD " << fd);
// XXX: can we remove this and similar "just in case" calls and
// either listen always or listen only when there is a callback?
if (!AcceptLimiter::Instance().deferring())
if (newfd < 0) {
if (newfd == COMM_NOMESSAGE) {
/* register interest again */
- debug (5,5) ("fdc_t::acceptOne eof: FD %d handler: %p\n", fd, (void*)accept.accept.callback.handler);
+ debugs(5, 5, "fdc_t::acceptOne eof: FD " << fd << " handler: " << (void*)accept.accept.callback.handler);
commSetSelect(fd, COMM_SELECT_READ, comm_accept_try, NULL, 0);
accept.accept.finished(true);
return;
return;
}
- debug (5,5) ("fdc_t::acceptOne accepted: FD %d handler: %p newfd: %d\n", fd, (void*)accept.accept.callback.handler, newfd);
+ debugs(5, 5, "fdc_t::acceptOne accepted: FD " << fd << " handler: " << (void*)accept.accept.callback.handler << " newfd: " << newfd);
assert(accept.accept.callback.handler);
accept.accept.doCallback(fd, newfd, COMM_OK, 0, &accept.connDetails);
*/
void
comm_accept(int fd, IOACB *handler, void *handler_data) {
- debug (5,5) ("comm_accept: FD %d handler: %p\n", fd, (void*)handler);
+ debugs(5, 5, "comm_accept: FD " << fd << " handler: " << (void*)handler);
requireOpenAndActive(fd);
/* make sure we're not pending! */
void
AcceptLimiter::defer (int fd, Acceptor::AcceptorFunction *aFunc, void *data) {
- debug (5,5) ("AcceptLimiter::defer: FD %d handler: %p\n", fd, (void*)aFunc);
+ debugs(5, 5, "AcceptLimiter::defer: FD " << fd << " handler: " << (void*)aFunc);
Acceptor temp;
temp.theFunction = aFunc;
temp.acceptFD = fd;
*/
if (flag != COMM_OK && flag != COMM_ERR_CLOSING) {
- debug (5,3) ("AbortChecker::AbortCheckReader: FD %d aborted\n", fd);
+ debugs(5, 3, "AbortChecker::AbortCheckReader: FD " << fd << " aborted");
comm_close(fd);
}
}
add
(fd);
- debug (5,3) ("AbortChecker::monitor: monitoring half closed FD %d for aborts\n", fd);
+ debugs(5, 3, "AbortChecker::monitor: monitoring half closed FD " << fd << " for aborts");
}
void
remove
(fd);
- debug (5,3) ("AbortChecker::stopMonitoring: stopped monitoring half closed FD %d for aborts\n", fd);
+ debugs(5, 3, "AbortChecker::stopMonitoring: stopped monitoring half closed FD " << fd << " for aborts");
}
#include "splay.h"
void
DeferredReadManager::delayRead(DeferredRead const &aRead) {
- debug (5, 3)("Adding deferred read on FD %d\n", aRead.theRead.fd);
+ debugs(5, 3, "Adding deferred read on FD " << aRead.theRead.fd);
List<DeferredRead> *temp = deferredReads.push_back(aRead);
comm_add_close_handler (aRead.theRead.fd, CloseHandler, temp);
}
if (aRead.cancelled)
return;
- debug (5,3)("Kicking deferred read on FD %d\n", aRead.theRead.fd);
+ debugs(5, 3, "Kicking deferred read on FD " << aRead.theRead.fd);
aRead.theReader(aRead.theContext, aRead.theRead);
}
/*
- * $Id: comm_epoll.cc,v 1.14 2007/04/25 11:30:18 adrian Exp $
+ * $Id: comm_epoll.cc,v 1.15 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 5 Socket Functions
*
struct epoll_event ev;
assert(fd >= 0);
- debug(5, DEBUG_EPOLL ? 0 : 8) ("commSetSelect(FD %d,type=%u,handler=%p,client_data=%p,timeout=%ld)\n",
- fd,type,handler,client_data,timeout);
+ debugs(5, DEBUG_EPOLL ? 0 : 8, "commSetSelect(FD " << fd << ",type=" << type <<
+ ",handler=" << handler << ",client_data=" << client_data <<
+ ",timeout=" << timeout << ")");
if (RUNNING_ON_VALGRIND) {
/* Keep valgrind happy.. complains about uninitialized bytes otherwise */
F->epoll_state = ev.events;
if (epoll_ctl(kdpfd, epoll_ctl_type, fd, &ev) < 0) {
- debug(5, DEBUG_EPOLL ? 0 : 8) ("commSetSelect: epoll_ctl(,%s,,): failed on FD %d: %s\n",
- epolltype_atoi(epoll_ctl_type), fd, xstrerror());
+ debugs(5, DEBUG_EPOLL ? 0 : 8, "commSetSelect: epoll_ctl(," << epolltype_atoi(epoll_ctl_type) <<
+ ",,): failed on FD " << fd << ": " << xstrerror());
}
}
for (i = 0, cevents = pevents; i < num; i++, cevents++) {
fd = cevents->data.fd;
F = &fd_table[fd];
- debug(5, DEBUG_EPOLL ? 0 : 8) ("comm_select(): got FD %d events=%x monitoring=%x F->read_handler=%p F->write_handler=%p\n",
- fd,cevents->events,F->epoll_state,F->read_handler,F->write_handler);
+ debugs(5, DEBUG_EPOLL ? 0 : 8, "comm_select(): got FD " << fd << " events=" <<
+ std::hex << cevents->events << " monitoring=" << F->epoll_state <<
+ " F->read_handler=" << F->read_handler << " F->write_handler=" << F->write_handler);
// TODO: add EPOLLPRI??
if (cevents->events & (EPOLLIN|EPOLLHUP|EPOLLERR)) {
if ((hdl = F->read_handler) != NULL) {
- debug(5, DEBUG_EPOLL ? 0 : 8) ("comm_select(): Calling read handler on FD %d\n",fd);
+ debugs(5, DEBUG_EPOLL ? 0 : 8, "comm_select(): Calling read handler on FD " << fd);
PROF_start(comm_write_handler);
F->read_handler = NULL;
hdl(fd, F->read_data);
PROF_stop(comm_write_handler);
statCounter.select_fds++;
} else {
- debug(5, DEBUG_EPOLL ? 0 : 8) ("comm_select(): no read handler for FD %d\n",fd);
+ debugs(5, DEBUG_EPOLL ? 0 : 8, "comm_select(): no read handler for FD " << fd);
fd_table[fd].flags.read_pending = 1;
// remove interest since no handler exist for this event.
commSetSelect(fd, COMM_SELECT_READ, NULL, NULL, 0);
if (cevents->events & (EPOLLOUT|EPOLLHUP|EPOLLERR)) {
if ((hdl = F->write_handler) != NULL) {
- debug(5, DEBUG_EPOLL ? 0 : 8) ("comm_select(): Calling write handler on FD %d\n",fd);
+ debugs(5, DEBUG_EPOLL ? 0 : 8, "comm_select(): Calling write handler on FD " << fd);
PROF_start(comm_read_handler);
F->write_handler = NULL;
hdl(fd, F->write_data);
statCounter.select_fds++;
} else {
fd_table[fd].flags.write_pending = 1;
- debug(5, DEBUG_EPOLL ? 0 : 8) ("comm_select(): no write handler for FD %d\n",fd);
+ debugs(5, DEBUG_EPOLL ? 0 : 8, "comm_select(): no write handler for FD " << fd);
// remove interest since no handler exist for this event.
commSetSelect(fd, COMM_SELECT_WRITE, NULL, NULL, 0);
}
/*
- * $Id: comm_kqueue.cc,v 1.14 2007/04/25 11:30:18 adrian Exp $
+ * $Id: comm_kqueue.cc,v 1.15 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 5 Socket Functions
*
default:
/* Bad! -- adrian */
- debug(5, 1) ("comm_select: kevent returned %d!\n", ke[i].filter);
+ debugs(5, 1, "comm_select: kevent returned " << ke[i].filter << "!");
break;
}
}
/*
- * $Id: comm_poll.cc,v 1.19 2006/09/02 10:39:53 adrian Exp $
+ * $Id: comm_poll.cc,v 1.20 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 5 Socket Functions
*
fde *F = &fd_table[fd];
assert(fd >= 0);
assert(F->flags.open);
- debug(5, 5) ("commSetSelect: FD %d type %d\n", fd, type);
+ debugs(5, 5, "commSetSelect: FD " << fd << " type " << type);
if (type & COMM_SELECT_READ) {
F->read_handler = handler;
fd_table[fd].read_handler = NULL;
hdl(fd, fd_table[fd].read_data);
} else if (pfds[i].events & POLLRDNORM)
- debug(5, 1) ("comm_poll_incoming: FD %d NULL read handler\n",
- fd);
+ debugs(5, 1, "comm_poll_incoming: FD " << fd << " NULL read handler");
}
if (revents & (POLLWRNORM | POLLOUT | POLLHUP | POLLERR)) {
fd_table[fd].write_handler = NULL;
hdl(fd, fd_table[fd].write_data);
} else if (pfds[i].events & POLLWRNORM)
- debug(5, 1) ("comm_poll_incoming: FD %d NULL write_handler\n",
- fd);
+ debugs(5, 1, "comm_poll_incoming: FD " << fd << " NULL write_handler");
}
}
if (ignoreErrno(errno))
continue;
- debug(5, 0) ("comm_poll: poll failure: %s\n", xstrerror());
+ debugs(5, 0, "comm_poll: poll failure: " << xstrerror());
assert(errno != EINVAL);
getCurrentTime();
- debug(5, num ? 5 : 8) ("comm_poll: %d+%ld FDs ready\n", num, npending);
+ debugs(5, num ? 5 : 8, "comm_poll: " << num << "+" << npending << " FDs ready");
statHistCount(&statCounter.select_fds_hist, num);
if (num == 0 && npending == 0)
F = &fd_table[fd];
if (revents & (POLLRDNORM | POLLIN | POLLHUP | POLLERR)) {
- debug(5, 6) ("comm_poll: FD %d ready for reading\n", fd);
+ debugs(5, 6, "comm_poll: FD " << fd << " ready for reading");
if (NULL == (hdl = F->read_handler))
(void) 0;
}
if (revents & (POLLWRNORM | POLLOUT | POLLHUP | POLLERR)) {
- debug(5, 5) ("comm_poll: FD %d ready for writing\n", fd);
+ debugs(5, 5, "comm_poll: FD " << fd << " ready for writing");
if ((hdl = F->write_handler)) {
PROF_start(comm_write_handler);
if (revents & POLLNVAL) {
close_handler *ch;
- debug(5, 0) ("WARNING: FD %d has handlers, but it's invalid.\n", fd);
- debug(5, 0) ("FD %d is a %s\n", fd, fdTypeStr[F->type]);
- debug(5, 0) ("--> %s\n", F->desc);
- debug(5, 0) ("tmout:%p read:%p write:%p\n",
- F->timeout_handler,
- F->read_handler,
- F->write_handler);
+ debugs(5, 0, "WARNING: FD " << fd << " has handlers, but it's invalid.");
+ debugs(5, 0, "FD " << fd << " is a " << fdTypeStr[F->type]);
+ debugs(5, 0, "--> " << F->desc);
+ debugs(5, 0, "tmout:" << F->timeout_handler << " read:" <<
+ F->read_handler << " write:" << F->write_handler);
for (ch = F->closeHandler; ch; ch = ch->next)
- debug(5, 0) (" close handler: %p\n", ch->handler);
+ debugs(5, 0, " close handler: " << ch->handler);
if (F->closeHandler) {
commCallCloseHandlers(fd);
} else if (F->timeout_handler) {
- debug(5, 0) ("comm_poll: Calling Timeout Handler\n");
+ debugs(5, 0, "comm_poll: Calling Timeout Handler");
F->timeout_handler(fd, F->timeout_data);
}
while ((fd = commGetSlowFd()) != -1) {
fde *F = &fd_table[fd];
- debug(5, 6) ("comm_select: slow FD %d selected for reading\n", fd);
+ debugs(5, 6, "comm_select: slow FD " << fd << " selected for reading");
if ((hdl = F->read_handler)) {
F->read_handler = NULL;
return COMM_OK;
} while (timeout > current_dtime);
- debug(5, 8) ("comm_poll: time out: %ld.\n", (long int) squid_curtime);
+ debugs(5, 8, "comm_poll: time out: " << (long int) squid_curtime << ".");
return COMM_TIMEOUT;
}
/*
- * $Id: comm_select.cc,v 1.77 2006/09/02 10:39:53 adrian Exp $
+ * $Id: comm_select.cc,v 1.78 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 5 Socket Functions
*
fde *F = &fd_table[fd];
assert(fd >= 0);
assert(F->flags.open);
- debug(5, 5) ("commSetSelect: FD %d type %d\n", fd, type);
+ debugs(5, 5, "commSetSelect: FD " << fd << " type " << type);
if (type & COMM_SELECT_READ) {
F->read_handler = handler;
commUpdateReadBits(fd, NULL);
hdl(fd, fd_table[fd].read_data);
} else {
- debug(5, 1) ("comm_select_incoming: FD %d NULL read handler\n",
- fd);
+ debugs(5, 1, "comm_select_incoming: FD " << fd << " NULL read handler");
}
}
commUpdateWriteBits(fd, NULL);
hdl(fd, fd_table[fd].write_data);
} else {
- debug(5, 1) ("comm_select_incoming: FD %d NULL write handler\n",
- fd);
+ debugs(5, 1, "comm_select_incoming: FD " << fd << " NULL write handler");
}
}
}
if (ignoreErrno(errno))
break;
- debug(5, 0) ("comm_select: select failure: %s\n",
- xstrerror());
+ debugs(5, 0, "comm_select: select failure: " << xstrerror());
examine_select(&readfds, &writefds);
getCurrentTime();
- debug(5, num ? 5 : 8) ("comm_select: %d+%d FDs ready\n",
- num, pending);
+ debugs(5, num ? 5 : 8, "comm_select: " << num << "+" << pending << " FDs ready");
statHistCount(&statCounter.select_fds_hist, num);
#if DEBUG_FDBITS
- debug(5, 9) ("FD %d bit set for reading\n", fd);
+ debugs(5, 9, "FD " << fd << " bit set for reading");
assert(FD_ISSET(fd, &readfds));
}
F = &fd_table[fd];
- debug(5, 6) ("comm_select: FD %d ready for reading\n", fd);
+ debugs(5, 6, "comm_select: FD " << fd << " ready for reading");
if (NULL == (hdl = F->read_handler))
(void) 0;
#if DEBUG_FDBITS
- debug(5, 9) ("FD %d bit set for writing\n", fd);
+ debugs(5, 9, "FD " << fd << " bit set for writing");
assert(FD_ISSET(fd, &writefds));
}
F = &fd_table[fd];
- debug(5, 5) ("comm_select: FD %d ready for writing\n", fd);
+ debugs(5, 5, "comm_select: FD " << fd << " ready for writing");
if ((hdl = F->write_handler)) {
F->write_handler = NULL;
while ((fd = commGetSlowFd()) != -1) {
F = &fd_table[fd];
- debug(5, 6) ("comm_select: slow FD %d selected for reading\n", fd);
+ debugs(5, 6, "comm_select: slow FD " << fd << " selected for reading");
if ((hdl = F->read_handler)) {
F->read_handler = NULL;
} while (timeout > current_dtime)
;
- debug(5, 8) ("comm_select: time out: %d\n", (int) squid_curtime);
+ debugs(5, 8, "comm_select: time out: " << (int) squid_curtime);
return COMM_TIMEOUT;
}
fde *F = NULL;
struct stat sb;
- debug(5, 0) ("examine_select: Examining open file descriptors...\n");
+ debugs(5, 0, "examine_select: Examining open file descriptors...");
for (fd = 0; fd < Squid_MaxFD; fd++) {
FD_ZERO(&read_x);
errno = 0;
if (!fstat(fd, &sb)) {
- debug(5, 5) ("FD %d is valid.\n", fd);
+ debugs(5, 5, "FD " << fd << " is valid.");
continue;
}
F = &fd_table[fd];
- debug(5, 0) ("FD %d: %s\n", fd, xstrerror());
- debug(5, 0) ("WARNING: FD %d has handlers, but it's invalid.\n", fd);
- debug(5, 0) ("FD %d is a %s called '%s'\n",
- fd,
- fdTypeStr[F->type],
- F->desc);
- debug(5, 0) ("tmout:%p read:%p write:%p\n",
- F->timeout_handler,
- F->read_handler,
- F->write_handler);
+ debugs(5, 0, "FD " << fd << ": " << xstrerror());
+ debugs(5, 0, "WARNING: FD " << fd << " has handlers, but it's invalid.");
+ debugs(5, 0, "FD " << fd << " is a " << fdTypeStr[F->type] << " called '" << F->desc << "'");
+ debugs(5, 0, "tmout:" << F->timeout_handler << " read:" << F->read_handler << " write:" << F->write_handler);
for (ch = F->closeHandler; ch; ch = ch->next)
- debug(5, 0) (" close handler: %p\n", ch->handler);
+ debugs(5, 0, " close handler: " << ch->handler);
if (F->closeHandler) {
commCallCloseHandlers(fd);
} else if (F->timeout_handler) {
- debug(5, 0) ("examine_select: Calling Timeout Handler\n");
+ debugs(5, 0, "examine_select: Calling Timeout Handler");
F->timeout_handler(fd, F->timeout_data);
}
/*
- * $Id: comm_select_win32.cc,v 1.2 2006/09/02 10:39:53 adrian Exp $
+ * $Id: comm_select_win32.cc,v 1.3 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 5 Socket Functions
*
fde *F = &fd_table[fd];
assert(fd >= 0);
assert(F->flags.open);
- debug(5, 5) ("commSetSelect: FD %d type %d\n", fd, type);
+ debugs(5, 5, "commSetSelect: FD " << fd << " type " << type);
if (type & COMM_SELECT_READ) {
F->read_handler = handler;
commUpdateReadBits(fd, NULL);
hdl(fd, fd_table[fd].read_data);
} else {
- debug(5, 1) ("comm_select_incoming: FD %d NULL read handler\n",
- fd);
+ debugs(5, 1, "comm_select_incoming: FD " << fd << " NULL read handler");
}
}
commUpdateWriteBits(fd, NULL);
hdl(fd, fd_table[fd].write_data);
} else {
- debug(5, 1) ("comm_select_incoming: FD %d NULL write handler\n",
- fd);
+ debugs(5, 1, "comm_select_incoming: FD " << fd << " NULL write handler");
}
}
}
if (ignoreErrno(errno))
break;
- debug(5, 0) ("comm_select: select failure: %s\n",
- xstrerror());
+ debugs(5, 0, "comm_select: select failure: " << xstrerror());
examine_select(&readfds, &writefds);
getCurrentTime();
- debug(5, num ? 5 : 8) ("comm_select: %d+%d FDs ready\n",
- num, pending);
+ debugs(5, num ? 5 : 8, "comm_select: " << num << "+" << pending << " FDs ready\n");
statHistCount(&statCounter.select_fds_hist, num);
#if DEBUG_FDBITS
- debug(5, 9) ("FD %d bit set for reading\n", fd);
+ debugs(5, 9, "FD " << fd << " bit set for reading");
assert(FD_ISSET(fd, &readfds));
}
F = &fd_table[fd];
- debug(5, 6) ("comm_select: FD %d ready for reading\n", fd);
+ debugs(5, 6, "comm_select: FD " << fd << " ready for reading");
if (NULL == (hdl = F->read_handler))
(void) 0;
#if DEBUG_FDBITS
- debug(5, 9) ("FD %d bit set for writing\n", fd);
+ debugs(5, 9, "FD " << fd << " bit set for writing");
assert(FD_ISSET(fd, &writefds));
}
F = &fd_table[fd];
- debug(5, 5) ("comm_select: FD %d ready for writing\n", fd);
+ debugs(5, 5, "comm_select: FD " << fd << " ready for writing");
if ((hdl = F->write_handler)) {
F->write_handler = NULL;
while ((fd = commGetSlowFd()) != -1) {
F = &fd_table[fd];
- debug(5, 6) ("comm_select: slow FD %d selected for reading\n", fd);
+ debugs(5, 6, "comm_select: slow FD " << fd << " selected for reading");
if ((hdl = F->read_handler)) {
F->read_handler = NULL;
} while (timeout > current_dtime)
;
- debug(5, 8) ("comm_select: time out: %d\n", (int) squid_curtime);
+ debugs(5, 8, "comm_select: time out: " << (int) squid_curtime);
return COMM_TIMEOUT;
}
fde *F = NULL;
struct stat sb;
- debug(5, 0) ("examine_select: Examining open file descriptors...\n");
+ debugs(5, 0, "examine_select: Examining open file descriptors...");
for (fd = 0; fd < Squid_MaxFD; fd++) {
FD_ZERO(&read_x);
errno = 0;
if (!fstat(fd, &sb)) {
- debug(5, 5) ("FD %d is valid.\n", fd);
+ debugs(5, 5, "FD " << fd << " is valid.");
continue;
}
F = &fd_table[fd];
- debug(5, 0) ("FD %d: %s\n", fd, xstrerror());
- debug(5, 0) ("WARNING: FD %d has handlers, but it's invalid.\n", fd);
- debug(5, 0) ("FD %d is a %s called '%s'\n",
- fd,
- fdTypeStr[F->type],
- F->desc);
- debug(5, 0) ("tmout:%p read:%p write:%p\n",
- F->timeout_handler,
- F->read_handler,
- F->write_handler);
+ debugs(5, 0, "FD " << fd << ": " << xstrerror());
+ debugs(5, 0, "WARNING: FD " << fd << " has handlers, but it's invalid.");
+ debugs(5, 0, "FD " << fd << " is a " << fdTypeStr[F->type] << " called '" << F->desc << "'");
+ debugs(5, 0, "tmout:" << F->timeout_handler << " read:" << F->read_handler << " write:" << F->write_handler);
for (ch = F->closeHandler; ch; ch = ch->next)
- debug(5, 0) (" close handler: %p\n", ch->handler);
+ debugs(5, 0, " close handler: " << ch->handler);
if (F->closeHandler) {
commCallCloseHandlers(fd);
} else if (F->timeout_handler) {
- debug(5, 0) ("examine_select: Calling Timeout Handler\n");
+ debugs(5, 0, "examine_select: Calling Timeout Handler");
F->timeout_handler(fd, F->timeout_data);
}
/*
- * $Id: debug.cc,v 1.101 2007/04/11 22:58:32 wessels Exp $
+ * $Id: debug.cc,v 1.102 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 0 Debug Routines
* AUTHOR: Harvest Derived
void
xassert(const char *msg, const char *file, int line) {
- debug(0, 0) ("assertion failed: %s:%d: \"%s\"\n", file, line, msg);
+ debugs(0, 0, "assertion failed: " << file << ":" << line << ": \"" << msg << "\"");
if (!shutting_down)
abort();
* // detect exceptional condition, and simply report it, the context
* // information will be available somewhere close in the log file
* if (status == STRANGE_STATUS)
- * debug(13, 6) ("DOS attack detected, data: %p\n", data);
+ * debugs(13, 6, "DOS attack detected, data: " << data);
* ...
* }
*
Ctx_Descrs[Ctx_Current_Level] = descr;
if (Ctx_Current_Level == Ctx_Warn_Level) {
- debug(0, 0) ("# ctx: suspiciously deep (%d) nesting:\n", Ctx_Warn_Level);
+ debugs(0, 0, "# ctx: suspiciously deep (" << Ctx_Warn_Level << ") nesting:");
Ctx_Warn_Level *= 2;
}
/*
- * $Id: delay_pools.cc,v 1.47 2006/08/07 02:28:22 robertc Exp $
+ * $Id: delay_pools.cc,v 1.48 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 77 Delay Pools
* AUTHOR: Robert Collins <robertc@squid-cache.org>
DelayPools::pools (u_short newPools)
{
if (pools()) {
- debug(3, 0) ("parse_delay_pool_count: multiple delay_pools lines, aborting all previous delay_pools config\n");
+ debugs(3, 0, "parse_delay_pool_count: multiple delay_pools lines, aborting all previous delay_pools config");
FreePools();
}
/*
- * $Id: disk.cc,v 1.171 2005/09/17 05:50:08 wessels Exp $
+ * $Id: disk.cc,v 1.172 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 6 Disk I/O Routines
* AUTHOR: Harvest Derived
statCounter.syscalls.disk.opens++;
if (fd < 0) {
- debug(50, 3) ("file_open: error opening file %s: %s\n", path,
- xstrerror());
+ debugs(50, 3, "file_open: error opening file " << path << ": " << xstrerror());
fd = DISK_ERROR;
} else {
- debug(6, 5) ("file_open: FD %d\n", fd);
+ debugs(6, 5, "file_open: FD " << fd);
commSetCloseOnExec(fd);
fd_open(fd, FD_FILE, path);
}
F->flags.close_request = 1;
- debug(6, 2) ("file_close: FD %d, delaying close\n", fd);
+ debugs(6, 2, "file_close: FD " << fd << ", delaying close");
PROF_stop(file_close);
close(fd);
- debug(6, F->flags.close_request ? 2 : 5)
- ("file_close: FD %d, really closing\n", fd);
+ debugs(6, F->flags.close_request ? 2 : 5, "file_close: FD " << fd << " really closing\n");
fd_close(fd);
PROF_start(diskHandleWrite);
- debug(6, 3) ("diskHandleWrite: FD %d\n", fd);
+ debugs(6, 3, "diskHandleWrite: FD " << fd);
F->flags.write_daemon = 0;
assert(fdd->write_q->len > fdd->write_q->buf_offset);
- debug(6, 3) ("diskHandleWrite: FD %d writing %d bytes\n",
- fd, (int) (fdd->write_q->len - fdd->write_q->buf_offset));
+ debugs(6, 3, "diskHandleWrite: FD " << fd << " writing " << (int) (fdd->write_q->len - fdd->write_q->buf_offset) << " bytes");
errno = 0;
fdd->write_q->buf + fdd->write_q->buf_offset,
fdd->write_q->len - fdd->write_q->buf_offset);
- debug(6, 3) ("diskHandleWrite: FD %d len = %d\n", fd, len);
+ debugs(6, 3, "diskHandleWrite: FD " << fd << " len = " << len);
statCounter.syscalls.disk.writes++;
if (len < 0) {
if (!ignoreErrno(errno)) {
status = errno == ENOSPC ? DISK_NO_SPACE_LEFT : DISK_ERROR;
- debug(50, 1) ("diskHandleWrite: FD %d: disk write error: %s\n",
- fd, xstrerror());
+ debugs(50, 1, "diskHandleWrite: FD " << fd << ": disk write error: " << xstrerror());
+
/*
* If there is no write callback, then this file is
* most likely something important like a log file, or
q->buf_offset += len;
if (q->buf_offset > q->len)
- debug(50, 1) ("diskHandleWriteComplete: q->buf_offset > q->len (%p,%d, %d, %d FD %d)\n",
- q, (int) q->buf_offset, q->len, len, fd);
+ debugs(50, 1, "diskHandleWriteComplete: q->buf_offset > q->len (" <<
+ q << "," << (int) q->buf_offset << ", " << q->len << ", " <<
+ len << " FD " << fd << ")");
+
assert(q->buf_offset <= q->len);
PROF_start(diskHandleRead);
if (F->disk.offset != ctrl_dat->offset) {
- debug(6, 3) ("diskHandleRead: FD %d seeking to offset %d\n",
- fd, (int) ctrl_dat->offset);
+ debugs(6, 3, "diskHandleRead: FD " << fd << " seeking to offset " << (int) ctrl_dat->offset);
lseek(fd, ctrl_dat->offset, SEEK_SET); /* XXX ignore return? */
statCounter.syscalls.disk.seeks++;
F->disk.offset = ctrl_dat->offset;
return;
}
- debug(50, 1) ("diskHandleRead: FD %d: %s\n", fd, xstrerror());
+ debugs(50, 1, "diskHandleRead: FD " << fd << ": " << xstrerror());
len = 0;
rc = DISK_ERROR;
} else if (len == 0) {
statCounter.syscalls.disk.unlinks++;
if (unlink(s) < 0 && !quiet)
- debug(50, 1) ("safeunlink: Couldn't delete %s: %s\n", s, xstrerror());
+ debugs(50, 1, "safeunlink: Couldn't delete " << s << ": " << xstrerror());
}
/*
int
xrename(const char *from, const char *to)
{
- debug(21, 2) ("xrename: renaming %s to %s\n", from, to);
+ debugs(21, 2, "xrename: renaming " << from << " to " << to);
#if defined (_SQUID_OS2_) || defined (_SQUID_WIN32_)
remove
if (0 == rename(from, to))
return 0;
- debug(21, errno == ENOENT ? 2 : 1) ("xrename: Cannot rename %s to %s: %s\n",
- from, to, xstrerror());
+ debugs(21, errno == ENOENT ? 2 : 1, "xrename: Cannot rename " << from << " to " << to << ": " << xstrerror());
return -1;
}
/*
- * $Id: dns.cc,v 1.99 2006/10/20 05:34:20 wessels Exp $
+ * $Id: dns.cc,v 1.100 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 34 Dnsserver interface
* AUTHOR: Harvest Derived
if (squid_curtime - first_warn > 3 * 60)
fatal("DNS servers not responding for 3 minutes");
- debug(34, 1) ("dnsSubmit: queue overload, rejecting %s\n", lookup);
+ debugs(34, 1, "dnsSubmit: queue overload, rejecting " << lookup);
callback(data, (char *)"$fail Temporary network problem, please retry later");
snmp_netDnsFn(variable_list * Var, snint * ErrP)
{
variable_list *Answer = NULL;
- debug(49, 5) ("snmp_netDnsFn: Processing request: %d\n", Var->name[LEN_SQ_NET + 1]);
+ debugs(49, 5, "snmp_netDnsFn: Processing request: " << Var->name[LEN_SQ_NET + 1]);
snmpDebugOid(5, Var->name, Var->name_length);
*ErrP = SNMP_ERR_NOERROR;
/*
- * $Id: dns_internal.cc,v 1.96 2007/04/13 17:04:00 wessels Exp $
+ * $Id: dns_internal.cc,v 1.97 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 78 DNS lookups; interacts with lib/rfc1035.c
* AUTHOR: Duane Wessels
struct IN_ADDR A;
if (!safe_inet_addr(buf, &A)) {
- debug(78, 0) ("WARNING: rejecting '%s' as a name server, because it is not a numeric IP address\n", buf);
+ debugs(78, 0, "WARNING: rejecting '" << buf << "' as a name server, because it is not a numeric IP address");
return;
}
if (A.s_addr == 0) {
- debug(78, 0) ("WARNING: Squid does not accept 0.0.0.0 in DNS server specifications.\n");
- debug(78, 0) ("Will be using 127.0.0.1 instead, assuming you meant that DNS is running on the same machine\n");
+ debugs(78, 0, "WARNING: Squid does not accept 0.0.0.0 in DNS server specifications.");
+ debugs(78, 0, "Will be using 127.0.0.1 instead, assuming you meant that DNS is running on the same machine");
safe_inet_addr("127.0.0.1", &A);
}
nameservers[nns].S.sin_family = AF_INET;
nameservers[nns].S.sin_port = htons(NS_DEFAULTPORT);
nameservers[nns].S.sin_addr.s_addr = A.s_addr;
- debug(78, 3) ("idnsAddNameserver: Added nameserver #%d: %s\n",
- nns, inet_ntoa(nameservers[nns].S.sin_addr));
+ debugs(78, 3, "idnsAddNameserver: Added nameserver #" << nns << ": " << inet_ntoa(nameservers[nns].S.sin_addr));
nns++;
}
assert(npc < npc_alloc);
strcpy(searchpath[npc].domain, buf);
- debug(78, 3) ("idnsAddPathComponent: Added domain #%d: %s\n",
- npc, searchpath[npc].domain);
+ debugs(78, 3, "idnsAddPathComponent: Added domain #" << npc << ": " << searchpath[npc].domain);
npc++;
}
wordlist *w;
for (w = Config.dns_nameservers; w; w = w->next) {
- debug(78, 1) ("Adding nameserver %s from squid.conf\n", w->key);
+ debugs(78, 1, "Adding nameserver " << w->key << " from squid.conf");
idnsAddNameserver(w->key);
}
}
fp = fopen(_PATH_RESCONF, "r");
if (fp == NULL) {
- debug(78, 1) ("%s: %s\n", _PATH_RESCONF, xstrerror());
+ debugs(78, 1, "" << _PATH_RESCONF << ": " << xstrerror());
return;
}
if (NULL == t)
continue;
- debug(78, 1) ("Adding nameserver %s from %s\n", t, _PATH_RESCONF);
+ debugs(78, 1, "Adding nameserver " << t << " from " << _PATH_RESCONF);
idnsAddNameserver(t);
} else if (strcasecmp(t, "search") == 0) {
if (NULL == t)
continue;
- debug(78, 1) ("Adding domain %s from %s\n", t, _PATH_RESCONF);
+ debugs(78, 1, "Adding domain " << t << " from " << _PATH_RESCONF);
idnsAddPathComponent(t);
}
if (ndots < 1)
ndots = 1;
- debug(78, 1) ("Adding ndots %d from %s\n", ndots, _PATH_RESCONF);
+ debugs(78, 1, "Adding ndots " << ndots << " from " << _PATH_RESCONF);
}
}
}
int ns;
if (DnsSocket < 0) {
- debug(78, 1) ("idnsSendQuery: Can't send query, no DNS socket!\n");
+ debugs(78, 1, "idnsSendQuery: Can't send query, no DNS socket!");
return;
}
q->sent_t = current_time;
if (x < 0) {
- debug(50, 1) ("idnsSendQuery: FD %d: sendto: %s\n",
- DnsSocket, xstrerror());
+ debugs(50, 1, "idnsSendQuery: FD " << DnsSocket << ": sendto: " << xstrerror());
if (q->nsends % nns != 0)
goto try_again;
id++;
if (id == first_id) {
- debug(78, 1) ("idnsQueryID: Warning, too many pending DNS requests\n");
+ debugs(78, 1, "idnsQueryID: Warning, too many pending DNS requests");
break;
}
}
&message);
if (message == NULL) {
- debug(78, 1) ("idnsGrokReply: Malformed DNS response\n");
+ debugs(78, 1, "idnsGrokReply: Malformed DNS response");
return;
}
- debug(78, 3) ("idnsGrokReply: ID %#hx, %d answers\n", message->id, n);
+ debugs(78, 3, "idnsGrokReply: ID 0x" << std::hex << message->id << ", " << std::dec << n << "answers");
q = idnsFindQuery(message->id);
if (q == NULL) {
- debug(78, 3) ("idnsGrokReply: Late response\n");
+ debugs(78, 3, "idnsGrokReply: Late response");
rfc1035MessageDestroy(message);
return;
}
if (rfc1035QueryCompare(&q->query, message->query) != 0) {
- debug(78, 3) ("idnsGrokReply: Query mismatch (%s != %s)\n", q->query.name, message->query->name);
+ debugs(78, 3, "idnsGrokReply: Query mismatch (" << q->query.name << " != " << message->query->name << ")");
rfc1035MessageDestroy(message);
return;
}
q->error = NULL;
if (n < 0) {
- debug(78, 3) ("idnsGrokReply: error %s (%d)\n", rfc1035_error_message, rfc1035_errno);
+ debugs(78, 3, "idnsGrokReply: error " << rfc1035_error_message << " (" << rfc1035_errno << ")");
q->error = rfc1035_error_message;
q->rcode = -n;
if (q->domain < npc) {
strcat(q->name, ".");
strcat(q->name, searchpath[q->domain].domain);
- debug(78, 3) ("idnsGrokReply: searchpath used for %s\n",
- q->name);
+ debugs(78, 3, "idnsGrokReply: searchpath used for " << q->name);
q->domain++;
} else {
q->attempt++;
if (errno != ECONNREFUSED && errno != EHOSTUNREACH)
#endif
- debug(50, 1) ("idnsRead: FD %d recvfrom: %s\n",
- fd, xstrerror());
+ debugs(50, 1, "idnsRead: FD " << fd << " recvfrom: " << xstrerror());
break;
}
fd_bytes(DnsSocket, len, FD_READ);
assert(N);
(*N)++;
- debug(78, 3) ("idnsRead: FD %d: received %d bytes from %s.\n",
- fd,
- (int) len,
- inet_ntoa(from.sin_addr));
+ debugs(78, 3, "idnsRead: FD " << fd << ": received " << (int) len << " bytes from " << inet_ntoa(from.sin_addr) << ".");
ns = idnsFromKnownNameserver(&from);
if (ns >= 0) {
static time_t last_warning = 0;
if (squid_curtime - last_warning > 60) {
- debug(78, 1) ("WARNING: Reply from unknown nameserver [%s]\n",
- inet_ntoa(from.sin_addr));
+ debugs(78, 1, "WARNING: Reply from unknown nameserver [" << inet_ntoa(from.sin_addr) << "]");
last_warning = squid_curtime;
}
if (tvSubDsec(q->sent_t, current_time) < Config.Timeout.idns_retransmit * (1 << (q->nsends - 1) % nns))
break;
- debug(78, 3) ("idnsCheckQueue: ID %#04x timeout\n",
- q->id);
+ debugs(78, 3, "idnsCheckQueue: ID 0x" << std::hex << std::setfill('0') << std::setw(4) << q->id << "timeout" );
p = n->prev;
if (tvSubDsec(q->start_t, current_time) < Config.Timeout.idns_query) {
idnsSendQuery(q);
} else {
- debug(78, 2) ("idnsCheckQueue: ID %x: giving up after %d tries and %5.1f seconds\n",
- (int) q->id, q->nsends,
- tvSubDsec(q->start_t, current_time));
+ debugs(78, 2, "idnsCheckQueue: ID " << std::hex << (int) q->id <<
+ ": giving up after " << std::dec << q->nsends << " tries and " <<
+ std::setw(5)<< std::setprecision(2) << tvSubDsec(q->start_t, current_time) << " seconds");
if (q->rcode != 0)
idnsCallback(q, NULL, -q->rcode, q->error);
return;
}
- debug(78, 3) ("idnsReadVC: FD %d: received %d bytes via tcp from %s.\n",
- fd,
- (int) vc->msg->contentSize(),
- inet_ntoa(nameservers[vc->ns].S.sin_addr));
+ debugs(78, 3, "idnsReadVC: FD " << fd << ": received " <<
+ (int) vc->msg->contentSize() << " bytes via tcp from " <<
+ inet_ntoa(nameservers[vc->ns].S.sin_addr) << ".");
idnsGrokReply(vc->msg->buf, vc->msg->contentSize());
vc->msg->clean();
*/
port = comm_local_port(DnsSocket);
- debug(78, 1) ("DNS Socket created at %s, port %d, FD %d\n",
- inet_ntoa(addr),
- port, DnsSocket);
+ debugs(78, 1, "DNS Socket created at " << inet_ntoa(addr) << ", port " <<
+ port << ", FD " << DnsSocket);
}
assert(0 == nns);
q->domain = 0;
strcat(q->name, ".");
strcat(q->name, searchpath[q->domain].domain);
- debug(78, 3) ("idnsALookup: searchpath used for %s\n",
- q->name);
+ debugs(78, 3, "idnsALookup: searchpath used for " << q->name);
}
q->sz = rfc1035BuildAQuery(q->name, q->buf, sizeof(q->buf), q->id,
return;
}
- debug(78, 3) ("idnsALookup: buf is %d bytes for %s, id = %#hx\n",
- (int) q->sz, q->name, q->id);
+ debugs(78, 3, "idnsALookup: buf is " << (int) q->sz << " bytes for " << q->name <<
+ ", id = 0x" << std::hex << q->id);
q->callback = callback;
return;
}
- debug(78, 3) ("idnsPTRLookup: buf is %d bytes for %s, id = %#hx\n",
- (int) q->sz, ip, q->id);
+ debugs(78, 3, "idnsPTRLookup: buf is " << (int) q->sz << " bytes for " << ip <<
+ ", id = 0x" << std::hex << q->id);
q->callback = callback;
{
int i, n = 0;
variable_list *Answer = NULL;
- debug(49, 5) ("snmp_netDnsFn: Processing request: \n");
+ debugs(49, 5, "snmp_netDnsFn: Processing request: ");
snmpDebugOid(5, Var->name, Var->name_length);
*ErrP = SNMP_ERR_NOERROR;
/*
- * $Id: errorpage.cc,v 1.222 2007/04/21 07:14:14 wessels Exp $
+ * $Id: errorpage.cc,v 1.223 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 4 Error Generation
* AUTHOR: Duane Wessels
fd = file_open(path, O_RDONLY | O_TEXT);
if (fd < 0) {
- debug(4, 0) ("errorTryLoadText: '%s': %s\n", path, xstrerror());
+ debugs(4, 0, "errorTryLoadText: '" << path << "': " << xstrerror());
return NULL;
}
}
if (len < 0) {
- debug(4, 0) ("errorTryLoadText: failed to fully read: '%s': %s\n",
- path, xstrerror());
+ debugs(4, 0, "errorTryLoadText: failed to fully read: '" << path << "': " << xstrerror());
}
file_close(fd);
if (err->page_id == TCP_RESET) {
if (err->request) {
- debug(4, 2) ("RSTing this reply\n");
+ debugs(4, 2, "RSTing this reply");
err->request->flags.setResetTCP();
}
}
errorSend(int fd, ErrorState * err)
{
HttpReply *rep;
- debug(4, 3) ("errorSend: FD %d, err=%p\n", fd, err);
+ debugs(4, 3, "errorSend: FD " << fd << ", err=" << err);
assert(fd >= 0);
/*
* ugh, this is how we make sure error codes get back to
errorSendComplete(int fd, char *bufnotused, size_t size, comm_err_t errflag, int xerrno, void *data)
{
ErrorState *err = static_cast<ErrorState *>(data);
- debug(4, 3) ("errorSendComplete: FD %d, size=%ld\n", fd, (long int) size);
+ debugs(4, 3, "errorSendComplete: FD " << fd << ", size=" << (long int) size);
if (errflag != COMM_ERR_CLOSING) {
if (err->callback) {
- debug(4, 3) ("errorSendComplete: callback\n");
+ debugs(4, 3, "errorSendComplete: callback");
err->callback(fd, err->callback_data, size);
} else {
comm_close(fd);
- debug(4, 3) ("errorSendComplete: comm_close\n");
+ debugs(4, 3, "errorSendComplete: comm_close");
}
}
assert(p);
- debug(4, 3) ("errorConvert: %%%c --> '%s'\n", token, p);
+ debugs(4, 3, "errorConvert: %%" << token << " --> '" << p << "'" );
if (do_quote)
p = html_quote(p);
/*
- * $Id: external_acl.cc,v 1.76 2007/04/20 22:11:34 wessels Exp $
+ * $Id: external_acl.cc,v 1.77 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 82 External ACL
* AUTHOR: Henrik Nordstrom, MARA Systems AB
{
if (data->def->require_auth) {
if (authenticateSchemeCount() == 0) {
- debug(28, 0) ("Can't use proxy auth because no authentication schemes were compiled.\n");
+ debugs(28, 0, "Can't use proxy auth because no authentication schemes were compiled.");
return false;
}
if (authenticateActiveSchemeCount() == 0) {
- debug(28, 0) ("Can't use proxy auth because no authentication schemes are fully configured.\n");
+ debugs(28, 0, "Can't use proxy auth because no authentication schemes are fully configured.");
return false;
}
}
int result;
external_acl_entry *entry;
const char *key = "";
- debug(82, 9) ("aclMatchExternal: acl=\"%s\"\n", acl->def->name);
+ debugs(82, 9, "aclMatchExternal: acl=\"" << acl->def->name << "\"");
entry = ch->extacl_entry;
if (entry) {
/* Make sure the user is authenticated */
if ((ti = ch->authenticated()) != 1) {
- debug(82, 2) ("aclMatchExternal: %s user not authenticated (%d)\n", acl->def->name, ti);
+ debugs(82, 2, "aclMatchExternal: " << acl->def->name << " user not authenticated (" << ti << ")");
return ti;
}
}
entry = static_cast<external_acl_entry *>(hash_lookup(acl->def->cache, key));
if (!entry || external_acl_grace_expired(acl->def, entry)) {
- debug(82, 2) ("aclMatchExternal: %s(\"%s\") = lookup needed\n", acl->def->name, key);
- debug(82, 2) ("aclMatchExternal: \"%s\": entry=@%p, age=%ld\n", key, entry,
- entry ? (long int) squid_curtime - entry->date : 0);
+ debugs(82, 2, "aclMatchExternal: " << acl->def->name << "(\"" << key << "\") = lookup needed");
+ debugs(82, 2, "aclMatchExternal: \"" << key << "\": entry=@" <<
+ entry << ", age=" << (entry ? (long int) squid_curtime - entry->date : 0));
if (acl->def->theHelper->stats.queue_size <= acl->def->theHelper->n_running) {
- debug(82, 2) ("aclMatchExternal: \"%s\": queueing a call.\n", key);
+ debugs(82, 2, "aclMatchExternal: \"" << key << "\": queueing a call.");
ch->changeState (ExternalACLLookup::Instance());
if (entry == NULL) {
- debug(82, 2) ("aclMatchExternal: \"%s\": return -1.\n", key);
+ debugs(82, 2, "aclMatchExternal: \"" << key << "\": return -1.");
return -1;
}
} else {
if (!entry) {
- debug(82, 1) ("aclMatchExternal: '%s' queue overload. Request rejected '%s'.\n", acl->def->name, key);
+ debugs(82, 1, "aclMatchExternal: '" << acl->def->name <<
+ "' queue overload. Request rejected '" << key << "'.");
external_acl_message = "SYSTEM TOO BUSY, TRY AGAIN LATER";
return -1;
} else {
- debug(82, 1) ("aclMatchExternal: '%s' queue overload. Using stale result. '%s'.\n", acl->def->name, key);
+ debugs(82, 1, "aclMatchExternal: '" << acl->def->name <<
+ "' queue overload. Using stale result. '" << key << "'.");
/* Fall thru to processing below */
}
}
result = entry->result;
external_acl_message = entry->message.buf();
- debug(82, 2) ("aclMatchExternal: %s = %d\n", acl->def->name, result);
+ debugs(82, 2, "aclMatchExternal: " << acl->def->name << " = " << result);
if (ch->request) {
if (entry->user.size())
external_acl_cache_add(external_acl * def, const char *key, ExternalACLEntryData const & data)
{
ExternalACLEntry *entry = static_cast<ExternalACLEntry *>(hash_lookup(def->cache, key));
- debug(82, 2) ("external_acl_cache_add: Adding '%s' = %d\n", key, data.result);
+ debugs(82, 2, "external_acl_cache_add: Adding '" << key << "' = " << data.result);
if (entry) {
- debug(82, 3) ("ExternalACLEntry::update: updating existing entry\n");
+ debugs(82, 3, "ExternalACLEntry::update: updating existing entry");
entry->update (data);
external_acl_cache_touch(def, entry);
entryData.result = 0;
external_acl_entry *entry = NULL;
- debug(82, 2) ("externalAclHandleReply: reply=\"%s\"\n", reply);
+ debugs(82, 2, "externalAclHandleReply: reply=\"" << reply << "\"");
if (reply) {
status = strwordtok(reply, &t);
/* Make sure the user is authenticated */
if ((ti = ch->authenticated()) != 1) {
- debug(82, 1) ("externalAclLookup: %s user authentication failure (%d, ch=%p)\n",
- acl->def->name, ti, ch);
+ debugs(82, 1, "externalAclLookup: " << acl->def->name <<
+ " user authentication failure (" << ti << ", ch=" << ch << ")");
callback(callback_data, NULL);
return;
}
const char *key = makeExternalAclKey(ch, acl);
if (!key) {
- debug(82, 1) ("externalAclLookup: lookup in '%s', prerequisit failure (ch=%p)\n", def->name, ch);
+ debugs(82, 1, "externalAclLookup: lookup in '" << def->name <<
+ "', prerequisit failure (ch=" << ch << ")");
callback(callback_data, NULL);
return;
}
- debug(82, 2) ("externalAclLookup: lookup in '%s' for '%s'\n", def->name, key);
+ debugs(82, 2, "externalAclLookup: lookup in '" << def->name << "' for '" << key << "'");
+
external_acl_entry *entry = static_cast<external_acl_entry *>(hash_lookup(def->cache, key));
if (entry && external_acl_entry_expired(def, entry))
if (entry && external_acl_grace_expired(def, entry)) {
if (oldstate) {
- debug(82, 4) ("externalAclLookup: in grace period, but already pending lookup ('%s', ch=%p)\n",
- key, ch);
+ debugs(82, 4, "externalAclLookup: in grace period, but already pending lookup ('" << key << "', ch=" << ch << ")");
callback(callback_data, entry);
return;
} else {
if (!graceful && entry && !external_acl_grace_expired(def, entry)) {
/* Should not really happen, but why not.. */
callback(callback_data, entry);
- debug(82, 4) ("externalAclLookup: no lookup pending for '%s', and grace not expired\n", key);
- debug(82, 4) ("externalAclLookup: (what tha' hell?)\n");
+ debugs(82, 4, "externalAclLookup: no lookup pending for '" << key << "', and grace not expired");
+ debugs(82, 4, "externalAclLookup: (what tha' hell?)");
return;
}
/* Check for queue overload */
if (def->theHelper->stats.queue_size >= def->theHelper->n_running) {
- debug(82, 1) ("externalAclLookup: '%s' queue overload (ch=%p)\n", def->name, ch);
+ debugs(82, 1, "externalAclLookup: '" << def->name << "' queue overload (ch=" << ch << ")");
cbdataFree(state);
callback(callback_data, entry);
return;
buf.Printf("%s\n", key);
- debug(82, 4) ("externalAclLookup: looking up for '%s' in '%s'.\n", key, def->name);
+ debugs(82, 4, "externalAclLookup: looking up for '" << key << "' in '" << def->name << "'.");
helperSubmit(def->theHelper, buf.buf, externalAclHandleReply, state);
if (graceful) {
/* No need to wait during grace period */
- debug(82, 4) ("externalAclLookup: no need to wait for the result of '%s' in '%s' (ch=%p).\n",
- key, def->name, ch);
- debug(82, 4) ("externalAclLookup: using cached entry %p\n", entry);
+ debugs(82, 4, "externalAclLookup: no need to wait for the result of '" <<
+ key << "' in '" << def->name << "' (ch=" << ch << ").");
+ debugs(82, 4, "externalAclLookup: using cached entry " << entry);
if (entry != NULL) {
- debug(82,4) ("externalAclLookup: entry = { date=%lu, result=%d, user=%s tag=%s log=%s }\n",
- (long unsigned int) entry->date, entry->result, entry->user.buf(), entry->tag.buf(),
- entry->log.buf());
+ debugs(82, 4, "externalAclLookup: entry = { date=" <<
+ (long unsigned int) entry->date << ", result=" <<
+ entry->result << ", user=" << entry->user.buf() << " tag=" <<
+ entry->tag.buf() << " log=" << entry->log.buf() << " }");
+
}
callback(callback_data, entry);
return;
}
- debug(82, 4) ("externalAclLookup: will wait for the result of '%s' in '%s' (ch=%p).\n",
- key, def->name, ch);
+ debugs(82, 4, "externalAclLookup: will wait for the result of '" << key <<
+ "' in '" << def->name << "' (ch=" << ch << ").");
}
static void
/*
- * $Id: fd.cc,v 1.56 2007/04/06 15:39:06 serassio Exp $
+ * $Id: fd.cc,v 1.57 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 51 Filedescriptor Functions
* AUTHOR: Duane Wessels
assert(F->write_handler == NULL);
}
- debug(51, 3) ("fd_close FD %d %s\n", fd, F->desc);
+ debugs(51, 3, "fd_close FD " << fd << " " << F->desc);
commSetSelect(fd, COMM_SELECT_READ, NULL, NULL, 0);
commSetSelect(fd, COMM_SELECT_WRITE, NULL, NULL, 0);
F->flags.open = 0;
F = &fd_table[fd];
if (F->flags.open) {
- debug(51, 1) ("WARNING: Closing open FD %4d\n", fd);
+ debugs(51, 1, "WARNING: Closing open FD " << std::setw(4) << fd);
fd_close(fd);
}
assert(!F->flags.open);
- debug(51, 3) ("fd_open FD %d %s\n", fd, desc);
+ debugs(51, 3, "fd_open FD " << fd << " " << desc);
F->type = type;
F->flags.open = 1;
F->epoll_state = 0;
if (i == fileno(debug_log))
continue;
- debug(51, 1) ("Open FD %-10s %4d %s\n",
- F->bytes_read && F->bytes_written ? "READ/WRITE" :
- F->bytes_read ? "READING" :
- F->bytes_written ? "WRITING" : null_string,
- i, F->desc);
+ debugs(51, 1, "Open FD "<< std::left<< std::setw(10) <<
+ (F->bytes_read && F->bytes_written ? "READ/WRITE" :
+ F->bytes_read ? "READING" : F->bytes_written ? "WRITING" :
+ null_string) <<
+ " "<< std::right << std::setw(4) << i << " " << F->desc);
}
}
if (newReserve > x) {
/* perhaps this should be fatal()? -DW */
- debug(51, 0) ("WARNING: This machine has a serious shortage of filedescriptors.\n");
+ debugs(51, 0, "WARNING: This machine has a serious shortage of filedescriptors.");
newReserve = x;
}
- debug(51, 0) ("Reserved FD adjusted from %d to %d due to failures\n",
- RESERVED_FD, newReserve);
+ debugs(51, 0, "Reserved FD adjusted from " << RESERVED_FD << " to " << newReserve << " due to failures");
RESERVED_FD = newReserve;
}
/*
- * $Id: filemap.cc,v 1.42 2003/02/21 22:50:08 robertc Exp $
+ * $Id: filemap.cc,v 1.43 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 8 Swap File Bitmap
* AUTHOR: Harvest Derived
fileMap *fm = (fileMap *)xcalloc(1, sizeof(fileMap));
fm->max_n_files = FM_INITIAL_NUMBER;
fm->nwords = fm->max_n_files >> LONG_BIT_SHIFT;
- debug(8, 3) ("file_map_create: creating space for %d files\n", fm->max_n_files);
- debug(8, 5) ("--> %d words of %d bytes each\n",
- fm->nwords, (int) sizeof(*fm->file_map));
+ debugs(8, 3, "file_map_create: creating space for " << fm->max_n_files << " files");
+ debugs(8, 5, "--> " << fm->nwords << " words of " << (int) sizeof(*fm->file_map) << " bytes each");
fm->file_map = (unsigned long *)xcalloc(fm->nwords, sizeof(*fm->file_map));
/* XXX account fm->file_map */
return fm;
fm->max_n_files <<= 1;
assert(fm->max_n_files <= (1 << 24)); /* swap_filen is 25 bits, signed */
fm->nwords = fm->max_n_files >> LONG_BIT_SHIFT;
- debug(8, 3) ("file_map_grow: creating space for %d files\n", fm->max_n_files);
+ debugs(8, 3, "file_map_grow: creating space for " << fm->max_n_files << " files");
fm->file_map = (unsigned long *)xcalloc(fm->nwords, sizeof(*fm->file_map));
- debug(8, 3) ("copying %d old bytes\n", old_sz);
+ debugs(8, 3, "copying " << old_sz << " old bytes");
xmemcpy(fm->file_map, old_map, old_sz);
xfree(old_map);
/* XXX account fm->file_map */
}
}
- debug(8, 3) ("growing from file_map_allocate\n");
+ debugs(8, 3, "growing from file_map_allocate");
file_map_grow(fm);
return file_map_allocate(fm, fm->max_n_files >> 1);
}
/*
- * $Id: forward.cc,v 1.160 2007/04/21 07:14:14 wessels Exp $
+ * $Id: forward.cc,v 1.161 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 17 Request Forwarding
* AUTHOR: Duane Wessels
if (fd > -1) {
server_fd = -1;
comm_remove_close_handler(fd, fwdServerClosedWrapper, this);
- debug(17, 3) ("fwdStateFree: closing FD %d\n", fd);
+ debugs(17, 3, "fwdStateFree: closing FD " << fd);
comm_close(fd);
}
}
}
- debug(17, 3) ("FwdState::start() '%s'\n", entry->url());
+ debugs(17, 3, "FwdState::start() '" << entry->url() << "'");
/*
* This seems like an odd place to bind mem_obj and request.
* Might want to assert that request is NULL at this point
void
FwdState::fail(ErrorState * errorState)
{
- debug(17, 3) ("fwdFail: %s \"%s\"\n\t%s\n",
- err_type_str[errorState->type],
- httpStatusString(errorState->httpStatus),
- entry->url());
+ debugs(17, 3, "fwdFail: " << err_type_str[errorState->type] << " \"" << httpStatusString(errorState->httpStatus) << "\"\n\t" << entry->url() );
if (err)
errorStateFree(err);
void
FwdState::unregister(int fd)
{
- debug(17, 3) ("fwdUnregister: %s\n", entry->url());
+ debugs(17, 3, "fwdUnregister: " << entry->url() );
assert(fd == server_fd);
assert(fd > -1);
comm_remove_close_handler(fd, fwdServerClosedWrapper, this);
{
StoreEntry *e = entry;
assert(entry->store_status == STORE_PENDING);
- debug(17, 3) ("fwdComplete: %s\n\tstatus %d\n", e->url(),
- entry->getReply()->sline.status);
+ debugs(17, 3, "fwdComplete: " << e->url() << "\n\tstatus " << entry->getReply()->sline.status );
#if URL_CHECKSUM_DEBUG
entry->mem_obj->checkUrlChecksum();
logReplyStatus(n_tries, entry->getReply()->sline.status);
if (reforward()) {
- debug(17, 3) ("fwdComplete: re-forwarding %d %s\n",
- entry->getReply()->sline.status,
- e->url());
+ debugs(17, 3, "fwdComplete: re-forwarding " << entry->getReply()->sline.status << " " << e->url());
if (server_fd > -1)
unregister(server_fd);
startComplete(servers);
} else {
- debug(17, 3) ("fwdComplete: not re-forwarding status %d\n",
- entry->getReply()->sline.status);
+ debugs(17, 3, "fwdComplete: not re-forwarding status " << entry->getReply()->sline.status);
EBIT_CLR(entry->flags, ENTRY_FWD_HDR_WAIT);
entry->complete();
void
FwdState::serverClosed(int fd)
{
- debug(17, 2) ("fwdServerClosed: FD %d %s\n", fd, entry->url());
+ debugs(17, 2, "fwdServerClosed: FD " << fd << " " << entry->url());
assert(server_fd == fd);
server_fd = -1;
if (checkRetry()) {
int originserver = (servers->_peer == NULL);
- debug(17, 3) ("fwdServerClosed: re-forwarding (%d tries, %d secs)\n",
- n_tries,
- (int) (squid_curtime - start_t));
+ debugs(17, 3, "fwdServerClosed: re-forwarding (" << n_tries << " tries, " << (int) (squid_curtime - start_t) << " secs)");
if (servers->next) {
/* use next, or cycle if origin server isn't last */
return;
default:
- debug(81, 1) ("fwdNegotiateSSL: Error negotiating SSL connection on FD %d: %s (%d/%d/%d)\n", fd, ERR_error_string(ERR_get_error(), NULL), ssl_error, ret, errno);
+ debugs(81, 1, "fwdNegotiateSSL: Error negotiating SSL connection on FD " << fd <<
+ ": " << ERR_error_string(ERR_get_error(), NULL) << " (" << ssl_error <<
+ "/" << ret << "/" << errno << ")");
ErrorState *anErr = errorCon(ERR_CONNECT_FAIL, HTTP_SERVICE_UNAVAILABLE, request);
#ifdef EPROTO
assert(sslContext);
if ((ssl = SSL_new(sslContext)) == NULL) {
- debug(83, 1) ("fwdInitiateSSL: Error allocating handle: %s\n",
- ERR_error_string(ERR_get_error(), NULL));
+ debugs(83, 1, "fwdInitiateSSL: Error allocating handle: " << ERR_error_string(ERR_get_error(), NULL) );
ErrorState *anErr = errorCon(ERR_SOCKET_FAILURE, HTTP_INTERNAL_SERVER_ERROR, request);
anErr->xerrno = errno;
fail(anErr);
if (NULL == fs->_peer)
flags.dont_retry = 1;
- debug(17, 4) ("fwdConnectDone: Unknown host: %s\n",
- request->host);
+ debugs(17, 4, "fwdConnectDone: Unknown host: " << request->host);
ErrorState *anErr = errorCon(ERR_DNS_FAIL, HTTP_SERVICE_UNAVAILABLE, request);
comm_close(server_fd);
} else {
- debug(17, 3) ("fwdConnectDone: FD %d: '%s'\n", server_fd, entry->url());
+ debugs(17, 3, "fwdConnectDone: FD " << server_fd << ": '" << entry->url() << "'" );
if (fs->_peer)
peerConnectSucceded(fs->_peer);
{
FwdServer *fs = servers;
- debug(17, 2) ("fwdConnectTimeout: FD %d: '%s'\n", fd, entry->url());
+ debugs(17, 2, "fwdConnectTimeout: FD " << fd << ": '" << entry->url() << "'" );
assert(fd == server_fd);
if (Config.onoff.log_ip_on_direct && fs->code == HIER_DIRECT && fd_table[fd].ipaddr[0])
struct IN_ADDR *client_addr = NULL;
assert(fs);
assert(server_fd == -1);
- debug(17, 3) ("fwdConnectStart: %s\n", url);
+ debugs(17, 3, "fwdConnectStart: " << url);
if (fs->_peer) {
host = fs->_peer->host;
if ((fd = fwdPconnPool->pop(host, port, domain, client_addr)) >= 0) {
if (checkRetriable()) {
- debug(17, 3) ("fwdConnectStart: reusing pconn FD %d\n", fd);
+ debugs(17, 3, "fwdConnectStart: reusing pconn FD " << fd);
server_fd = fd;
n_tries++;
tos = getOutgoingTOS(request);
- debug(17, 3) ("fwdConnectStart: got addr %s, tos %d\n",
- inet_ntoa(outgoing), tos);
+ debugs(17, 3, "fwdConnectStart: got addr " << inet_ntoa(outgoing) << ", tos " << tos);
fd = comm_openex(SOCK_STREAM,
IPPROTO_TCP,
url);
if (fd < 0) {
- debug(50, 4) ("fwdConnectStart: %s\n", xstrerror());
+ debugs(50, 4, "fwdConnectStart: " << xstrerror());
ErrorState *anErr = errorCon(ERR_SOCKET_FAILURE, HTTP_INTERNAL_SERVER_ERROR, request);
anErr->xerrno = errno;
fail(anErr);
itp.op = TPROXY_ASSIGN;
if (setsockopt(fd, SOL_IP, IP_TPROXY, &itp, sizeof(itp)) == -1) {
- debug(20, 1) ("tproxy ip=%s,0x%x,port=%d ERROR ASSIGN\n",
- inet_ntoa(itp.v.addr.faddr),
- itp.v.addr.faddr.s_addr,
- itp.v.addr.fport);
+ debugs(20, 1, "tproxy ip=" << inet_ntoa(itp.v.addr.faddr) <<
+ ",0x" << hex << itp.v.addr.faddr.s_addr << dec <<
+ ",port=" << itp.v.addr.fport << " ERROR ASSIGN");
+
request->flags.tproxy = 0;
} else {
itp.op = TPROXY_FLAGS;
itp.v.flags = ITP_CONNECT;
if (setsockopt(fd, SOL_IP, IP_TPROXY, &itp, sizeof(itp)) == -1) {
- debug(20, 1) ("tproxy ip=%x,port=%d ERROR CONNECT\n",
- itp.v.addr.faddr.s_addr,
- itp.v.addr.fport);
+ debugs(20, 1, "tproxy ip=" << hex <<
+ itp.v.addr.faddr.s_addr << dec << ",port=" <<
+ itp.v.addr.fport << " ERROR CONNECT");
+
request->flags.tproxy = 0;
}
}
void
FwdState::startComplete(FwdServer * theServers)
{
- debug(17, 3) ("fwdStartComplete: %s\n", entry->url());
+ debugs(17, 3, "fwdStartComplete: " << entry->url() );
if (theServers != NULL) {
servers = theServers;
void
FwdState::startFail()
{
- debug(17, 3) ("fwdStartFail: %s\n", entry->url());
+ debugs(17, 3, "fwdStartFail: " << entry->url() );
ErrorState *anErr = errorCon(ERR_CANNOT_FORWARD, HTTP_SERVICE_UNAVAILABLE, request);
anErr->xerrno = errno;
fail(anErr);
FwdState::dispatch()
{
peer *p = NULL;
- debug(17, 3) ("fwdDispatch: FD %d: Fetching '%s %s'\n",
- client_fd,
- RequestMethodStr[request->method],
- entry->url());
+ debugs(17, 3, "fwdDispatch: FD " << client_fd << ": Fetching '" << RequestMethodStr[request->method] << " " << entry->url() << "'" );
/*
* Assert that server_fd is set. This is to guarantee that fwdState
* is attached to something and will be deallocated when server_fd
case PROTO_WAIS: /* Not implemented */
default:
- debug(17, 1) ("fwdDispatch: Cannot retrieve '%s'\n",
- entry->url());
+ debugs(17, 1, "fwdDispatch: Cannot retrieve '" << entry->url() << "'" );
ErrorState *anErr = errorCon(ERR_UNSUP_REQ, HTTP_BAD_REQUEST, request);
fail(anErr);
/*
e->mem_obj->checkUrlChecksum();
#endif
- debug(17, 3) ("fwdReforward: %s?\n", e->url());
+ debugs(17, 3, "fwdReforward: " << e->url() << "?" );
if (!EBIT_TEST(e->flags, ENTRY_FWD_HDR_WAIT)) {
- debug(17, 3) ("fwdReforward: No, ENTRY_FWD_HDR_WAIT isn't set\n");
+ debugs(17, 3, "fwdReforward: No, ENTRY_FWD_HDR_WAIT isn't set");
return 0;
}
fwdServerFree(fs);
if (servers == NULL) {
- debug(17, 3) ("fwdReforward: No forward-servers left\n");
+ debugs(17, 3, "fwdReforward: No forward-servers left");
return 0;
}
s = e->getReply()->sline.status;
- debug(17, 3) ("fwdReforward: status %d\n", (int) s);
+ debugs(17, 3, "fwdReforward: status " << (int) s);
return reforwardableStatus(s);
}
/*
- * $Id: fqdncache.cc,v 1.170 2006/08/21 00:50:41 robertc Exp $
+ * $Id: fqdncache.cc,v 1.171 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 35 FQDN Cache
* AUTHOR: Harvest Derived
for (k = 0; k < (int) f->name_count; k++)
safe_free(f->names[k]);
- debug(35, 5) ("fqdncacheRelease: Released FQDN record for '%s'.\n",
- hashKeyStr(&f->hash));
+ debugs(35, 5, "fqdncacheRelease: Released FQDN record for '" << hashKeyStr(&f->hash) << "'.");
dlinkDelete(&f->lru, &lru_list);
removed++;
}
- debug(35, 9) ("fqdncache_purgelru: removed %d entries\n", removed);
+ debugs(35, 9, "fqdncache_purgelru: removed " << removed << " entries");
}
static void
f->flags.negcached = 1;
if (inbuf == NULL) {
- debug(35, 1) ("fqdncacheParse: Got <NULL> reply in response to '%s'\n", name);
+ debugs(35, 1, "fqdncacheParse: Got <NULL> reply in response to '" << name << "'");
f->error_message = xstrdup("Internal Error");
return -1;
}
xstrncpy(buf, inbuf, DNS_INBUF_SZ);
- debug(35, 5) ("fqdncacheParse: parsing: {%s}\n", buf);
+ debugs(35, 5, "fqdncacheParse: parsing: {" << buf << "}");
token = strtok(buf, w_space);
if (NULL == token) {
- debug(35, 1) ("fqdncacheParse: Got <NULL>, expecting '$name' in response to '%s'\n", name);
+ debugs(35, 1, "fqdncacheParse: Got <NULL>, expecting '$name' in response to '" << name << "'");
f->error_message = xstrdup("Internal Error");
return -1;
}
}
if (0 != strcmp(token, "$name")) {
- debug(35, 1) ("fqdncacheParse: Got '%s', expecting '$name' in response to '%s'\n", inbuf, name);
+ debugs(35, 1, "fqdncacheParse: Got '" << inbuf << "', expecting '$name' in response to '" << name << "'");
f->error_message = xstrdup("Internal Error");
return -1;
}
token = strtok(NULL, w_space);
if (NULL == token) {
- debug(35, 1) ("fqdncacheParse: Got '%s', expecting TTL in response to '%s'\n", inbuf, name);
+ debugs(35, 1, "fqdncacheParse: Got '" << inbuf << "', expecting TTL in response to '" << name << "'");
f->error_message = xstrdup("Internal Error");
return -1;
}
token = strtok(NULL, w_space);
if (NULL == token) {
- debug(35, 1) ("fqdncacheParse: Got '%s', expecting hostname in response to '%s'\n", inbuf, name);
+ debugs(35, 1, "fqdncacheParse: Got '" << inbuf << "', expecting hostname in response to '" << name << "'");
f->error_message = xstrdup("Internal Error");
return -1;
}
f->flags.negcached = 1;
if (nr < 0) {
- debug(35, 3) ("fqdncacheParse: Lookup of '%s' failed (%s)\n", name, error_message);
+ debugs(35, 3, "fqdncacheParse: Lookup of '" << name << "' failed (" << error_message << ")");
f->error_message = xstrdup(error_message);
return -1;
}
if (nr == 0) {
- debug(35, 3) ("fqdncacheParse: No DNS records for '%s'\n", name);
+ debugs(35, 3, "fqdncacheParse: No DNS records for '" << name << "'");
f->error_message = xstrdup("No DNS records");
return 0;
}
- debug(35, 3) ("fqdncacheParse: %d answers for '%s'\n", nr, name);
+ debugs(35, 3, "fqdncacheParse: " << nr << " answers for '" << name << "'");
assert(answers);
for (k = 0; k < nr; k++) {
if (answers[k].type == RFC1035_TYPE_PTR) {
if (!answers[k].rdata[0]) {
- debug(35, 2) ("fqdncacheParse: blank PTR record for '%s'\n", name);
+ debugs(35, 2, "fqdncacheParse: blank PTR record for '" << name << "'");
continue;
}
if (strchr(answers[k].rdata, ' ')) {
- debug(35, 2) ("fqdncacheParse: invalid PTR record '%s' for '%s'\n", answers[k].rdata, name);
+ debugs(35, 2, "fqdncacheParse: invalid PTR record '" << answers[k].rdata << "' for '" << name << "'");
continue;
}
}
if (f->name_count == 0) {
- debug(35, 1) ("fqdncacheParse: No PTR record for '%s'\n", name);
+ debugs(35, 1, "fqdncacheParse: No PTR record for '" << name << "'");
return 0;
}
char *name = inet_ntoa(addr);
generic_cbdata *c;
assert(handler);
- debug(35, 4) ("fqdncache_nbgethostbyaddr: Name '%s'.\n", name);
+ debugs(35, 4, "fqdncache_nbgethostbyaddr: Name '" << name << "'.");
FqdncacheStats.requests++;
if (name == NULL || name[0] == '\0')
{
- debug(35, 4) ("fqdncache_nbgethostbyaddr: Invalid name!\n");
+ debugs(35, 4, "fqdncache_nbgethostbyaddr: Invalid name!");
dns_error_message = "Invalid hostname";
handler(NULL, handlerData);
return;
} else
{
/* hit */
- debug(35, 4) ("fqdncache_nbgethostbyaddr: HIT for '%s'\n", name);
+ debugs(35, 4, "fqdncache_nbgethostbyaddr: HIT for '" << name << "'");
if (f->flags.negcached)
FqdncacheStats.negative_hits++;
return;
}
- debug(35, 5) ("fqdncache_nbgethostbyaddr: MISS for '%s'\n", name);
+ debugs(35, 5, "fqdncache_nbgethostbyaddr: MISS for '" << name << "'");
FqdncacheStats.misses++;
f = fqdncacheCreateEntry(name);
f->handler = handler;
if (fqdn_table)
return;
- debug(35, 3) ("Initializing FQDN Cache...\n");
+ debugs(35, 3, "Initializing FQDN Cache...");
memset(&FqdncacheStats, '\0', sizeof(FqdncacheStats));
if (1 == fce->flags.fromhosts) {
fqdncacheUnlockEntry(fce);
} else if (fce->locks > 0) {
- debug(35, 1) ("fqdncacheAddEntryFromHosts: can't add static entry for locked address '%s'\n", addr);
+ debugs(35, 1, "fqdncacheAddEntryFromHosts: can't add static entry for locked address '" << addr << "'");
return;
} else {
fqdncacheRelease(fce);
snmp_netFqdnFn(variable_list * Var, snint * ErrP)
{
variable_list *Answer = NULL;
- debug(49, 5) ("snmp_netFqdnFn: Processing request:\n");
+ debugs(49, 5, "snmp_netFqdnFn: Processing request:");
snmpDebugOid(5, Var->name, Var->name_length);
*ErrP = SNMP_ERR_NOERROR;
/*
- * $Id: store_dir_coss.cc,v 1.71 2007/04/21 13:21:58 wessels Exp $
+ * $Id: store_dir_coss.cc,v 1.72 2007/04/28 22:26:50 hno Exp $
* vim: set et :
*
* DEBUG: section 47 Store COSS Directory Routines
swaplog_fd = file_open(logPath, O_WRONLY | O_CREAT | O_BINARY);
if (swaplog_fd < 0) {
- debug(47, 1) ("%s: %s\n", logPath, xstrerror());
+ debugs(47, 1, "" << logPath << ": " << xstrerror());
fatal("storeCossDirOpenSwapLog: Failed to open swap log.");
}
- debug(47, 3) ("Cache COSS Dir #%d log opened on FD %d\n", index, swaplog_fd);
+ debugs(47, 3, "Cache COSS Dir #" << index << " log opened on FD " << swaplog_fd);
}
void
file_close(swaplog_fd);
- debug(47, 3) ("Cache COSS Dir #%d log closed on FD %d\n",
- index, swaplog_fd);
+ debugs(47, 3, "Cache COSS Dir #" << index << " log closed on FD " << swaplog_fd);
swaplog_fd = -1;
}
CossSwapDir::ioCompletedNotification()
{
if (theFile->error()) {
- debug(47, 1) ("%s: %s\n", path, xstrerror());
+ debugs(47, 1, "" << path << ": " << xstrerror());
fatal("storeCossDirInit: Failed to open a COSS file.");
}
}
CossState *cstate = dynamic_cast<CossState *>(sio.getRaw());
ssize_t rlen;
- debug(79, 3) ("storeCossReadDone: fileno %d, len %d\n",
- sio->swap_filen, len);
+ debugs(79, 3, "storeCossReadDone: fileno " << sio->swap_filen << ", len " << len);
cstate->flags.reading = 0;
if (errflag) {
if (errflag > 0) {
errno = errflag;
- debug(79, 1) ("storeCossReadDone: error: %s\n", xstrerror());
+ debugs(79, 1, "storeCossReadDone: error: " << xstrerror());
} else {
- debug(79, 1) ("storeCossReadDone: got failure (%d)\n", errflag);
+ debugs(79, 1, "storeCossReadDone: got failure (" << errflag << ")");
}
rlen = -1;
CossWrite* cossWrite= dynamic_cast<CossWrite *>(writeRequest.getRaw());
assert (cossWrite);
- debug(79, 3) ("storeCossWriteMemBufDone: buf %p, len %ld\n", cossWrite->membuf, (long int) len);
+ debugs(79, 3, "storeCossWriteMemBufDone: buf " << cossWrite->membuf << ", len " << (long int) len);
if (errflag) {
StoreFScoss::GetInstance().stats.stripe_write.fail++;
- debug(79, 1) ("storeCossWriteMemBufDone: got failure (%d)\n", errflag);
+ debugs(79, 1, "storeCossWriteMemBufDone: got failure (" << errflag << ")");
debugs(79, 1, "size=" << cossWrite->membuf->diskend - cossWrite->membuf->diskstart);
} else {
StoreFScoss::GetInstance().stats.stripe_write.success++;
for (int aCount = 0; aCount < rb->speed; aCount++) {
if (fread(&s, ss, 1, rb->log) != 1) {
- debug(47, 1) ("Done reading %s swaplog (%d entries)\n",
- rb->sd->path, rb->n_read);
+ debugs(47, 1, "Done reading " << rb->sd->path << " swaplog (" << rb->n_read << " entries)");
fclose(rb->log);
rb->log = NULL;
storeCossRebuildComplete(rb);
if (s.op >= SWAP_LOG_MAX)
continue;
- debug(47, 3) ("storeCossRebuildFromSwapLog: %s %s %08X\n",
- swap_log_op_str[(int) s.op],
- storeKeyText(s.key),
- s.swap_filen);
+ debugs(47, 3, "storeCossRebuildFromSwapLog: " <<
+ swap_log_op_str[(int) s.op] << " " << storeKeyText(s.key) <<
+ " "<< std::setfill('0') << std::hex << std::uppercase <<
+ std::setw(8) << s.swap_filen);
if (s.op == SWAP_LOG_ADD) {
(void) 0;
if (0.0 == x - (double)
(int) x)
- debug(47, 1) ("WARNING: %d invalid swap log entries found\n",
- rb->counts.bad_log_op);
+ debugs(47, 1, "WARNING: " << rb->counts.bad_log_op << " invalid swap log entries found");
rb->counts.invalid++;
int clean)
{
StoreEntry *e = NULL;
- debug(47, 5) ("storeCossAddDiskRestore: %s, fileno=%08X\n", storeKeyText(key), file_number);
+ debugs(47, 5, "storeCossAddDiskRestore: " << storeKeyText(key) <<
+ ", fileno="<< std::setfill('0') << std::hex << std::uppercase <<
+ std::setw(8) << file_number);
+
/* if you call this you'd better be sure file_number is not
* already in use! */
e = new StoreEntry();
* we'll use storeCossRebuildFromSwapLog().
*/
fp = storeCossDirOpenTmpSwapLog(sd, &clean, &zero);
- debug(47, 1) ("Rebuilding COSS storage in %s (%s)\n",
- sd->path, clean ? "CLEAN" : "DIRTY");
+ debugs(47, 1, "Rebuilding COSS storage in " << sd->path << " (" << (clean ? "CLEAN" : "DIRTY") << ")");
rb->log = fp;
StoreController::store_dirs_rebuilding++;
anfd = file_open(swaplog_path, O_WRONLY | O_CREAT | O_BINARY);
if (anfd < 0) {
- debug(50, 1) ("%s: %s\n", swaplog_path, xstrerror());
+ debugs(50, 1, "" << swaplog_path << ": " << xstrerror());
fatal("storeCossDirCloseTmpSwapLog: Failed to open swap log.");
}
safe_free(swaplog_path);
safe_free(new_path);
sd->swaplog_fd = anfd;
- debug(47, 3) ("Cache COSS Dir #%d log opened on FD %d\n", sd->index, anfd);
+ debugs(47, 3, "Cache COSS Dir #" << sd->index << " log opened on FD " << anfd);
}
static FILE *
int anfd;
if (::stat(swaplog_path, &log_sb) < 0) {
- debug(50, 1) ("Cache COSS Dir #%d: No log file\n", sd->index);
+ debugs(50, 1, "Cache COSS Dir #" << sd->index << ": No log file");
safe_free(swaplog_path);
safe_free(clean_path);
safe_free(new_path);
anfd = file_open(new_path, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY);
if (anfd < 0) {
- debug(50, 1) ("%s: %s\n", new_path, xstrerror());
+ debugs(50, 1, "" << new_path << ": " << xstrerror());
fatal("storeDirOpenTmpSwapLog: Failed to open swap log.");
}
fp = fopen(swaplog_path, "rb");
if (fp == NULL) {
- debug(50, 0) ("%s: %s\n", swaplog_path, xstrerror());
+ debugs(50, 0, "" << swaplog_path << ": " << xstrerror());
fatal("Failed to open swap log for reading");
}
state->outbuf_offset = 0;
::unlink(state->cln);
state->current = cossindex.tail;
- debug(50, 3) ("storeCOssDirWriteCleanLogs: opened %s, FD %d\n",
- state->newLog, state->fd);
+ debugs(50, 3, "storeCOssDirWriteCleanLogs: opened " << state->newLog << ", FD " << state->fd);
#if HAVE_FCHMOD
if (::stat(state->cur, &sb) == 0)
if (outbuf_offset + ss > CLEAN_BUF_SZ) {
if (FD_WRITE_METHOD(fd, outbuf, outbuf_offset) < 0) {
- debug(50, 0) ("storeCossDirWriteCleanLogs: %s: write: %s\n",
- newLog, xstrerror());
- debug(50, 0) ("storeCossDirWriteCleanLogs: Current swap logfile not replaced.\n");
+ debugs(50, 0, "storeCossDirWriteCleanLogs: " << newLog << ": write: " << xstrerror());
+ debugs(50, 0, "storeCossDirWriteCleanLogs: Current swap logfile not replaced.");
file_close(fd);
fd = -1;
unlink(newLog);
return;
if (FD_WRITE_METHOD(state->fd, state->outbuf, state->outbuf_offset) < 0) {
- debug(50, 0) ("storeCossDirWriteCleanLogs: %s: write: %s\n",
- state->newLog, xstrerror());
- debug(50, 0) ("storeCossDirWriteCleanLogs: Current swap logfile "
- "not replaced.\n");
+ debugs(50, 0, "storeCossDirWriteCleanLogs: " << state->newLog << ": write: " << xstrerror());
+ debugs(50, 0, "storeCossDirWriteCleanLogs: Current swap logfile not replaced.");
file_close(state->fd);
state->fd = -1;
::unlink(state->newLog);
max_offset = (unsigned long) 0xFFFFFF << blksz_bits;
if ((unsigned long)max_size > (unsigned long)(max_offset>>10)) {
- debug(47,0)("COSS block-size = %d bytes\n", 1<<blksz_bits);
+ debugs(47, 0, "COSS block-size = " << (1<<blksz_bits) << " bytes");
debugs(47,0, "COSS largest file offset = " << (max_offset >> 10) << " KB");
- debug(47,0)("COSS cache_dir size = %d KB\n", max_size);
+ debugs(47, 0, "COSS cache_dir size = " << max_size << " KB");
fatal("COSS cache_dir size exceeds largest offset\n");
}
}
fatal("storeCossDirParse: invalid size value");
if (size == (size_t)max_size)
- debug(3, 1) ("Cache COSS dir '%s' size remains unchanged at %d KB\n", path, size);
+ debugs(3, 1, "Cache COSS dir '" << path << "' size remains unchanged at " << size << " KB");
else {
- debug(3, 1) ("Cache COSS dir '%s' size changed to %d KB\n", path, size);
+ debugs(3, 1, "Cache COSS dir '" << path << "' size changed to " << size << " KB");
max_size = size;
}
return true;
if (reconfiguring) {
- debug(47, 0) ("WARNING: cannot change COSS block-size while"
- " Squid is running\n");
+ debugs(47, 0, "WARNING: cannot change COSS block-size while Squid is running");
return false;
}
/*
- * $Id: store_io_coss.cc,v 1.30 2007/04/18 23:38:04 wessels Exp $
+ * $Id: store_io_coss.cc,v 1.31 2007/04/28 22:26:51 hno Exp $
*
* DEBUG: section 79 Storage Manager COSS Interface
* AUTHOR: Eric Stern
current_membuf->diskend = current_offset;
current_membuf->maybeWrite(this);
current_offset = 0; /* wrap back to beginning */
- debug(79, 2) ("CossSwapDir::allocate: wrap to 0\n");
+ debugs(79, 2, "CossSwapDir::allocate: wrap to 0");
newmb = createMemBuf(0, checkf, &coll);
current_membuf = newmb;
current_membuf->flags.full = 1;
current_offset = current_membuf->diskend;
current_membuf->maybeWrite(this);
- debug(79, 2) ("CossSwapDir::allocate: New offset - %ld\n",
- (long int) current_offset);
+ debugs(79, 2, "CossSwapDir::allocate: New offset - " << (long int) current_offset);
newmb = createMemBuf(current_offset, checkf, &coll);
current_membuf = newmb;
}
return storeCossDiskOffsetToFileno(retofs);
} else {
StoreFScoss::GetInstance().stats.alloc.collisions++;
- debug(79, 3) ("CossSwapDir::allocate: Collision\n");
+ debugs(79, 3, "CossSwapDir::allocate: Collision");
return -1;
}
}
void
CossSwapDir::unlink(StoreEntry & e)
{
- debug(79, 3) ("storeCossUnlink: offset %d\n", e.swap_filen);
+ debugs(79, 3, "storeCossUnlink: offset " << e.swap_filen);
StoreFScoss::GetInstance().stats.unlink.ops++;
StoreFScoss::GetInstance().stats.unlink.success++;
storeCossRemove(this, &e);
cstate->st_size = e.objectLen() + e.mem_obj->swap_hdr_sz;
sio->swap_dirn = index;
sio->swap_filen = allocate(&e, COSS_ALLOC_ALLOCATE);
- debug(79, 3) ("storeCossCreate: offset %ld, size %ld, end %ld\n",
- (long int) storeCossFilenoToDiskOffset(sio->swap_filen),
- (long int) cstate->st_size,
- (long int) (sio->swap_filen + cstate->st_size));
+ debugs(79, 3, "storeCossCreate: offset " <<
+ (long int) storeCossFilenoToDiskOffset(sio->swap_filen) <<
+ ", size " << (long int) cstate->st_size << ", end " <<
+ (long int) (sio->swap_filen + cstate->st_size));
+
/* assume allocate() always succeeds */
assert(-1 != sio->swap_filen);
CossState *cstate;
sfileno f = e.swap_filen;
- debug(79, 3) ("storeCossOpen: offset %d\n", f);
+ debugs(79, 3, "storeCossOpen: offset " << f);
StoreFScoss::GetInstance().stats.open.ops++;
StoreIOState::Pointer sio = new CossState (this);
/* We have to clean up neatly .. */
StoreFScoss::GetInstance().stats.open.fail++;
numcollisions++;
- debug(79, 2) ("storeCossOpen: Reallocation of %d/%d failed\n", e.swap_dirn, e.swap_filen);
+ debugs(79, 2, "storeCossOpen: Reallocation of " << e.swap_dirn << "/" << e.swap_filen << " failed");
/* XXX XXX XXX Will squid call storeUnlink for this object? */
return NULL;
}
void
CossState::close()
{
- debug(79, 3) ("storeCossClose: offset %d\n", swap_filen);
+ debugs(79, 3, "storeCossClose: offset " << swap_filen);
StoreFScoss::GetInstance().stats.close.ops++;
StoreFScoss::GetInstance().stats.close.success++;
assert(read.callback_data == NULL);
read.callback = callback;
read.callback_data = cbdataReference(callback_data);
- debug(79, 3) ("storeCossRead: offset %ld\n", (long int) offset);
+ debugs(79, 3, "storeCossRead: offset " << (long int) offset);
offset_ = offset;
flags.reading = 1;
assert(e->mem_obj->object_sz != -1);
StoreFScoss::GetInstance().stats.write.ops++;
- debug(79, 3) ("storeCossWrite: offset %ld, len %lu\n", (long int) offset_, (unsigned long int) size);
+ debugs(79, 3, "storeCossWrite: offset " << (long int) offset_ << ", len " << (unsigned long int) size);
diskoffset = SD->storeCossFilenoToDiskOffset(swap_filen) + offset_;
CossSwapDir *SD = (CossSwapDir *)INDEXSD(swap_dirn);
dest = SD->storeCossMemPointerFromDiskOffset(diskoffset, &membuf);
{
STIOCB *callback = this->callback;
void *cbdata;
- debug(79, 3) ("CossState::doCallback: errflag=%d\n", errflag);
+ debugs(79, 3, "CossState::doCallback: errflag=" << errflag);
assert(NULL == locked_membuf);
xfree(readbuffer);
this->callback = NULL;
CossState::lockMemBuf()
{
CossMemBuf *t = SD->storeCossFilenoToMembuf(swap_filen);
- debug(79, 3) ("CossState::lockMemBuf: locking %p, lockcount %d\n", t, t->lockcount);
+ debugs(79, 3, "CossState::lockMemBuf: locking " << t << ", lockcount " << t->lockcount);
locked_membuf = t;
++t->lockcount;
}
if (NULL == t)
return;
- debug(79, 3) ("storeCossMemBufUnlock: unlocking %p, lockcount %d\n", t, t->lockcount);
+ debugs(79, 3, "storeCossMemBufUnlock: unlocking " << t << ", lockcount " << t->lockcount);
t->lockcount--;
t = (CossMemBuf *)m->data;
if (t->flags.writing) {
- debug(79, 1) ("WARNING: sleeping for 5 seconds in storeCossSync()\n");
+ debugs(79, 1, "WARNING: sleeping for 5 seconds in storeCossSync()");
sleep(5); /* XXX EEEWWW! */
}
describe(3, __LINE__);
if (!flags.full)
- debug(79, 3) ("membuf %p not full\n", this);
+ debugs(79, 3, "membuf " << this << " not full");
else if (flags.writing)
- debug(79, 3) ("membuf %p writing\n", this);
+ debugs(79, 3, "membuf " << this << " writing");
else if (lockcount)
- debug(79, 3) ("membuf %p lockcount=%d\n", this, lockcount);
+ debugs(79, 3, "membuf " << this << " lockcount=" << lockcount);
else
write(SD);
}
CossMemBuf::write(CossSwapDir * SD)
{
StoreFScoss::GetInstance().stats.stripe_write.ops++;
- debug(79, 3) ("CossMemBuf::write: offset %ld, len %ld\n",
- (long int) diskstart, (long int) (diskend - diskstart));
+ debugs(79, 3, "CossMemBuf::write: offset " << (long int) diskstart << ", len " << (long int) (diskend - diskstart));
flags.writing = 1;
/* XXX Remember that diskstart/diskend are block offsets! */
SD->theFile->write(new CossWrite(WriteRequest((char const *)&buffer, diskstart, diskend - diskstart, NULL), this));
CBDATA_INIT_TYPE_FREECB(CossMemBuf, NULL);
newmb = cbdataAlloc(CossMemBuf);
newmb->diskstart = start;
- debug(79, 3) ("CossSwapDir::createMemBuf: creating new membuf at %ld\n", (long int) newmb->diskstart);
- debug(79, 3) ("CossSwapDir::createMemBuf: at %p\n", newmb);
+ debugs(79, 3, "CossSwapDir::createMemBuf: creating new membuf at " << (long int) newmb->diskstart);
+ debugs(79, 3, "CossSwapDir::createMemBuf: at " << newmb);
newmb->diskend = newmb->diskstart + COSS_MEMBUF_SZ;
newmb->flags.full = 0;
newmb->flags.writing = 0;
/* Print out the list of membufs */
- debug(79, 3) ("CossSwapDir::createMemBuf: membuflist:\n");
+ debugs(79, 3, "CossSwapDir::createMemBuf: membuflist:");
for (m = membufs.head; m; m = m->next) {
t = (CossMemBuf *)m->data;
}
if (numreleased > 0)
- debug(79, 3) ("CossSwapDir::createMemBuf: this allocation released %d storeEntries\n", numreleased);
+ debugs(79, 3, "CossSwapDir::createMemBuf: this allocation released " << numreleased << " storeEntries");
StoreFScoss::GetInstance().stats.stripes++;
void
CossMemBuf::describe(int level, int line)
{
- debug(79, level) ("membuf %p, LC:%02d, ST:%010lu, FL:%c%c\n",
- this,
- lockcount,
- (unsigned long) diskstart,
- flags.full ? 'F' : '.',
- flags.writing ? 'W' : '.');
+ debugs(79, level, "membuf " << this << ", LC:" << std::setfill('0') <<
+ std::setw(2) << lockcount << ", ST:" <<
+ std::setw(10) << (unsigned long) diskstart << ", FL:" <<
+ (flags.full ? 'F' : '.') << (flags.writing ? 'W' : '.'));
}
/*
- * $Id: store_dir_ufs.cc,v 1.80 2007/04/21 07:14:16 wessels Exp $
+ * $Id: store_dir_ufs.cc,v 1.81 2007/04/28 22:26:51 hno Exp $
*
* DEBUG: section 47 Store Directory Routines
* AUTHOR: Duane Wessels
/* just reconfigure it */
if (reconfiguring) {
if (size == max_size)
- debug(3, 2) ("Cache dir '%s' size remains unchanged at %d KB\n",
- path, size);
+ debugs(3, 2, "Cache dir '" << path << "' size remains unchanged at " << size << " KB");
else
- debug(3, 1) ("Cache dir '%s' size changed to %d KB\n",
- path, size);
+ debugs(3, 1, "Cache dir '" << path << "' size changed to " << size << " KB");
}
max_size = size;
void
UFSSwapDir::dumpEntry(StoreEntry &e) const
{
- debug(47, 0) ("UFSSwapDir::dumpEntry: FILENO %08X\n", e.swap_filen);
- debug(47, 0) ("UFSSwapDir::dumpEntry: PATH %s\n",
- fullPath(e.swap_filen, NULL));
+ debugs(47, 0, "UFSSwapDir::dumpEntry: FILENO "<< std::setfill('0') << std::hex << std::uppercase << std::setw(8) << e.swap_filen);
+ debugs(47, 0, "UFSSwapDir::dumpEntry: PATH " << fullPath(e.swap_filen, NULL) );
e.dump(0);
}
struct stat sb;
if (::stat(fullPath(e.swap_filen, NULL), &sb) < 0) {
- debug(47, 0) ("UFSSwapDir::doubleCheck: MISSING SWAP FILE\n");
+ debugs(47, 0, "UFSSwapDir::doubleCheck: MISSING SWAP FILE");
dumpEntry(e);
return true;
}
if ((off_t)e.swap_file_sz != sb.st_size) {
- debug(47, 0) ("UFSSwapDir::doubleCheck: SIZE MISMATCH\n");
- debug(47, 0) ("UFSSwapDir::doubleCheck: ENTRY SIZE: %ld, FILE SIZE: %ld\n",
- (long int) e.swap_file_sz, (long int) sb.st_size);
+ debugs(47, 0, "UFSSwapDir::doubleCheck: SIZE MISMATCH");
+ debugs(47, 0, "UFSSwapDir::doubleCheck: ENTRY SIZE: " << (long int) e.swap_file_sz << ", FILE SIZE: " << (long int) sb.st_size);
dumpEntry(e);
return true;
}
* This is kinda cheap, but so we need this priority hack?
*/
- debug(47, 3) ("storeMaintainSwapSpace: f=%f, max_scan=%d, max_remove=%d\n",
- f, max_scan, max_remove);
+ debugs(47, 3, "storeMaintainSwapSpace: f=" << f << ", max_scan=" << max_scan << ", max_remove=" << max_remove );
walker = repl->PurgeInit(repl, max_scan);
}
walker->Done(walker);
- debug(47, (removed ? 2 : 3)) ("UFSSwapDir::maintain: %s removed %d/%d f=%.03f max_scan=%d\n",
- path, removed, max_remove, f, max_scan);
+ debugs(47, (removed ? 2 : 3), "UFSSwapDir::maintain: " << path <<
+ " removed " << removed << "/" << max_remove << " f=" <<
+ std::setprecision(4) << f << " max_scan=" << max_scan);
}
/*
void
UFSSwapDir::reference(StoreEntry &e)
{
- debug(47, 3) ("UFSSwapDir::reference: referencing %p %d/%d\n", &e, e.swap_dirn,
- e.swap_filen);
+ debugs(47, 3, "UFSSwapDir::reference: referencing " << &e << " " << e.swap_dirn << "/" << e.swap_filen);
if (repl->Referenced)
repl->Referenced(repl, &e, &e.repl);
void
UFSSwapDir::dereference(StoreEntry & e)
{
- debug(47, 3) ("UFSSwapDir::dereference: referencing %p %d/%d\n", &e, e.swap_dirn,
- e.swap_filen);
+ debugs(47, 3, "UFSSwapDir::dereference: referencing " << &e << " " << e.swap_dirn << "/" << e.swap_filen);
if (repl->Dereferenced)
repl->Dereferenced(repl, &e, &e.repl);
if (0 == ::stat(path, &st)) {
if (S_ISDIR(st.st_mode)) {
- debug(47, should_exist ? 3 : 1) ("%s exists\n", path);
+ debugs(47, should_exist ? 3 : 1, path << " exists");
} else {
fatalf("Swap directory %s is not a directory.", path);
}
} else if (0 == mkdir(path, 0755)) {
#endif
- debug(47, should_exist ? 1 : 3) ("%s created\n", path);
+ debugs(47, should_exist ? 1 : 3, path << " created");
created = 1;
} else {
fatalf("Failed to make swap directory %s: %s",
struct stat sb;
if (::stat(path, &sb) < 0) {
- debug(47, 0) ("%s: %s\n", path, xstrerror());
+ debugs(47, 0, "" << path << ": " << xstrerror());
return false;
}
if (S_ISDIR(sb.st_mode) == 0) {
- debug(47, 0) ("%s is not a directory\n", path);
+ debugs(47, 0, "" << path << " is not a directory");
return false;
}
else
should_exist = 1;
- debug(47, 1) ("Making directories in %s\n", name);
+ debugs(47, 1, "Making directories in " << name);
for (int k = 0; k < l2; k++) {
snprintf(name, MAXPATHLEN, "%s/%02X/%02X", path, i, k);
swaplog_fd = file_open(logPath, O_WRONLY | O_CREAT | O_BINARY);
if (swaplog_fd < 0) {
- debug(50, 1) ("%s: %s\n", logPath, xstrerror());
+ debugs(50, 1, "" << logPath << ": " << xstrerror());
fatal("commonUfsDirOpenSwapLog: Failed to open swap log.");
}
- debug(50, 3) ("Cache Dir #%d log opened on FD %d\n", index, swaplog_fd);
+ debugs(50, 3, "Cache Dir #" << index << " log opened on FD " << swaplog_fd);
if (0 == NumberOfUFSDirs)
assert(NULL == UFSDirToGlobalDirMapping);
file_close(swaplog_fd);
- debug(47, 3) ("Cache Dir #%d log closed on FD %d\n",
- index, swaplog_fd);
+ debugs(47, 3, "Cache Dir #" << index << " log closed on FD " << swaplog_fd);
swaplog_fd = -1;
int clean)
{
StoreEntry *e = NULL;
- debug(47, 5) ("commonUfsAddDiskRestore: %s, fileno=%08X\n", storeKeyText(key), file_number);
+ debugs(47, 5, "commonUfsAddDiskRestore: " << storeKeyText(key) <<
+ ", fileno="<< std::setfill('0') << std::hex << std::uppercase << std::setw(8) << file_number);
/* if you call this you'd better be sure file_number is not
* already in use! */
e = new StoreEntry();
fd = file_open(swaplog_path, O_WRONLY | O_CREAT | O_BINARY);
if (fd < 0) {
- debug(50, 1) ("%s: %s\n", swaplog_path, xstrerror());
+ debugs(50, 1, "" << swaplog_path << ": " << xstrerror());
fatal("commonUfsDirCloseTmpSwapLog: Failed to open swap log.");
}
safe_free(swaplog_path);
safe_free(new_path);
swaplog_fd = fd;
- debug(47, 3) ("Cache Dir #%d log opened on FD %d\n", index, fd);
+ debugs(47, 3, "Cache Dir #" << index << " log opened on FD " << fd);
}
FILE *
int fd;
if (::stat(swaplog_path, &log_sb) < 0) {
- debug(47, 1) ("Cache Dir #%d: No log file\n", index);
+ debugs(47, 1, "Cache Dir #" << index << ": No log file");
safe_free(swaplog_path);
safe_free(clean_path);
safe_free(new_path);
fd = file_open(new_path, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY);
if (fd < 0) {
- debug(50, 1) ("%s: %s\n", new_path, xstrerror());
+ debugs(50, 1, "" << new_path << ": " << xstrerror());
fatal("storeDirOpenTmpSwapLog: Failed to open swap log.");
}
fp = fopen(swaplog_path, "rb");
if (fp == NULL) {
- debug(50, 0) ("%s: %s\n", swaplog_path, xstrerror());
+ debugs(50, 0, "" << swaplog_path << ": " << xstrerror());
fatal("Failed to open swap log for reading");
}
state->outbuf_offset = 0;
state->walker = repl->WalkInit(repl);
::unlink(state->cln);
- debug(47, 3) ("storeDirWriteCleanLogs: opened %s, FD %d\n",
- state->newLog, state->fd);
+ debugs(47, 3, "storeDirWriteCleanLogs: opened " << state->newLog << ", FD " << state->fd);
#if HAVE_FCHMOD
if (::stat(state->cur, &sb) == 0)
if (outbuf_offset + ss >= CLEAN_BUF_SZ) {
if (FD_WRITE_METHOD(fd, outbuf, outbuf_offset) < 0) {
/* XXX This error handling should probably move up to the caller */
- debug(50, 0) ("storeDirWriteCleanLogs: %s: write: %s\n",
- newLog, xstrerror());
- debug(50, 0) ("storeDirWriteCleanLogs: Current swap logfile not replaced.\n");
+ debugs(50, 0, "storeDirWriteCleanLogs: " << newLog << ": write: " << xstrerror());
+ debugs(50, 0, "storeDirWriteCleanLogs: Current swap logfile not replaced.");
file_close(fd);
fd = -1;
unlink(newLog);
state->walker->Done(state->walker);
if (FD_WRITE_METHOD(state->fd, state->outbuf, state->outbuf_offset) < 0) {
- debug(50, 0) ("storeDirWriteCleanLogs: %s: write: %s\n",
- state->newLog, xstrerror());
- debug(50, 0) ("storeDirWriteCleanLogs: Current swap logfile "
- "not replaced.\n");
+ debugs(50, 0, "storeDirWriteCleanLogs: " << state->newLog << ": write: " << xstrerror());
+ debugs(50, 0, "storeDirWriteCleanLogs: Current swap logfile not replaced.");
file_close(state->fd);
state->fd = -1;
::unlink(state->newLog);
D2 = ((swap_index / N0) / N1) % N2;
snprintf(p1, SQUID_MAXPATHLEN, "%s/%02X/%02X",
SD->path, D1, D2);
- debug(36, 3) ("storeDirClean: Cleaning directory %s\n", p1);
+ debugs(36, 3, "storeDirClean: Cleaning directory " << p1);
dir_pointer = opendir(p1);
if (dir_pointer == NULL) {
if (errno == ENOENT) {
- debug(36, 0) ("storeDirClean: WARNING: Creating %s\n", p1);
+ debugs(36, 0, "storeDirClean: WARNING: Creating " << p1);
#ifdef _SQUID_MSWIN_
if (mkdir(p1) == 0)
return 0;
}
- debug(50, 0) ("storeDirClean: %s: %s\n", p1, xstrerror());
+ debugs(50, 0, "storeDirClean: " << p1 << ": " << xstrerror());
safeunlink(p1, 1);
return 0;
}
k = 10;
for (n = 0; n < k; n++) {
- debug(36, 3) ("storeDirClean: Cleaning file %08X\n", files[n]);
+ debugs(36, 3, "storeDirClean: Cleaning file "<< std::setfill('0') << std::hex << std::uppercase << std::setw(8) << files[n]);
snprintf(p2, MAXPATHLEN + 1, "%s/%08X", p1, files[n]);
safeunlink(p2, 0);
statCounter.swap.files_cleaned++;
}
- debug(36, 3) ("Cleaned %d unused files from %s\n", k, p1);
+ debugs(36, 3, "Cleaned " << k << " unused files from " << p1);
return k;
}
void
UFSSwapDir::unlinkFile(sfileno f)
{
- debug(79, 3) ("UFSSwapDir::unlinkFile: unlinking fileno %08X '%s'\n", f, fullPath(f,NULL));
+ debugs(79, 3, "UFSSwapDir::unlinkFile: unlinking fileno " << std::setfill('0') <<
+ std::hex << std::uppercase << std::setw(8) << f << " '" <<
+ fullPath(f,NULL) << "'");
/* commonUfsDirMapBitReset(this, f); */
IO->unlinkFile(fullPath(f,NULL));
}
void
UFSSwapDir::unlink(StoreEntry & e)
{
- debug(79, 3) ("storeUfsUnlink: dirno %d, fileno %08X\n", index, e.swap_filen);
+ debugs(79, 3, "storeUfsUnlink: dirno " << index << ", fileno "<<
+ std::setfill('0') << std::hex << std::uppercase << std::setw(8) << e.swap_filen);
replacementRemove(&e);
mapBitReset(e.swap_filen);
UFSSwapDir::unlinkFile(e.swap_filen);
void
UFSSwapDir::replacementAdd(StoreEntry * e)
{
- debug(47, 4) ("UFSSwapDir::replacementAdd: added node %p to dir %d\n", e,
- index);
+ debugs(47, 4, "UFSSwapDir::replacementAdd: added node " << e << " to dir " << index);
repl->Add(repl, e, &e->repl);
}
assert (dynamic_cast<UFSSwapDir *>(SD.getRaw()) == this);
- debug(47, 4) ("UFSSwapDir::replacementRemove: remove node %p from dir %d\n", e,
- index);
+ debugs(47, 4, "UFSSwapDir::replacementRemove: remove node " << e << " from dir " << index);
repl->Remove(repl, e, &e->repl);
}
/*
- * $Id: store_io_ufs.cc,v 1.36 2007/04/12 20:36:56 wessels Exp $
+ * $Id: store_io_ufs.cc,v 1.37 2007/04/28 22:26:51 hno Exp $
*
* DEBUG: section 79 Storage Manager UFS Interface
* AUTHOR: Duane Wessels
{
if (opening) {
opening = false;
- debug(79, 3) ("UFSStoreState::ioCompletedNotification: dirno %d, fileno %08x status %d\n",
- swap_dirn, swap_filen, theFile->error());
+ debugs(79, 3, "UFSStoreState::ioCompletedNotification: dirno " <<
+ swap_dirn << ", fileno "<< std::setfill('0') << std::hex <<
+ std::setw(8) << swap_filen << " status "<< std::setfill(' ') <<
+ std::dec << theFile->error());
+
assert (FILE_MODE(mode) == O_RDONLY);
openDone();
if (creating) {
creating = false;
- debug(79, 3) ("UFSStoreState::ioCompletedNotification: dirno %d, fileno %08x status %d\n",
- swap_dirn, swap_filen, theFile->error());
+ debugs(79, 3, "UFSStoreState::ioCompletedNotification: dirno " <<
+ swap_dirn << ", fileno "<< std::setfill('0') << std::hex <<
+ std::setw(8) << swap_filen << " status "<< std::setfill(' ') <<
+ std::dec << theFile->error());
+
openDone();
return;
}
assert (!(closing ||opening));
- debug(79, 3) ("diskd::ioCompleted: dirno %d, fileno %08x status %d\n", swap_dirn, swap_filen, theFile->error());
+ debugs(79, 3, "diskd::ioCompleted: dirno " << swap_dirn << ", fileno "<<
+ std::setfill('0') << std::hex << std::setw(8) << swap_filen <<
+ " status "<< std::setfill(' ') << std::dec << theFile->error());
+
/* Ok, notification past open means an error has occured */
assert (theFile->error());
tryClosing();
if (flags.try_closing)
tryClosing();
- debug(79, 3) ("UFSStoreState::openDone: exiting\n");
+ debugs(79, 3, "UFSStoreState::openDone: exiting");
}
void
UFSStoreState::closeCompleted()
{
assert (closing);
- debug(79, 3) ("UFSStoreState::closeCompleted: dirno %d, fileno %08x status %d\n",
- swap_dirn, swap_filen, theFile->error());
+ debugs(79, 3, "UFSStoreState::closeCompleted: dirno " << swap_dirn <<
+ ", fileno "<< std::setfill('0') << std::hex << std::setw(8) <<
+ swap_filen << " status "<< std::setfill(' ') << std::dec <<
+ theFile->error());
if (theFile->error()) {
debugs(79,3,HERE<< "theFile->error() ret " << theFile->error());
void
UFSStoreState::close()
{
- debug(79, 3) ("UFSStoreState::close: dirno %d, fileno %08X\n", swap_dirn,
- swap_filen);
+ debugs(79, 3, "UFSStoreState::close: dirno " << swap_dirn << ", fileno "<<
+ std::setfill('0') << std::hex << std::uppercase << std::setw(8) << swap_filen);
tryClosing();
}
assert (callback);
if (!theFile->canRead()) {
- debug(79, 3) ("UFSStoreState::read_: queueing read because theFile can't read\n");
+ debugs(79, 3, "UFSStoreState::read_: queueing read because theFile can't read");
queueRead (buf, size, offset, callback, callback_data);
return;
}
read.callback = callback;
read.callback_data = cbdataReference(callback_data);
- debug(79, 3) ("UFSStoreState::read_: dirno %d, fileno %08X\n",
- swap_dirn, swap_filen);
+ debugs(79, 3, "UFSStoreState::read_: dirno " << swap_dirn << ", fileno "<<
+ std::setfill('0') << std::hex << std::uppercase << std::setw(8) << swap_filen);
offset_ = offset;
read_buf = buf;
reading = true;
void
UFSStoreState::write(char const *buf, size_t size, off_t offset, FREE * free_func)
{
- debug(79, 3) ("UFSStoreState::write: dirn %d, fileno %08X\n", swap_dirn, swap_filen);
+ debugs(79, 3, "UFSStoreState::write: dirn " << swap_dirn << ", fileno "<<
+ std::setfill('0') << std::hex << std::uppercase << std::setw(8) << swap_filen);
if (theFile->error()) {
debugs(79,1,HERE << "avoid write on theFile with error");
{
assert (result.getRaw());
reading = false;
- debug(79, 3) ("UFSStoreState::readCompleted: dirno %d, fileno %08x len %d\n",
- swap_dirn, swap_filen, len);
+ debugs(79, 3, "UFSStoreState::readCompleted: dirno " << swap_dirn <<
+ ", fileno "<< std::setfill('0') << std::hex << std::setw(8) <<
+ swap_filen << " len "<< std::setfill(' ') << std::dec << len);
if (len > 0)
offset_ += len;
void
UFSStoreState::writeCompleted(int errflag, size_t len, RefCount<WriteRequest> writeRequest)
{
- debug(79, 3) ("UFSStoreState::writeCompleted: dirno %d, fileno %08X, len %ld\n",
- swap_dirn, swap_filen, (long int) len);
+ debugs(79, 3, "UFSStoreState::writeCompleted: dirno " << swap_dirn << ", fileno " <<
+ std::setfill('0') << std::hex << std::uppercase << std::setw(8) << swap_filen <<
+ ", len " << len );
/*
* DPW 2006-05-24
* See doWrites() for why we don't update UFSStoreState::writing
void
UFSStoreState::doCloseCallback(int errflag)
{
- debug(79, 3) ("storeUfsIOCallback: errflag=%d\n", errflag);
+ debugs(79, 3, "storeUfsIOCallback: errflag=" << errflag);
/*
* DPW 2006-05-24
* When we signal the higher layer with this callback, it might unlock
if (NULL == q)
return false;
- debug(79, 3) ("UFSStoreState::kickReadQueue: reading queued request of %ld bytes\n",
- (long int) q->size);
+ debugs(79, 3, "UFSStoreState::kickReadQueue: reading queued request of " << (long int) q->size << " bytes");
void *cbdata;
void
UFSStoreState::queueRead(char *buf, size_t size, off_t offset, STRCB *callback, void *callback_data)
{
- debug(79, 3) ("UFSStoreState::queueRead: queueing read\n");
+ debugs(79, 3, "UFSStoreState::queueRead: queueing read");
assert(opening);
assert (pending_reads == NULL);
_queued_read *q = new _queued_read;
StoreIOState::STIOCB * callback, void *callback_data)
{
assert (((UFSSwapDir *)SD)->IO == this);
- debug(79, 3) ("UFSStrategy::open: fileno %08X\n", e->swap_filen);
+ debugs(79, 3, "UFSStrategy::open: fileno "<< std::setfill('0') << std::hex << std::uppercase << std::setw(8) << e->swap_filen);
/* to consider: make createstate a private UFSStrategy call */
StoreIOState::Pointer sio = createState (SD, e, callback, callback_data);
assert (((UFSSwapDir *)SD)->IO == this);
/* Allocate a number */
sfileno filn = ((UFSSwapDir *)SD)->mapBitAllocate();
- debug(79, 3) ("UFSStrategy::create: fileno %08X\n", filn);
+ debugs(79, 3, "UFSStrategy::create: fileno "<< std::setfill('0') << std::hex << std::uppercase << std::setw(8) << filn);
/* Shouldn't we handle a 'bitmap full' error here? */
/*
- * $Id: ufscommon.cc,v 1.10 2007/04/21 07:14:16 wessels Exp $
+ * $Id: ufscommon.cc,v 1.11 2007/04/28 22:26:51 hno Exp $
* vim: set et :
*
* DEBUG: section 47 Store Directory Routines
if (!clean)
flags.need_to_validate = 1;
- debug(47, 1) ("Rebuilding storage in %s (%s)\n",
- sd->path, clean ? "CLEAN" : "DIRTY");
+ debugs(47, 1, "Rebuilding storage in " << sd->path << " (" << (clean ? "CLEAN" : "DIRTY") << ")");
}
RebuildState::~RebuildState()
int fd = -1;
StoreMeta *tlv_list;
assert(this != NULL);
- debug(47, 3) ("commonUfsDirRebuildFromDirectory: DIR #%d\n", sd->index);
+ debugs(47, 3, "commonUfsDirRebuildFromDirectory: DIR #" << sd->index);
for (int count = 0; count < speed; count++) {
assert(fd == -1);
fd = getNextFile(&filn, &size);
if (fd == -2) {
- debug(47, 1) ("Done scanning %s swaplog (%d entries)\n",
- sd->path, n_read);
+ debugs(47, 1, "Done scanning " << sd->path << " swaplog (" << n_read << " entries)");
_done = true;
return;
} else if (fd < 0) {
/* lets get file stats here */
if (fstat(fd, &sb) < 0) {
- debug(47, 1) ("commonUfsDirRebuildFromDirectory: fstat(FD %d): %s\n",
- fd, xstrerror());
+ debugs(47, 1, "commonUfsDirRebuildFromDirectory: fstat(FD " << fd << "): " << xstrerror());
file_close(fd);
store_open_disk_fd--;
fd = -1;
}
if ((++counts.scancount & 0xFFFF) == 0)
- debug(47, 3) (" %s %7d files opened so far.\n",
- sd->path, counts.scancount);
+ debugs(47, 3, " " << sd->path << " " << std::setw(7) << counts.scancount << " files opened so far.");
+ debugs(47, 9, "file_in: fd=" << fd << " "<< std::setfill('0') << std::hex << std::uppercase << std::setw(8) << filn);
- debug(47, 9) ("file_in: fd=%d %08X\n", fd, filn);
statCounter.syscalls.disk.reads++;
int len;
if ((len = FD_READ_METHOD(fd, hdr_buf, SM_PAGE_SIZE)) < 0) {
- debug(47, 1) ("commonUfsDirRebuildFromDirectory: read(FD %d): %s\n",
- fd, xstrerror());
+ debugs(47, 1, "commonUfsDirRebuildFromDirectory: read(FD " << fd << "): " << xstrerror());
file_close(fd);
store_open_disk_fd--;
fd = -1;
StoreMetaUnpacker aBuilder(hdr_buf, len, &swap_hdr_len);
if (!aBuilder.isBufferSane()) {
- debug(47, 1) ("commonUfsDirRebuildFromDirectory: Swap data buffer length is not sane.\n");
+ debugs(47, 1, "commonUfsDirRebuildFromDirectory: Swap data buffer length is not sane.");
/* XXX shouldn't this be a call to commonUfsUnlink ? */
sd->unlinkFile ( filn);
continue;
tlv_list = aBuilder.createStoreMeta ();
if (tlv_list == NULL) {
- debug(47, 1) ("commonUfsDirRebuildFromDirectory: failed to get meta data\n");
+ debugs(47, 1, "commonUfsDirRebuildFromDirectory: failed to get meta data");
/* XXX shouldn't this be a call to commonUfsUnlink ? */
sd->unlinkFile (filn);
continue;
}
- debug(47, 3) ("commonUfsDirRebuildFromDirectory: successful swap meta unpacking\n");
+ debugs(47, 3, "commonUfsDirRebuildFromDirectory: successful swap meta unpacking");
memset(key, '\0', MD5_DIGEST_CHARS);
memset(&tmpe, '\0', sizeof(StoreEntry));
InitStoreEntry visitor(&tmpe, key);
tlv_list = NULL;
if (storeKeyNull(key)) {
- debug(47, 1) ("commonUfsDirRebuildFromDirectory: NULL key\n");
+ debugs(47, 1, "commonUfsDirRebuildFromDirectory: NULL key");
sd->unlinkFile(filn);
continue;
}
} else if (tmpe.swap_file_sz == (size_t)(sb.st_size - swap_hdr_len)) {
tmpe.swap_file_sz = (size_t) sb.st_size;
} else if (tmpe.swap_file_sz != (size_t)sb.st_size) {
- debug(47, 1) ("commonUfsDirRebuildFromDirectory: SIZE MISMATCH %ld!=%ld\n",
- (long int) tmpe.swap_file_sz, (long int) sb.st_size);
+ debugs(47, 1, "commonUfsDirRebuildFromDirectory: SIZE MISMATCH " <<
+ (long int) tmpe.swap_file_sz << "!=" <<
+ (long int) sb.st_size);
+
sd->unlinkFile(filn);
continue;
}
size_t ss = sizeof(StoreSwapLogData);
if (fread(&swapData, ss, 1, log) != 1) {
- debug(47, 1) ("Done reading %s swaplog (%d entries)\n",
- sd->path, n_read);
+ debugs(47, 1, "Done reading " << sd->path << " swaplog (" << n_read << " entries)");
fclose(log);
log = NULL;
_done = true;
*/
swapData.swap_filen &= 0x00FFFFFF;
- debug(47, 3) ("commonUfsDirRebuildFromSwapLog: %s %s %08X\n",
- swap_log_op_str[(int) swapData.op],
- storeKeyText(swapData.key),
- swapData.swap_filen);
+ debugs(47, 3, "commonUfsDirRebuildFromSwapLog: " <<
+ swap_log_op_str[(int) swapData.op] << " " <<
+ storeKeyText(swapData.key) << " "<< std::setfill('0') <<
+ std::hex << std::uppercase << std::setw(8) <<
+ swapData.swap_filen);
if (swapData.op == SWAP_LOG_ADD) {
(void) 0;
x = ::log(static_cast<double>(++counts.bad_log_op)) / ::log(10.0);
if (0.0 == x - (double) (int) x)
- debug(47, 1) ("WARNING: %d invalid swap log entries found\n",
- counts.bad_log_op);
+ debugs(47, 1, "WARNING: " << counts.bad_log_op << " invalid swap log entries found");
counts.invalid++;
sd->dereference(*currentEntry());
} else {
debug_trap("commonUfsDirRebuildFromSwapLog: bad condition");
- debug(47, 1) ("\tSee %s:%d\n", __FILE__, __LINE__);
+ debugs(47, 1, "\tSee " << __FILE__ << ":" << __LINE__);
}
continue;
* point. If the log is dirty, the filesize check should have
* caught this. If the log is clean, there should never be a
* newer entry. */
- debug(47, 1) ("WARNING: newer swaplog entry for dirno %d, fileno %08X\n",
- sd->index, swapData.swap_filen);
+ debugs(47, 1, "WARNING: newer swaplog entry for dirno " <<
+ sd->index << ", fileno "<< std::setfill('0') << std::hex <<
+ std::uppercase << std::setw(8) << swapData.swap_filen);
+
/* I'm tempted to remove the swapfile here just to be safe,
* but there is a bad race condition in the NOVM version if
* the swapfile has recently been opened for writing, but
{
int fd = -1;
int dirs_opened = 0;
- debug(47, 3) ("commonUfsDirGetNextFile: flag=%d, %d: /%02X/%02X\n",
- flags.init,
- sd->index,
- curlvl1,
- curlvl2);
+ debugs(47, 3, "commonUfsDirGetNextFile: flag=" << flags.init << ", " <<
+ sd->index << ": /"<< std::setfill('0') << std::hex <<
+ std::uppercase << std::setw(2) << curlvl1 << "/" << std::setw(2) <<
+ curlvl2);
if (done)
return -2;
dirs_opened++;
if (td == NULL) {
- debug(47, 1) ("commonUfsDirGetNextFile: opendir: %s: %s\n",
- fullpath, xstrerror());
+ debugs(47, 1, "commonUfsDirGetNextFile: opendir: " << fullpath << ": " << xstrerror());
} else {
entry = readdir(td); /* skip . and .. */
entry = readdir(td);
if (entry == NULL && errno == ENOENT)
- debug(47, 1) ("commonUfsDirGetNextFile: directory does not exist!.\n");
-
- debug(47, 3) ("commonUfsDirGetNextFile: Directory %s\n", fullpath);
+ debugs(47, 1, "commonUfsDirGetNextFile: directory does not exist!.");
+ debugs(47, 3, "commonUfsDirGetNextFile: Directory " << fullpath);
}
}
in_dir++;
if (sscanf(entry->d_name, "%x", &fn) != 1) {
- debug(47, 3) ("commonUfsDirGetNextFile: invalid %s\n",
- entry->d_name);
+ debugs(47, 3, "commonUfsDirGetNextFile: invalid " << entry->d_name);
continue;
}
if (!UFSSwapDir::FilenoBelongsHere(fn, sd->index, curlvl1, curlvl2)) {
- debug(47, 3) ("commonUfsDirGetNextFile: %08X does not belong in %d/%d/%d\n",
- fn, sd->index, curlvl1, curlvl2);
+ debugs(47, 3, "commonUfsDirGetNextFile: "<< std::setfill('0') <<
+ std::hex << std::uppercase << std::setw(8) << fn <<
+ " does not belong in " << std::dec << sd->index << "/" <<
+ curlvl1 << "/" << curlvl2);
+
continue;
}
if (sd->mapBitTest(fn)) {
- debug(47, 3) ("commonUfsDirGetNextFile: Locked, continuing with next.\n");
+ debugs(47, 3, "commonUfsDirGetNextFile: Locked, continuing with next.");
continue;
}
snprintf(fullfilename, SQUID_MAXPATHLEN, "%s/%s",
fullpath, entry->d_name);
- debug(47, 3) ("commonUfsDirGetNextFile: Opening %s\n", fullfilename);
+ debugs(47, 3, "commonUfsDirGetNextFile: Opening " << fullfilename);
fd = file_open(fullfilename, O_RDONLY | O_BINARY);
if (fd < 0)
- debug(47, 1) ("commonUfsDirGetNextFile: %s: %s\n", fullfilename, xstrerror());
+ debugs(47, 1, "commonUfsDirGetNextFile: " << fullfilename << ": " << xstrerror());
else
store_open_disk_fd++;
/*
- * $Id: ftp.cc,v 1.417 2007/04/25 14:37:55 rousskov Exp $
+ * $Id: ftp.cc,v 1.418 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 9 File Transfer Protocol (FTP)
* AUTHOR: Harvest Derived
FtpStateData::FtpStateData(FwdState *theFwdState) : ServerStateData(theFwdState)
{
const char *url = entry->url();
- debug(9, 3) ("ftpStart: '%s'\n", url);
+ debugs(9, 3, "ftpStart: '" << url << "'" );
statCounter.server.all.requests++;
statCounter.server.ftp.requests++;
ctrl.fd = theFwdState->server_fd;
FtpStateData::~FtpStateData()
{
- debug(9, 3) ("~ftpStateData: %s\n", entry->url());
+ debugs(9, 3, "~ftpStateData: " << entry->url() );
entry->unregisterAbort();
{
FtpStateData *ftpState = (FtpStateData *)data;
StoreEntry *entry = ftpState->entry;
- debug(9, 4) ("ftpTimeout: FD %d: '%s'\n", fd, entry->url());
+ debugs(9, 4, "ftpTimeout: FD " << fd << ": '" << entry->url() << "'" );
if (SENT_PASV == ftpState->state && fd == ftpState->data.fd) {
/* stupid ftp.netscape.com */
ftpState->fwd->dontRetry(false);
ftpState->fwd->ftpPasvFailed(true);
- debug(9, 1) ("ftpTimeout: timeout in SENT_PASV state\n");
+ debugs(9, 1, "ftpTimeout: timeout in SENT_PASV state" );
}
ftpState->failed(ERR_READ_TIMEOUT, 0);
/* Error guard, or "assert" */
printfReplyBody("ERROR: Failed to parse URL: %s\n",
html_quote(title));
- debug(9, 0) ("Failed to parse URL: %s\n", title);
+ debugs(9, 0, "Failed to parse URL: " << title);
break;
}
}
size_t len = data.readBuf->contentSize();
if (!len) {
- debug(9, 3) ("ftpParseListing: no content to parse for %s\n", e->url());
+ debugs(9, 3, "ftpParseListing: no content to parse for " << e->url() );
return;
}
usable = end - sbuf;
- debug(9, 3) ("ftpParseListing: usable = %d\n", (int) usable);
+ debugs(9, 3, "ftpParseListing: usable = " << (int) usable);
if (usable == 0) {
- debug(9, 3) ("ftpParseListing: didn't find end for %s\n", e->url());
+ debugs(9, 3, "ftpParseListing: didn't find end for " << e->url() );
xfree(sbuf);
return;
}
- debug(9, 3) ("ftpParseListing: %lu bytes to play with\n", (unsigned long int)len);
+ debugs(9, 3, "ftpParseListing: " << (unsigned long int)len << " bytes to play with");
+
line = (char *)memAllocate(MEM_4K_BUF);
end++;
e->buffer(); /* released when done processing current data payload */
s += strspn(s, crlf);
for (; s < end; s += strcspn(s, crlf), s += strspn(s, crlf)) {
- debug(9, 3) ("ftpParseListing: s = {%s}\n", s);
+ debugs(9, 3, "ftpParseListing: s = {" << s << "}");
linelen = strcspn(s, crlf) + 1;
if (linelen < 2)
xstrncpy(line, s, linelen);
- debug(9, 7) ("ftpParseListing: {%s}\n", line);
+ debugs(9, 7, "ftpParseListing: {" << line << "}");
if (!strncmp(line, "total", 5))
continue;
void
FtpStateData::dataComplete()
{
- debug(9, 3) ("ftpDataComplete\n");
+ debugs(9, 3, "ftpDataComplete");
/* Connection closed; transfer done. */
if (data.fd > -1) {
}
if (errflag != COMM_OK || len < 0) {
- debug(50, ignoreErrno(xerrno) ? 3 : 1) ("ftpDataRead: read error: %s\n", xstrerr(xerrno));
+ debugs(50, ignoreErrno(xerrno) ? 3 : 1, "ftpDataRead: read error: " << xstrerr(xerrno));
if (ignoreErrno(xerrno)) {
commSetTimeout(fd, Config.Timeout.read, ftpTimeout, this);
checkUrlpath();
buildTitleUrl();
- debug(9, 5) ("ftpStart: host=%s, path=%s, user=%s, passwd=%s\n",
- request->host, request->urlpath.buf(),
- user, password);
+ debugs(9, 5, "ftpStart: host=" << request->host << ", path=" <<
+ request->urlpath.buf() << ", user=" << user << ", passwd=" <<
+ password);
+
state = BEGIN;
ctrl.last_command = xstrdup("Connect to server");
ctrl.buf = (char *)memAllocBuf(4096, &ctrl.size);
FtpStateData::writeCommand(const char *buf)
{
char *ebuf;
- debug(9, 5) ("ftpWriteCommand: %s\n", buf);
+ debugs(9, 5, "ftpWriteCommand: " << buf);
if (Config.Ftp.telnet)
ebuf = escapeIAC(buf);
{
FtpStateData *ftpState = (FtpStateData *)data;
- debug(9, 7) ("ftpWriteCommandCallback: wrote %d bytes\n", (int) size);
+ debugs(9, 7, "ftpWriteCommandCallback: wrote " << (int) size << " bytes");
if (size > 0) {
fd_bytes(fd, size, FD_WRITE);
return;
if (errflag) {
- debug(9, 1) ("ftpWriteCommandCallback: FD %d: %s\n", fd, xstrerr(xerrno));
+ debugs(9, 1, "ftpWriteCommandCallback: FD " << fd << ": " << xstrerr(xerrno));
ftpState->failed(ERR_WRITE_ERROR, xerrno);
/* failed closes ctrl.fd and frees ftpState */
return;
off_t offset;
size_t linelen;
int code = -1;
- debug(9, 5) ("ftpParseControlReply\n");
+ debugs(9, 5, "ftpParseControlReply");
/*
* We need a NULL-terminated buffer for scanning, ick
*/
usable = end - sbuf;
- debug(9, 3) ("ftpParseControlReply: usable = %d\n", usable);
+ debugs(9, 3, "ftpParseControlReply: usable = " << usable);
if (usable == 0) {
- debug(9, 3) ("ftpParseControlReply: didn't find end of line\n");
+ debugs(9, 3, "ftpParseControlReply: didn't find end of line");
safe_free(sbuf);
return NULL;
}
- debug(9, 3) ("ftpParseControlReply: %d bytes to play with\n", (int) len);
+ debugs(9, 3, "ftpParseControlReply: " << (int) len << " bytes to play with");
end++;
s = sbuf;
s += strspn(s, crlf);
if (complete)
break;
- debug(9, 3) ("ftpParseControlReply: s = {%s}\n", s);
+ debugs(9, 3, "ftpParseControlReply: s = {" << s << "}");
linelen = strcspn(s, crlf) + 1;
xstrncpy(list->key, s + offset, linelen - offset);
- debug(9, 7) ("%d %s\n", code, list->key);
+ debugs(9, 7, "" << code << " " << list->key);
*tail = list;
void
FtpStateData::scheduleReadControlReply(int buffered_ok)
{
- debug(9, 3) ("scheduleReadControlReply: FD %d\n", ctrl.fd);
+ debugs(9, 3, "scheduleReadControlReply: FD " << ctrl.fd);
if (buffered_ok && ctrl.offset > 0) {
/* We've already read some reply data */
{
FtpStateData *ftpState = (FtpStateData *)data;
StoreEntry *entry = ftpState->entry;
- debug(9, 5) ("ftpReadControlReply: FD %d, Read %d bytes\n", fd, (int)len);
+ debugs(9, 5, "ftpReadControlReply: FD " << fd << ", Read " << (int)len << " bytes");
if (len > 0) {
kb_incr(&statCounter.server.all.kbytes_in, len);
if (errflag != COMM_OK || len < 0) {
- debug(50, ignoreErrno(xerrno) ? 3 : 1) ("ftpReadControlReply: read error: %s\n", xstrerr(xerrno));
+ debugs(50, ignoreErrno(xerrno) ? 3 : 1, "ftpReadControlReply: read error: " << xstrerr(xerrno));
if (ignoreErrno(xerrno)) {
ftpState->scheduleReadControlReply(0);
*/
wordlistAddWl(&cwd_message, ctrl.message);
- debug(9, 8) ("handleControlReply: state=%d, code=%d\n", state,
- ctrl.replycode);
+ debugs(9, 8, "handleControlReply: state=" << state << ", code=" << ctrl.replycode);
FTP_SM_FUNCS[state] (this);
}
ftpReadWelcome(FtpStateData * ftpState)
{
int code = ftpState->ctrl.replycode;
- debug(9, 3) ("ftpReadWelcome\n");
+ debugs(9, 3, "ftpReadWelcome");
if (ftpState->flags.pasv_only)
ftpState->login_att++;
ftpSendUser(ftpState);
} else if (code == 120) {
if (NULL != ftpState->ctrl.message)
- debug(9, 3) ("FTP server is busy: %s\n",
- ftpState->ctrl.message->key);
+ debugs(9, 3, "FTP server is busy: " << ftpState->ctrl.message->key);
return;
} else {
ftpReadUser(FtpStateData * ftpState)
{
int code = ftpState->ctrl.replycode;
- debug(9, 3) ("ftpReadUser\n");
+ debugs(9, 3, "ftpReadUser");
if (code == 230) {
ftpReadPass(ftpState);
ftpReadPass(FtpStateData * ftpState)
{
int code = ftpState->ctrl.replycode;
- debug(9, 3) ("ftpReadPass\n");
+ debugs(9, 3, "ftpReadPass");
if (code == 230) {
ftpSendType(ftpState);
int code = ftpState->ctrl.replycode;
char *path;
char *d, *p;
- debug(9, 3) ("This is ftpReadType\n");
+ debugs(9, 3, "This is ftpReadType");
if (code == 200) {
p = path = xstrdup(ftpState->request->urlpath.buf());
ftpTraverseDirectory(FtpStateData * ftpState)
{
wordlist *w;
- debug(9, 4) ("ftpTraverseDirectory %s\n",
- ftpState->filepath ? ftpState->filepath : "<NULL>");
+ debugs(9, 4, "ftpTraverseDirectory " << (ftpState->filepath ? ftpState->filepath : "<NULL>"));
safe_free(ftpState->dirpath);
ftpState->dirpath = ftpState->filepath;
/* Done? */
if (ftpState->pathcomps == NULL) {
- debug(9, 3) ("the final component was a directory\n");
+ debugs(9, 3, "the final component was a directory");
ftpListDir(ftpState);
return;
}
if (ftpState->pathcomps != NULL || ftpState->flags.isdir) {
ftpSendCwd(ftpState);
} else {
- debug(9, 3) ("final component is probably a file\n");
+ debugs(9, 3, "final component is probably a file");
ftpGetFile(ftpState);
return;
}
ftpSendCwd(FtpStateData * ftpState)
{
char *path = ftpState->filepath;
- debug(9, 3) ("ftpSendCwd\n");
+ debugs(9, 3, "ftpSendCwd");
if (!strcmp(path, "..") || !strcmp(path, "/")) {
ftpState->flags.no_dotdot = 1;
ftpReadCwd(FtpStateData * ftpState)
{
int code = ftpState->ctrl.replycode;
- debug(9, 3) ("This is ftpReadCwd\n");
+ debugs(9, 3, "This is ftpReadCwd");
if (code >= 200 && code < 300) {
/* CWD OK */
ftpSendMkdir(FtpStateData * ftpState)
{
char *path = ftpState->filepath;
- debug(9, 3) ("ftpSendMkdir: with path=%s\n", path);
+ debugs(9, 3, "ftpSendMkdir: with path=" << path);
snprintf(cbuf, 1024, "MKD %s\r\n", path);
ftpState->writeCommand(cbuf);
ftpState->state = SENT_MKDIR;
char *path = ftpState->filepath;
int code = ftpState->ctrl.replycode;
- debug(9, 3) ("ftpReadMkdir: path %s, code %d\n", path, code);
+ debugs(9, 3, "ftpReadMkdir: path " << path << ", code " << code);
if (code == 257) { /* success */
ftpSendCwd(ftpState);
ftpListDir(FtpStateData * ftpState)
{
if (ftpState->flags.dir_slash) {
- debug(9, 3) ("Directory path did not end in /\n");
+ debugs(9, 3, "Directory path did not end in /");
ftpState->title_url.append("/");
ftpState->flags.isdir = 1;
}
ftpReadMdtm(FtpStateData * ftpState)
{
int code = ftpState->ctrl.replycode;
- debug(9, 3) ("This is ftpReadMdtm\n");
+ debugs(9, 3, "This is ftpReadMdtm");
if (code == 213) {
ftpState->mdtm = parse_iso3307_time(ftpState->ctrl.last_reply);
ftpReadSize(FtpStateData * ftpState)
{
int code = ftpState->ctrl.replycode;
- debug(9, 3) ("This is ftpReadSize\n");
+ debugs(9, 3, "This is ftpReadSize");
if (code == 213) {
ftpState->unhack();
ftpState->size = atoi(ftpState->ctrl.last_reply);
if (ftpState->size == 0) {
- debug(9, 2) ("ftpReadSize: SIZE reported %s on %s\n",
- ftpState->ctrl.last_reply,
- ftpState->title_url.buf());
+ debugs(9, 2, "ftpReadSize: SIZE reported " <<
+ ftpState->ctrl.last_reply << " on " <<
+ ftpState->title_url.buf());
+
ftpState->size = -1;
}
} else if (code < 0) {
addr_len = sizeof(addr);
if (getsockname(ftpState->ctrl.fd, (struct sockaddr *) &addr, &addr_len)) {
- debug(9, 0) ("ftpSendPasv: getsockname(%d,..): %s\n",
- ftpState->ctrl.fd, xstrerror());
+ debugs(9, 0, "ftpSendPasv: getsockname(" << ftpState->ctrl.fd << ",..): " << xstrerror());
ftpFail(ftpState);
return;
}
COMM_NONBLOCKING,
ftpState->entry->url());
- debug(9, 3) ("ftpSendPasv: Unconnected data socket created on FD %d\n", fd);
+ debugs(9, 3, "ftpSendPasv: Unconnected data socket created on FD " << fd);
if (fd < 0) {
ftpFail(ftpState);
int fd = ftpState->data.fd;
char *buf;
LOCAL_ARRAY(char, ipaddr, 1024);
- debug(9, 3) ("This is ftpReadPasv\n");
+ debugs(9, 3, "This is ftpReadPasv");
if (code != 227) {
- debug(9, 3) ("PASV not supported by remote end\n");
+ debugs(9, 3, "PASV not supported by remote end");
ftpSendPort(ftpState);
return;
}
/* 227 Entering Passive Mode (h1,h2,h3,h4,p1,p2). */
/* ANSI sez [^0-9] is undefined, it breaks on Watcom cc */
- debug(9, 5) ("scanning: %s\n", ftpState->ctrl.last_reply);
+ debugs(9, 5, "scanning: " << ftpState->ctrl.last_reply);
buf = ftpState->ctrl.last_reply + strcspn(ftpState->ctrl.last_reply, "0123456789");
n = sscanf(buf, "%d,%d,%d,%d,%d,%d", &h1, &h2, &h3, &h4, &p1, &p2);
if (n != 6 || p1 < 0 || p2 < 0 || p1 > 255 || p2 > 255) {
- debug(9, 1) ("Unsafe PASV reply from %s: %s\n", fd_table[ftpState->ctrl.fd].ipaddr, ftpState->ctrl.last_reply);
+ debugs(9, 1, "Unsafe PASV reply from " <<
+ fd_table[ftpState->ctrl.fd].ipaddr << ": " <<
+ ftpState->ctrl.last_reply);
+
ftpSendPort(ftpState);
return;
}
snprintf(ipaddr, 1024, "%d.%d.%d.%d", h1, h2, h3, h4);
if (!safe_inet_addr(ipaddr, NULL)) {
- debug(9, 1) ("Unsafe PASV reply from %s: %s\n", fd_table[ftpState->ctrl.fd].ipaddr, ftpState->ctrl.last_reply);
+ debugs(9, 1, "Unsafe PASV reply from " <<
+ fd_table[ftpState->ctrl.fd].ipaddr << ": " <<
+ ftpState->ctrl.last_reply);
+
ftpSendPort(ftpState);
return;
}
port = ((p1 << 8) + p2);
if (0 == port) {
- debug(9, 1) ("Unsafe PASV reply from %s: %s\n", fd_table[ftpState->ctrl.fd].ipaddr, ftpState->ctrl.last_reply);
+ debugs(9, 1, "Unsafe PASV reply from " <<
+ fd_table[ftpState->ctrl.fd].ipaddr << ": " <<
+ ftpState->ctrl.last_reply);
+
ftpSendPort(ftpState);
return;
}
if (Config.Ftp.sanitycheck) {
if (port < 1024) {
- debug(9, 1) ("Unsafe PASV reply from %s: %s\n", fd_table[ftpState->ctrl.fd].ipaddr, ftpState->ctrl.last_reply);
+ debugs(9, 1, "Unsafe PASV reply from " <<
+ fd_table[ftpState->ctrl.fd].ipaddr << ": " <<
+ ftpState->ctrl.last_reply);
+
ftpSendPort(ftpState);
return;
}
ftpState->ctrl.last_command = xstrdup("Connect to server data port");
- debug(9, 5) ("ftpReadPasv: connecting to %s, port %d\n", ftpState->data.host, ftpState->data.port);
+ debugs(9, 5, "ftpReadPasv: connecting to " << ftpState->data.host << ", port " << ftpState->data.port);
commConnectStart(fd, ipaddr, port, FtpStateData::ftpPasvCallback, ftpState);
}
FtpStateData::ftpPasvCallback(int fd, comm_err_t status, int xerrno, void *data)
{
FtpStateData *ftpState = (FtpStateData *)data;
- debug(9, 3) ("ftpPasvCallback\n");
+ debugs(9, 3, "ftpPasvCallback");
if (status != COMM_OK) {
- debug(9, 2) ("ftpPasvCallback: failed to connect. Retrying without PASV.\n");
+ debugs(9, 2, "ftpPasvCallback: failed to connect. Retrying without PASV.");
ftpState->fwd->dontRetry(false); /* this is a retryable error */
ftpState->fwd->ftpPasvFailed(true);
ftpState->failed(ERR_NONE, 0);
addr_len = sizeof(addr);
if (getsockname(ftpState->ctrl.fd, (struct sockaddr *) &addr, &addr_len)) {
- debug(9, 0) ("ftpOpenListenSocket: getsockname(%d,..): %s\n",
- ftpState->ctrl.fd, xstrerror());
+ debugs(9, 0, "ftpOpenListenSocket: getsockname(" << ftpState->ctrl.fd << ",..): " << xstrerror());
return -1;
}
port,
COMM_NONBLOCKING | (fallback ? COMM_REUSEADDR : 0),
ftpState->entry->url());
- debug(9, 3) ("ftpOpenListenSocket: Unconnected data socket created on FD %d\n", fd);
+ debugs(9, 3, "ftpOpenListenSocket: Unconnected data socket created on FD " << fd );
if (fd < 0) {
- debug(9, 0) ("ftpOpenListenSocket: comm_open failed\n");
+ debugs(9, 0, "ftpOpenListenSocket: comm_open failed");
return -1;
}
socklen_t addr_len;
unsigned char *addrptr;
unsigned char *portptr;
- debug(9, 3) ("This is ftpSendPort\n");
+ debugs(9, 3, "This is ftpSendPort");
ftpState->flags.pasv_supported = 0;
fd = ftpOpenListenSocket(ftpState, 0);
addr_len = sizeof(addr);
if (getsockname(fd, (struct sockaddr *) &addr, &addr_len)) {
- debug(9, 0) ("ftpSendPort: getsockname(%d,..): %s\n", fd, xstrerror());
+ debugs(9, 0, "ftpSendPort: getsockname(" << fd << ",..): " << xstrerror());
+
/* XXX Need to set error message */
ftpFail(ftpState);
return;
ftpReadPort(FtpStateData * ftpState)
{
int code = ftpState->ctrl.replycode;
- debug(9, 3) ("This is ftpReadPort\n");
+ debugs(9, 3, "This is ftpReadPort");
if (code != 200) {
/* Fall back on using the same port as the control connection */
- debug(9, 3) ("PORT not supported by remote end\n");
+ debugs(9, 3, "PORT not supported by remote end");
ftpOpenListenSocket(ftpState, 1);
}
comm_err_t flag, int xerrno, void *data)
{
FtpStateData *ftpState = (FtpStateData *)data;
- debug(9, 3) ("ftpAcceptDataConnection\n");
+ debugs(9, 3, "ftpAcceptDataConnection");
if (flag == COMM_ERR_CLOSING)
return;
char *ipaddr = inet_ntoa(details->peer.sin_addr);
if (strcmp(fd_table[ftpState->ctrl.fd].ipaddr, ipaddr) != 0) {
- debug(9, 1) ("FTP data connection from unexpected server (%s:%d), expecting %s\n", ipaddr, (int) ntohs(details->peer.sin_port), fd_table[ftpState->ctrl.fd].ipaddr);
+ debugs(9, 1, "FTP data connection from unexpected server (" <<
+ ipaddr << ":" << (int) ntohs(details->peer.sin_port) <<
+ "), expecting " << fd_table[ftpState->ctrl.fd].ipaddr);
+
comm_close(newfd);
comm_accept(ftpState->data.fd, ftpAcceptDataConnection, ftpState);
return;
}
if (flag != COMM_OK) {
- debug(9, 1) ("ftpHandleDataAccept: comm_accept(%d): %s\n", newfd, xstrerr(xerrno));
+ debugs(9, 1, "ftpHandleDataAccept: comm_accept(" << newfd << "): " << xstrerr(xerrno));
/* XXX Need to set error message */
ftpFail(ftpState);
return;
/* Replace the Listen socket with the accepted data socket */
comm_close(ftpState->data.fd);
- debug(9, 3) ("ftpAcceptDataConnection: Connected data socket on FD %d\n", newfd);
+ debugs(9, 3, "ftpAcceptDataConnection: Connected data socket on FD " << newfd);
ftpState->data.fd = newfd;
static void
ftpRestOrList(FtpStateData * ftpState)
{
- debug(9, 3) ("This is ftpRestOrList\n");
+ debugs(9, 3, "This is ftpRestOrList");
if (ftpState->typecode == 'D') {
ftpState->flags.isdir = 1;
ftpSendNlst(ftpState); /* GET name;type=d sec 3.2.2 of RFC 1738 */
}
} else if (ftpState->flags.put) {
- debug(9, 3) ("ftpRestOrList: Sending STOR request...\n");
+ debugs(9, 3, "ftpRestOrList: Sending STOR request...");
ftpSendStor(ftpState);
} else if (ftpState->flags.isdir)
ftpSendList(ftpState);
void FtpStateData::readStor() {
int code = ctrl.replycode;
- debug(9, 3) ("This is ftpReadStor\n");
+ debugs(9, 3, "This is ftpReadStor");
if (code == 125 || (code == 150 && data.host)) {
// register to receive body data
assert(request->body_pipe != NULL);
if (!request->body_pipe->setConsumerIfNotLate(this)) {
- debug(9, 3) ("ftpReadStor: aborting on partially consumed body\n");
+ debugs(9, 3, "ftpReadStor: aborting on partially consumed body");
ftpFail(this);
return;
}
/* Begin data transfer */
- debug(9, 3) ("ftpReadStor: starting data transfer\n");
+ debugs(9, 3, "ftpReadStor: starting data transfer");
sendMoreRequestBody();
/*
* Cancel the timeout on the Control socket and
this);
state = WRITING_DATA;
- debug(9, 3) ("ftpReadStor: writing data channel\n");
+ debugs(9, 3, "ftpReadStor: writing data channel");
} else if (code == 150) {
/* Accept data channel */
- debug(9, 3) ("ftpReadStor: accepting data channel\n");
+ debugs(9, 3, "ftpReadStor: accepting data channel");
comm_accept(data.fd, ftpAcceptDataConnection, this);
} else {
- debug(9, 3) ("ftpReadStor: Unexpected reply code %03d\n", code);
+ debugs(9, 3, "ftpReadStor: Unexpected reply code "<< std::setfill('0') << std::setw(3) << code);
ftpFail(this);
}
}
ftpReadRest(FtpStateData * ftpState)
{
int code = ftpState->ctrl.replycode;
- debug(9, 3) ("This is ftpReadRest\n");
+ debugs(9, 3, "This is ftpReadRest");
assert(ftpState->restart_offset > 0);
if (code == 350) {
ftpState->restarted_offset = ftpState->restart_offset;
ftpSendRetr(ftpState);
} else if (code > 0) {
- debug(9, 3) ("ftpReadRest: REST not supported\n");
+ debugs(9, 3, "ftpReadRest: REST not supported");
ftpState->flags.rest_supported = 0;
ftpSendRetr(ftpState);
} else {
ftpReadList(FtpStateData * ftpState)
{
int code = ftpState->ctrl.replycode;
- debug(9, 3) ("This is ftpReadList\n");
+ debugs(9, 3, "This is ftpReadList");
if (code == 125 || (code == 150 && ftpState->data.host)) {
/* Begin data transfer */
ftpReadRetr(FtpStateData * ftpState)
{
int code = ftpState->ctrl.replycode;
- debug(9, 3) ("This is ftpReadRetr\n");
+ debugs(9, 3, "This is ftpReadRetr");
if (code == 125 || (code == 150 && ftpState->data.host)) {
/* Begin data transfer */
- debug(9, 3) ("ftpReadRetr: reading data channel\n");
+ debugs(9, 3, "ftpReadRetr: reading data channel");
/* XXX what about Config.Timeout.read? */
ftpState->maybeReadVirginBody();
ftpState->state = READING_DATA;
ftpReadTransferDone(FtpStateData * ftpState)
{
int code = ftpState->ctrl.replycode;
- debug(9, 3) ("This is ftpReadTransferDone\n");
+ debugs(9, 3, "This is ftpReadTransferDone");
if (code == 226 || code == 250) {
/* Connection closed; retrieval done. */
ftpSendQuit(ftpState);
} else { /* != 226 */
- debug(9, 1) ("ftpReadTransferDone: Got code %d after reading data\n",
- code);
+ debugs(9, 1, "ftpReadTransferDone: Got code " << code << " after reading data");
ftpState->failed(ERR_FTP_FAILURE, 0);
/* failed closes ctrl.fd and frees ftpState */
return;
ftpWriteTransferDone(FtpStateData * ftpState)
{
int code = ftpState->ctrl.replycode;
- debug(9, 3) ("This is ftpWriteTransferDone\n");
+ debugs(9, 3, "This is ftpWriteTransferDone");
if (!(code == 226 || code == 250)) {
- debug(9, 1) ("ftpReadTransferDone: Got code %d after sending data\n",
- code);
+ debugs(9, 1, "ftpReadTransferDone: Got code " << code << " after sending data");
ftpState->failed(ERR_FTP_PUT_ERROR, 0);
return;
}
static void
ftpFail(FtpStateData *ftpState)
{
- debug(9, 3) ("ftpFail\n");
+ debugs(9, 3, "ftpFail");
/* Try the / hack to support "Netscape" FTP URL's for retreiving files */
if (!ftpState->flags.isdir && /* Not a directory */
int code = ftpState->ctrl.replycode;
http_status http_code;
err_type err_code = ERR_NONE;
- debug(9, 5) ("ftpSendReply: %s, code %d\n",
- ftpState->entry->url(), code);
+ debugs(9, 5, "ftpSendReply: " << ftpState->entry->url() << ", code " << code );
if (cbdataReferenceValid(ftpState))
- debug(9, 5) ("ftpSendReply: ftpState (%p) is valid!\n", ftpState);
+ debugs(9, 5, "ftpSendReply: ftpState (" << ftpState << ") is valid!");
if (code == 226 || code == 250) {
err_code = (ftpState->mdtm > 0) ? ERR_FTP_PUT_MODIFIED : ERR_FTP_PUT_CREATED;
/*
- * $Id: gopher.cc,v 1.202 2007/04/21 07:14:14 wessels Exp $
+ * $Id: gopher.cc,v 1.203 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 10 Gopher
* AUTHOR: Harvest Derived
xstrncpy(line, gopherState->buf, gopherState->len + 1);
if (gopherState->len + len > TEMP_BUF_SIZE) {
- debug(10, 1) ("GopherHTML: Buffer overflow. Lost some data on URL: %s\n",
- entry->url());
+ debugs(10, 1, "GopherHTML: Buffer overflow. Lost some data on URL: " << entry->url() );
len = TEMP_BUF_SIZE - gopherState->len;
}
/* copy it to temp buffer */
if (gopherState->len + len > TEMP_BUF_SIZE) {
- debug(10, 1) ("GopherHTML: Buffer overflow. Lost some data on URL: %s\n",
- entry->url());
+ debugs(10, 1, "GopherHTML: Buffer overflow. Lost some data on URL: " << entry->url() );
len = TEMP_BUF_SIZE - gopherState->len;
}
/* copy it to temp buffer */
if ((len - (pos - inbuf)) > TEMP_BUF_SIZE) {
- debug(10, 1) ("GopherHTML: Buffer overflow. Lost some data on URL: %s\n",
- entry->url());
+ debugs(10, 1, "GopherHTML: Buffer overflow. Lost some data on URL: " << entry->url() );
len = TEMP_BUF_SIZE;
}
{
GopherStateData *gopherState = (GopherStateData *)data;
StoreEntry *entry = gopherState->entry;
- debug(10, 4) ("gopherTimeout: FD %d: '%s'\n", fd, entry->url());
+ debugs(10, 4, "gopherTimeout: FD " << fd << ": '" << entry->url() << "'" );
gopherState->fwd->fail(errorCon(ERR_READ_TIMEOUT, HTTP_GATEWAY_TIMEOUT, gopherState->fwd->request));
kb_incr(&statCounter.server.other.kbytes_in, len);
}
- debug(10, 5) ("gopherReadReply: FD %d read len=%d\n", fd, (int)len);
+ debugs(10, 5, "gopherReadReply: FD " << fd << " read len=" << (int)len);
if (flag == COMM_OK && len > 0) {
commSetTimeout(fd, Config.Timeout.read, NULL, NULL);
}
if (flag != COMM_OK || len < 0) {
- debug(50, 1) ("gopherReadReply: error reading: %s\n", xstrerror());
+ debugs(50, 1, "gopherReadReply: error reading: " << xstrerror());
if (ignoreErrno(errno)) {
do_next_read = 1;
{
GopherStateData *gopherState = (GopherStateData *) data;
StoreEntry *entry = gopherState->entry;
- debug(10, 5) ("gopherSendComplete: FD %d size: %d errflag: %d\n",
- fd, (int) size, errflag);
+ debugs(10, 5, "gopherSendComplete: FD " << fd << " size: " << (int) size << " errflag: " << errflag);
if (size > 0) {
fd_bytes(fd, size, FD_WRITE);
snprintf(buf, 4096, "%s\r\n", gopherState->request);
}
- debug(10, 5) ("gopherSendRequest: FD %d\n", fd);
+ debugs(10, 5, "gopherSendRequest: FD " << fd);
comm_write(fd, buf, strlen(buf), gopherSendComplete, gopherState, NULL);
if (EBIT_TEST(gopherState->entry->flags, ENTRY_CACHABLE))
gopherState->fwd = fwd;
- debug(10, 3) ("gopherStart: %s\n", entry->url());
+ debugs(10, 3, "gopherStart: " << entry->url() );
statCounter.server.all.requests++;
/*
- * $Id: helper.cc,v 1.79 2007/04/06 12:15:51 serassio Exp $
+ * $Id: helper.cc,v 1.80 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 84 Helper process maintenance
* AUTHOR: Harvest Derived?
else
shortname = xstrdup(progname);
- debug(84, 1) ("helperOpenServers: Starting %d '%s' processes\n",
- hlp->n_to_start, shortname);
+ debugs(84, 1, "helperOpenServers: Starting " << hlp->n_to_start << " '" << shortname << "' processes");
procname = (char *)xmalloc(strlen(shortname) + 3);
&hIpc);
if (pid < 0) {
- debug(84, 1) ("WARNING: Cannot run '%s' process.\n", progname);
+ debugs(84, 1, "WARNING: Cannot run '" << progname << "' process.");
continue;
}
else
shortname = xstrdup(progname);
- debug(84, 1) ("helperStatefulOpenServers: Starting %d '%s' processes\n",
- hlp->n_to_start, shortname);
+ debugs(84, 1, "helperStatefulOpenServers: Starting " << hlp->n_to_start << " '" << shortname << "' processes");
procname = (char *)xmalloc(strlen(shortname) + 3);
&hIpc);
if (pid < 0) {
- debug(84, 1) ("WARNING: Cannot run '%s' process.\n", progname);
+ debugs(84, 1, "WARNING: Cannot run '" << progname << "' process.");
continue;
}
helper_server *srv;
if (hlp == NULL) {
- debug(84, 3) ("helperSubmit: hlp == NULL\n");
+ debugs(84, 3, "helperSubmit: hlp == NULL");
callback(data, NULL);
return;
}
else
Enqueue(hlp, r);
- debug(84, 9) ("helperSubmit: %s\n", buf);
+ debugs(84, 9, "helperSubmit: " << buf);
}
/* lastserver = "server last used as part of a deferred or reserved
helper_stateful_server *srv;
if (hlp == NULL) {
- debug(84, 3) ("helperStatefulSubmit: hlp == NULL\n");
+ debugs(84, 3, "helperStatefulSubmit: hlp == NULL");
callback(data, 0, NULL);
return;
}
}
if ((buf != NULL) && lastserver) {
- debug(84, 5) ("StatefulSubmit with lastserver %p\n", lastserver);
+ debugs(84, 5, "StatefulSubmit with lastserver " << lastserver);
/* the queue doesn't count for this assert because queued requests
* have already gone through here and been tested.
* It's legal to have deferred_requests == 0 and queue entries
}
if (!(lastserver->request)) {
- debug(84, 5) ("StatefulSubmit dispatching\n");
+ debugs(84, 5, "StatefulSubmit dispatching");
helperStatefulDispatch(lastserver, r);
} else {
- debug(84, 5) ("StatefulSubmit queuing\n");
+ debugs(84, 5, "StatefulSubmit queuing");
StatefulServerEnqueue(lastserver, r);
}
} else {
StatefulEnqueue(hlp, r);
}
- debug(84, 9) ("helperStatefulSubmit: placeholder: '%d', buf '%s'.\n", r->placeholder, buf);
+ debugs(84, 9, "helperStatefulSubmit: placeholder: '" << r->placeholder << "', buf '" << buf << "'.");
}
helper_stateful_server *
if (hlp == NULL)
{
- debug(84, 3) ("helperStatefulDefer: hlp == NULL\n");
+ debugs(84, 3, "helperStatefulDefer: hlp == NULL");
return NULL;
}
- debug(84, 5) ("helperStatefulDefer: Running servers %d.\n", hlp->n_running);
+ debugs(84, 5, "helperStatefulDefer: Running servers " << hlp->n_running << ".");
if (hlp->n_running == 0)
{
- debug(84, 1) ("helperStatefulDefer: No running servers!. \n");
+ debugs(84, 1, "helperStatefulDefer: No running servers!. ");
return NULL;
}
if (rv == NULL)
{
- debug(84, 1) ("helperStatefulDefer: None available.\n");
+ debugs(84, 1, "helperStatefulDefer: None available.");
return NULL;
}
if (r != NULL)
{
/* reset attempt DURING an outstaning request */
- debug(84, 1) ("helperStatefulReset: RESET During request %s \n",
- hlp->id_name);
+ debugs(84, 1, "helperStatefulReset: RESET During request " << hlp->id_name << " ");
srv->flags.busy = 0;
srv->roffset = 0;
helperStatefulRequestFree(r);
link = link->next;
if (srv->flags.shutdown) {
- debug(84, 3) ("helperShutdown: %s #%d has already SHUT DOWN.\n",
- hlp->id_name, srv->index + 1);
+ debugs(84, 3, "helperShutdown: " << hlp->id_name << " #" << srv->index + 1 << " has already SHUT DOWN.");
continue;
}
srv->flags.shutdown = 1; /* request it to shut itself down */
if (srv->flags.closing) {
- debug(84, 3) ("helperShutdown: %s #%d is CLOSING.\n",
- hlp->id_name, srv->index + 1);
+ debugs(84, 3, "helperShutdown: " << hlp->id_name << " #" << srv->index + 1 << " is CLOSING.");
continue;
}
if (srv->stats.pending) {
- debug(84, 3) ("helperShutdown: %s #%d is BUSY.\n",
- hlp->id_name, srv->index + 1);
+ debugs(84, 3, "helperShutdown: " << hlp->id_name << " #" << srv->index + 1 << " is BUSY.");
continue;
}
shutdown(srv->wfd, SD_BOTH);
#endif
- debug(84, 3) ("helperShutdown: %s #%d shutting down.\n",
- hlp->id_name, srv->index + 1);
+ debugs(84, 3, "helperShutdown: " << hlp->id_name << " #" << srv->index + 1 << " shutting down.");
/* the rest of the details is dealt with in the helperServerFree
* close handler
*/
if (hIpc) {
if (WaitForSingleObject(hIpc, 5000) != WAIT_OBJECT_0) {
getCurrentTime();
- debug(84, 1) ("helperShutdown: WARNING: %s #%d (%s,%ld) "
- "didn't exit in 5 seconds\n",
- hlp->id_name, no, hlp->cmdline->key, (long int)pid);
+ debugs(84, 1, "helperShutdown: WARNING: " << hlp->id_name <<
+ " #" << no << " (" << hlp->cmdline->key << "," <<
+ (long int)pid << ") didn't exit in 5 seconds");
+
}
CloseHandle(hIpc);
link = link->next;
if (srv->flags.shutdown) {
- debug(84, 3) ("helperStatefulShutdown: %s #%d has already SHUT DOWN.\n",
- hlp->id_name, srv->index + 1);
+ debugs(84, 3, "helperStatefulShutdown: " << hlp->id_name << " #" << srv->index + 1 << " has already SHUT DOWN.");
continue;
}
srv->flags.shutdown = 1; /* request it to shut itself down */
if (srv->flags.busy) {
- debug(84, 3) ("helperStatefulShutdown: %s #%d is BUSY.\n",
- hlp->id_name, srv->index + 1);
+ debugs(84, 3, "helperStatefulShutdown: " << hlp->id_name << " #" << srv->index + 1 << " is BUSY.");
continue;
}
if (srv->flags.closing) {
- debug(84, 3) ("helperStatefulShutdown: %s #%d is CLOSING.\n",
- hlp->id_name, srv->index + 1);
+ debugs(84, 3, "helperStatefulShutdown: " << hlp->id_name << " #" << srv->index + 1 << " is CLOSING.");
continue;
}
if (srv->flags.reserved != S_HELPER_FREE) {
- debug(84, 3) ("helperStatefulShutdown: %s #%d is RESERVED.\n",
- hlp->id_name, srv->index + 1);
+ debugs(84, 3, "helperStatefulShutdown: " << hlp->id_name << " #" << srv->index + 1 << " is RESERVED.");
continue;
}
if (srv->deferred_requests) {
- debug(84, 3) ("helperStatefulShutdown: %s #%d has DEFERRED requests.\n",
- hlp->id_name, srv->index + 1);
+ debugs(84, 3, "helperStatefulShutdown: " << hlp->id_name << " #" << srv->index + 1 << " has DEFERRED requests.");
continue;
}
shutdown(srv->wfd, SD_BOTH);
#endif
- debug(84, 3) ("helperStatefulShutdown: %s #%d shutting down.\n",
- hlp->id_name, srv->index + 1);
+ debugs(84, 3, "helperStatefulShutdown: " << hlp->id_name << " #" << srv->index + 1 << " shutting down.");
+
/* the rest of the details is dealt with in the helperStatefulServerFree
* close handler
*/
if (hIpc) {
if (WaitForSingleObject(hIpc, 5000) != WAIT_OBJECT_0) {
getCurrentTime();
- debug(84, 1) ("helperShutdown: WARNING: %s #%d (%s,%ld) "
- "didn't exit in 5 seconds\n",
- hlp->id_name, no, hlp->cmdline->key, (long int)pid);
+ debugs(84, 1, "helperShutdown: WARNING: " << hlp->id_name <<
+ " #" << no << " (" << hlp->cmdline->key << "," <<
+ (long int)pid << ") didn't exit in 5 seconds");
}
CloseHandle(hIpc);
/* note, don't free hlp->name, it probably points to static memory */
if (hlp->queue.head)
- debug(84, 0) ("WARNING: freeing %s helper with %d requests queued\n",
- hlp->id_name, hlp->stats.queue_size);
+ debugs(84, 0, "WARNING: freeing " << hlp->id_name << " helper with " <<
+ hlp->stats.queue_size << " requests queued");
cbdataFree(hlp);
}
/* note, don't free hlp->name, it probably points to static memory */
if (hlp->queue.head)
- debug(84, 0) ("WARNING: freeing %s helper with %d requests queued\n",
- hlp->id_name, hlp->stats.queue_size);
+ debugs(84, 0, "WARNING: freeing " << hlp->id_name << " helper with " <<
+ hlp->stats.queue_size << " requests queued");
cbdataFree(hlp);
}
if (!srv->flags.shutdown) {
hlp->n_active--;
assert(hlp->n_active >= 0);
- debug(84, 0) ("WARNING: %s #%d (FD %d) exited\n",
- hlp->id_name, srv->index + 1, fd);
+ debugs(84, 0, "WARNING: " << hlp->id_name << " #" << srv->index + 1 <<
+ " (FD " << fd << ") exited");
if (hlp->n_active < hlp->n_to_start / 2) {
- debug(80, 0) ("Too few %s processes are running\n", hlp->id_name);
+ debugs(80, 0, "Too few " << hlp->id_name << " processes are running");
if (hlp->last_restart > squid_curtime - 30)
fatalf("The %s helpers are crashing too rapidly, need help!\n", hlp->id_name);
- debug(80, 0) ("Starting new helpers\n");
+ debugs(80, 0, "Starting new helpers");
helperOpenServers(hlp);
}
if (!srv->flags.shutdown) {
hlp->n_active--;
assert( hlp->n_active >= 0);
- debug(84, 0) ("WARNING: %s #%d (FD %d) exited\n",
- hlp->id_name, srv->index + 1, fd);
+ debugs(84, 0, "WARNING: " << hlp->id_name << " #" << srv->index + 1 << " (FD " << fd << ") exited");
if (hlp->n_active <= hlp->n_to_start / 2) {
- debug(80, 0) ("Too few %s processes are running\n", hlp->id_name);
+ debugs(80, 0, "Too few " << hlp->id_name << " processes are running");
if (hlp->last_restart > squid_curtime - 30)
fatalf("The %s helpers are crashing too rapidly, need help!\n", hlp->id_name);
- debug(80, 0) ("Starting new helpers\n");
+ debugs(80, 0, "Starting new helpers");
helperStatefulOpenServers(hlp);
}
return;
}
- debug(84, 5) ("helperHandleRead: %d bytes from %s #%d.\n",
- (int)len, hlp->id_name, srv->index + 1);
+ debugs(84, 5, "helperHandleRead: " << (int)len << " bytes from " << hlp->id_name << " #" << srv->index + 1 << ".");
if (flag != COMM_OK || len <= 0) {
if (len < 0)
- debug(84, 1) ("helperHandleRead: FD %d read: %s\n", fd, xstrerror());
+ debugs(84, 1, "helperHandleRead: FD " << fd << " read: " << xstrerror());
comm_close(fd);
srv->roffset += len;
srv->rbuf[srv->roffset] = '\0';
- debug(84, 9) ("helperHandleRead: '%s'\n", srv->rbuf);
+ debugs(84, 9, "helperHandleRead: '" << srv->rbuf << "'");
if (!srv->stats.pending) {
/* someone spoke without being spoken to */
- debug(84, 1) ("helperHandleRead: unexpected read from %s #%d, %d bytes '%s'\n",
- hlp->id_name, srv->index + 1, (int)len, srv->rbuf);
+ debugs(84, 1, "helperHandleRead: unexpected read from " <<
+ hlp->id_name << " #" << srv->index + 1 << ", " << (int)len <<
+ " bytes '" << srv->rbuf << "'");
+
srv->roffset = 0;
srv->rbuf[0] = '\0';
}
helper_request *r;
char *msg = srv->rbuf;
int i = 0;
- debug(84, 3) ("helperHandleRead: end of reply found\n");
+ debugs(84, 3, "helperHandleRead: end of reply found");
if (t > srv->rbuf && t[-1] == '\r')
t[-1] = '\0';
helperRequestFree(r);
} else {
- debug(84, 1) ("helperHandleRead: unexpected reply on channel %d from %s #%d '%s'\n",
- i, hlp->id_name, srv->index + 1, srv->rbuf);
+ debugs(84, 1, "helperHandleRead: unexpected reply on channel " <<
+ i << " from " << hlp->id_name << " #" << srv->index + 1 <<
+ " '" << srv->rbuf << "'");
+
}
srv->roffset -= (t - srv->rbuf);
return;
}
- debug(84, 5) ("helperStatefulHandleRead: %d bytes from %s #%d.\n",
- (int)len, hlp->id_name, srv->index + 1);
+ debugs(84, 5, "helperStatefulHandleRead: " << (int)len << " bytes from " <<
+ hlp->id_name << " #" << srv->index + 1 << ".");
+
if (flag != COMM_OK || len <= 0) {
if (len < 0)
- debug(84, 1) ("helperStatefulHandleRead: FD %d read: %s\n", fd, xstrerror());
+ debugs(84, 1, "helperStatefulHandleRead: FD " << fd << " read: " << xstrerror());
comm_close(fd);
if (r == NULL) {
/* someone spoke without being spoken to */
- debug(84, 1) ("helperStatefulHandleRead: unexpected read from %s #%d, %d bytes '%s'\n",
- hlp->id_name, srv->index + 1, (int)len, srv->rbuf);
+ debugs(84, 1, "helperStatefulHandleRead: unexpected read from " <<
+ hlp->id_name << " #" << srv->index + 1 << ", " << (int)len <<
+ " bytes '" << srv->rbuf << "'");
+
srv->roffset = 0;
}
if ((t = strchr(srv->rbuf, '\n'))) {
/* end of reply found */
- debug(84, 3) ("helperStatefulHandleRead: end of reply found\n");
+ debugs(84, 3, "helperStatefulHandleRead: end of reply found");
if (t > srv->rbuf && t[-1] == '\r')
t[-1] = '\0';
if ((srv->parent->OnEmptyQueue != NULL) && (srv->data))
srv->parent->OnEmptyQueue(srv->data);
- debug(84, 5) ("StatefulHandleRead: releasing %s #%d\n", hlp->id_name, srv->index + 1);
+ debugs(84, 5, "StatefulHandleRead: releasing " << hlp->id_name << " #" << srv->index + 1);
} else {
srv->flags.reserved = S_HELPER_DEFERRED;
- debug(84, 5) ("StatefulHandleRead: outstanding deferred requests on %s #%d. reserving for deferred requests.\n", hlp->id_name, srv->index + 1);
+ debugs(84, 5, "StatefulHandleRead: outstanding deferred requests on " <<
+ hlp->id_name << " #" << srv->index + 1 <<
+ ". reserving for deferred requests.");
}
break;
if (!srv->queue.head) {
assert(srv->deferred_requests == 0);
srv->flags.reserved = S_HELPER_RESERVED;
- debug(84, 5) ("StatefulHandleRead: reserving %s #%d\n", hlp->id_name, srv->index + 1);
+ debugs(84, 5, "StatefulHandleRead: reserving " << hlp->id_name << " #" << srv->index + 1);
} else {
fatal("StatefulHandleRead: Callback routine attempted to reserve a stateful helper with deferred requests. This can lead to deadlock.\n");
}
srv->flags.reserved = S_HELPER_DEFERRED;
srv->deferred_requests++;
srv->stats.deferbycb++;
- debug(84, 5) ("StatefulHandleRead: reserving %s #%d for deferred requests.\n", hlp->id_name, srv->index + 1);
+ debugs(84, 5, "StatefulHandleRead: reserving " << hlp->id_name << " #" << srv->index + 1 << " for deferred requests.");
break;
default:
}
} else {
- debug(84, 1) ("StatefulHandleRead: no callback data registered\n");
+ debugs(84, 1, "StatefulHandleRead: no callback data registered");
}
srv->flags.busy = 0;
hlp->last_queue_warn = squid_curtime;
- debug(84, 0) ("WARNING: All %s processes are busy.\n", hlp->id_name);
+ debugs(84, 0, "WARNING: All " << hlp->id_name << " processes are busy.");
+ debugs(84, 0, "WARNING: " << hlp->stats.queue_size << " pending requests queued");
- debug(84, 0) ("WARNING: %d pending requests queued\n", hlp->stats.queue_size);
if (hlp->stats.queue_size > hlp->n_running * 2)
fatalf("Too many queued %s requests", hlp->id_name);
- debug(84, 1) ("Consider increasing the number of %s processes in your config file.\n", hlp->id_name);
+ debugs(84, 1, "Consider increasing the number of " << hlp->id_name << " processes in your config file.");
+
}
static void
hlp->last_queue_warn = squid_curtime;
- debug(84, 0) ("WARNING: All %s processes are busy.\n", hlp->id_name);
+ debugs(84, 0, "WARNING: All " << hlp->id_name << " processes are busy.");
- debug(84, 0) ("WARNING: %d pending requests queued\n", hlp->stats.queue_size);
+ debugs(84, 0, "WARNING: " << hlp->stats.queue_size << " pending requests queued");
+ debugs(84, 1, "Consider increasing the number of " << hlp->id_name << " processes in your config file.");
- debug(84, 1) ("Consider increasing the number of %s processes in your config file.\n", hlp->id_name);
}
static void
* if (shutting_down || reconfiguring)
* return;
* hlp->last_queue_warn = squid_curtime;
- * debug(84, 0) ("WARNING: All %s processes are busy.\n", hlp->id_name);
- * debug(84, 0) ("WARNING: %d pending requests queued\n", hlp->stats.queue_size);
+ * debugs(84, 0, "WARNING: All " << hlp->id_name << " processes are busy.");
+ * debugs(84, 0, "WARNING: " << hlp->stats.queue_size << " pending requests queued");
* if (hlp->stats.queue_size > hlp->n_running * 2)
* fatalf("Too many queued %s requests", hlp->id_name);
- * debug(84, 1) ("Consider increasing the number of %s processes in your config file.\n", hlp->id_name); */
+ * debugs(84, 1, "Consider increasing the number of " << hlp->id_name << " processes in your config file." ); */
}
{
dlink_node *n;
helper_stateful_server *srv = NULL;
- debug(84, 5) ("StatefulGetFirstAvailable: Running servers %d.\n", hlp->n_running);
+ debugs(84, 5, "StatefulGetFirstAvailable: Running servers " << hlp->n_running << ".");
if (hlp->n_running == 0)
return NULL;
return srv;
}
- debug(84, 5) ("StatefulGetFirstAvailable: None available.\n");
+ debugs(84, 5, "StatefulGetFirstAvailable: None available.");
return NULL;
}
if (flag != COMM_OK) {
/* Helper server has crashed */
- debug(84, 0) ("helperDispatch: Helper %s #%d has crashed\n",
- srv->parent->id_name, srv->index + 1);
+ debugs(84, 0, "helperDispatch: Helper " << srv->parent->id_name << " #" << srv->index + 1 << " has crashed");
return;
}
unsigned int slot;
if (!cbdataReferenceValid(r->data)) {
- debug(84, 1) ("helperDispatch: invalid callback data\n");
+ debugs(84, 1, "helperDispatch: invalid callback data");
helperRequestFree(r);
return;
}
srv, NULL); /* Handler-data, free func */
}
- debug(84, 5) ("helperDispatch: Request sent to %s #%d, %d bytes\n",
- hlp->id_name, srv->index + 1, (int) strlen(r->buf));
+ debugs(84, 5, "helperDispatch: Request sent to " << hlp->id_name << " #" << srv->index + 1 << ", " << (int) strlen(r->buf) << " bytes");
+
srv->stats.uses++;
hlp->stats.requests++;
}
statefulhelper *hlp = srv->parent;
if (!cbdataReferenceValid(r->data)) {
- debug(84, 1) ("helperStatefulDispatch: invalid callback data\n");
+ debugs(84, 1, "helperStatefulDispatch: invalid callback data");
helperStatefulRequestFree(r);
return;
}
- debug(84, 9) ("helperStatefulDispatch busying helper %s #%d\n", hlp->id_name, srv->index + 1);
+ debugs(84, 9, "helperStatefulDispatch busying helper " << hlp->id_name << " #" << srv->index + 1);
if (r->placeholder == 1) {
/* a callback is needed before this request can _use_ a helper. */
strlen(r->buf),
helperStatefulDispatchWriteDone, /* Handler */
hlp, NULL); /* Handler-data, free func */
- debug(84, 5) ("helperStatefulDispatch: Request sent to %s #%d, %d bytes\n",
- hlp->id_name, srv->index + 1, (int) strlen(r->buf));
+ debugs(84, 5, "helperStatefulDispatch: Request sent to " <<
+ hlp->id_name << " #" << srv->index + 1 << ", " <<
+ (int) strlen(r->buf) << " bytes");
+
srv->stats.uses++;
hlp->stats.requests++;
}
/*
- * $Id: htcp.cc,v 1.74 2007/04/21 07:14:14 wessels Exp $
+ * $Id: htcp.cc,v 1.75 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 31 Hypertext Caching Protocol
* AUTHOR: Duane Wesssels
int i;
int k;
char hex[80];
- debug(31, 3) ("htcpHexdump %s\n", tag);
+ debugs(31, 3, "htcpHexdump " << tag);
memset(hex, '\0', 80);
for (i = 0; i < sz; i++) {
if (k < 15 && i < (sz - 1))
continue;
- debug(31, 3) ("\t%s\n", hex);
+ debugs(31, 3, "\t" << hex);
memset(hex, '\0', 80);
}
debugs(31, 3, "htcpBuildCountstr: LENGTH = " << len);
- debug(31, 3) ("htcpBuildCountstr: TEXT = {%s}\n", s ? s : "<NULL>");
+ debugs(31, 3, "htcpBuildCountstr: TEXT = {" << (s ? s : "<NULL>") << "}");
length = htons((u_int16_t) len);
off += s;
- debug(31, 3) ("htcpBuildSpecifier: size %d\n", (int) off);
+ debugs(31, 3, "htcpBuildSpecifier: size " << (int) off);
return off;
}
switch (stuff->rr) {
case RR_REQUEST:
- debug(31, 3) ("htcpBuildTstOpData: RR_REQUEST\n");
+ debugs(31, 3, "htcpBuildTstOpData: RR_REQUEST");
return htcpBuildSpecifier(buf, buflen, stuff);
case RR_RESPONSE:
- debug(31, 3) ("htcpBuildTstOpData: RR_RESPONSE\n");
- debug(31, 3) ("htcpBuildTstOpData: F1 = %d\n", stuff->f1);
+ debugs(31, 3, "htcpBuildTstOpData: RR_RESPONSE");
+ debugs(31, 3, "htcpBuildTstOpData: F1 = " << stuff->f1);
if (stuff->f1) /* cache miss */
return 0;
htcpBuildOpData(char *buf, size_t buflen, htcpStuff * stuff)
{
ssize_t off = 0;
- debug(31, 3) ("htcpBuildOpData: opcode %s\n",
- htcpOpcodeStr[stuff->op]);
+ debugs(31, 3, "htcpBuildOpData: opcode " << htcpOpcodeStr[stuff->op]);
switch (stuff->op) {
off += op_data_sz;
- debug(31, 3) ("htcpBuildData: hdr.length = %d\n", (int) off);
+ debugs(31, 3, "htcpBuildData: hdr.length = " << (int) off);
hdr.length = (u_int16_t) off;
xmemcpy(buf, &hdrSquid, hdr_sz);
}
- debug(31, 3) ("htcpBuildData: size %d\n", (int) off);
+ debugs(31, 3, "htcpBuildData: size " << (int) off);
return off;
}
xmemcpy(buf, &hdr, hdr_sz);
- debug(31, 3) ("htcpBuildPacket: size %d\n", (int) off);
+ debugs(31, 3, "htcpBuildPacket: size " << (int) off);
return off;
}
len);
if (x < 0)
- debug(31, 1) ("htcpSend: FD %d sendto: %s\n", htcpOutSocket, xstrerror());
+ debugs(31, 1, "htcpSend: FD " << htcpOutSocket << " sendto: " << xstrerror());
else
statCounter.htcp.pkts_sent++;
}
buf += 2;
if (l > sz) {
- debug(31, 1) ("htcpUnpackSpecifier: failed to unpack METHOD\n");
+ debugs(31, 1, "htcpUnpackSpecifier: failed to unpack METHOD");
htcpFreeSpecifier(s);
return NULL;
}
sz -= 2;
if (l > sz) {
- debug(31, 1) ("htcpUnpackSpecifier: failed to unpack URI\n");
+ debugs(31, 1, "htcpUnpackSpecifier: failed to unpack URI");
htcpFreeSpecifier(s);
return NULL;
}
sz -= 2;
if (l > sz) {
- debug(31, 1) ("htcpUnpackSpecifier: failed to unpack VERSION\n");
+ debugs(31, 1, "htcpUnpackSpecifier: failed to unpack VERSION");
htcpFreeSpecifier(s);
return NULL;
}
sz -= 2;
if (l > sz) {
- debug(31, 1) ("htcpUnpackSpecifier: failed to unpack REQ-HDRS\n");
+ debugs(31, 1, "htcpUnpackSpecifier: failed to unpack REQ-HDRS");
htcpFreeSpecifier(s);
return NULL;
}
sz -= l;
- debug(31, 3) ("htcpUnpackSpecifier: %d bytes left\n", sz);
+ debugs(31, 3, "htcpUnpackSpecifier: " << sz << " bytes left");
/*
* Add terminating null to REQ-HDRS. This is possible because we allocated
buf += 2;
if (l > sz) {
- debug(31, 1) ("htcpUnpackDetail: failed to unpack RESP_HDRS\n");
+ debugs(31, 1, "htcpUnpackDetail: failed to unpack RESP_HDRS");
htcpFreeDetail(d);
return NULL;
}
sz -= 2;
if (l > sz) {
- debug(31, 1) ("htcpUnpackDetail: failed to unpack ENTITY_HDRS\n");
+ debugs(31, 1, "htcpUnpackDetail: failed to unpack ENTITY_HDRS");
htcpFreeDetail(d);
return NULL;
}
sz -= 2;
if (l > sz) {
- debug(31, 1) ("htcpUnpackDetail: failed to unpack CACHE_HDRS\n");
+ debugs(31, 1, "htcpUnpackDetail: failed to unpack CACHE_HDRS");
htcpFreeDetail(d);
return NULL;
}
sz -= l;
- debug(31, 3) ("htcpUnpackDetail: %d bytes left\n", sz);
+ debugs(31, 3, "htcpUnpackDetail: " << sz << " bytes left");
/*
* Add terminating null to CACHE-HDRS. This is possible because we allocated
stuff.rr = RR_RESPONSE;
stuff.f1 = 0;
stuff.response = e ? 0 : 1;
- debug(31, 3) ("htcpTstReply: response = %d\n", stuff.response);
+ debugs(31, 3, "htcpTstReply: response = " << stuff.response);
stuff.msg_id = dhdr->msg_id;
if (spec)
squid_curtime - e->timestamp : 0);
hdr.packInto(&p);
stuff.D.resp_hdrs = xstrdup(mb.buf);
- debug(31, 3) ("htcpTstReply: resp_hdrs = {%s}\n", stuff.D.resp_hdrs);
+ debugs(31, 3, "htcpTstReply: resp_hdrs = {" << stuff.D.resp_hdrs << "}");
mb.reset();
hdr.reset();
stuff.D.entity_hdrs = xstrdup(mb.buf);
- debug(31, 3) ("htcpTstReply: entity_hdrs = {%s}\n", stuff.D.entity_hdrs);
+ debugs(31, 3, "htcpTstReply: entity_hdrs = {" << stuff.D.entity_hdrs << "}");
mb.reset();
hdr.packInto(&p);
stuff.D.cache_hdrs = xstrdup(mb.buf);
- debug(31, 3) ("htcpTstReply: cache_hdrs = {%s}\n", stuff.D.cache_hdrs);
+ debugs(31, 3, "htcpTstReply: cache_hdrs = {" << stuff.D.cache_hdrs << "}");
mb.clean();
hdr.clean();
packerClean(&p);
if (!pktlen)
{
- debug(31, 1) ("htcpTstReply: htcpBuildPacket() failed\n");
+ debugs(31, 1, "htcpTstReply: htcpBuildPacket() failed");
return;
}
stuff.response = purgeSucceeded ? 0 : 2;
- debug(31, 3) ("htcpClrReply: response = %d\n", stuff.response);
+ debugs(31, 3, "htcpClrReply: response = " << stuff.response);
stuff.msg_id = dhdr->msg_id;
if (pktlen == 0)
{
- debug(31, 1) ("htcpClrReply: htcpBuildPacket() failed\n");
+ debugs(31, 1, "htcpClrReply: htcpBuildPacket() failed");
return;
}
htcpHandleNop(htcpDataHeader * hdr, char *buf, int sz, struct sockaddr_in *from)
{
- debug(31, 3) ("htcpHandleNop: Unimplemented\n");
+ debugs(31, 3, "htcpHandleNop: Unimplemented");
}
void
checkHitRequest = request;
if (NULL == checkHitRequest) {
- debug(31, 3) ("htcpCheckHit: NO; failed to parse URL\n");
+ debugs(31, 3, "htcpCheckHit: NO; failed to parse URL");
checkedHit(NullStoreEntry::getInstance());
return;
}
blk_end = req_hdrs + strlen(req_hdrs);
if (!checkHitRequest->header.parse(req_hdrs, blk_end)) {
- debug(31, 3) ("htcpCheckHit: NO; failed to parse request headers\n");
+ debugs(31, 3, "htcpCheckHit: NO; failed to parse request headers");
delete checkHitRequest;
checkHitRequest = NULL;
checkedHit(NullStoreEntry::getInstance());
assert (e);
if (e->isNull()) {
- debug(31, 3) ("htcpCheckHit: NO; public object not found\n");
+ debugs(31, 3, "htcpCheckHit: NO; public object not found");
goto miss;
}
if (!e->validToSend()) {
- debug(31, 3) ("htcpCheckHit: NO; entry not valid to send\n");
+ debugs(31, 3, "htcpCheckHit: NO; entry not valid to send" );
goto miss;
}
if (refreshCheckHTCP(e, checkHitRequest)) {
- debug(31, 3) ("htcpCheckHit: NO; cached response is stale\n");
+ debugs(31, 3, "htcpCheckHit: NO; cached response is stale");
goto miss;
}
- debug(31, 3) ("htcpCheckHit: YES!?\n");
+ debugs(31, 3, "htcpCheckHit: YES!?");
hit = e;
miss:
static void
htcpClrStoreEntry(StoreEntry * e)
{
- debug(31, 4) ("htcpClrStoreEntry: Clearing store for entry: %s\n", e->url());
+ debugs(31, 4, "htcpClrStoreEntry: Clearing store for entry: " << e->url() );
e->releaseRequest();
}
int released = 0;
if (request == NULL) {
- debug(31, 3) ("htcpClrStore: failed to parse URL\n");
+ debugs(31, 3, "htcpClrStore: failed to parse URL");
return -1;
}
blk_end = s->req_hdrs + strlen(s->req_hdrs);
if (!request->header.parse(s->req_hdrs, blk_end)) {
- debug(31, 2) ("htcpClrStore: failed to parse request headers\n");
+ debugs(31, 2, "htcpClrStore: failed to parse request headers");
return -1;
}
}
if (released) {
- debug(31, 4) ("htcpClrStore: Cleared %d matching entries\n", released);
+ debugs(31, 4, "htcpClrStore: Cleared " << released << " matching entries");
return 1;
} else {
- debug(31, 4) ("htcpClrStore: No matching entry found\n");
+ debugs(31, 4, "htcpClrStore: No matching entry found");
return 0;
}
}
htcpHandleTst(htcpDataHeader * hdr, char *buf, int sz, struct sockaddr_in *from)
{
- debug(31, 3) ("htcpHandleTst: sz = %d\n", (int) sz);
+ debugs(31, 3, "htcpHandleTst: sz = " << (int) sz);
if (hdr->RR == RR_REQUEST)
htcpHandleTstRequest(hdr, buf, sz, from);
if (queried_id[hdr->msg_id % N_QUERIED_KEYS] != hdr->msg_id)
{
- debug(31, 2) ("htcpHandleTstResponse: No matching query id '%d' (expected %d) from '%s'\n", hdr->msg_id, queried_id[hdr->msg_id % N_QUERIED_KEYS], inet_ntoa(from->sin_addr));
+ debugs(31, 2, "htcpHandleTstResponse: No matching query id '" <<
+ hdr->msg_id << "' (expected " <<
+ queried_id[hdr->msg_id % N_QUERIED_KEYS] << ") from '" <<
+ inet_ntoa(from->sin_addr) << "'");
+
return;
}
if (!key)
{
- debug(31, 1) ("htcpHandleTstResponse: No query key for response id '%d' from '%s'\n", hdr->msg_id, inet_ntoa(from->sin_addr));
+ debugs(31, 1, "htcpHandleTstResponse: No query key for response id '" << hdr->msg_id << "' from '" << inet_ntoa(from->sin_addr) << "'");
return;
}
if (peer->sin_addr.s_addr != from->sin_addr.s_addr || peer->sin_port != from->sin_port)
{
- debug(31, 1) ("htcpHandleTstResponse: Unexpected response source %s\n", inet_ntoa(from->sin_addr));
+ debugs(31, 1, "htcpHandleTstResponse: Unexpected response source " << inet_ntoa(from->sin_addr));
return;
}
if (hdr->F1 == 1)
{
- debug(31, 2) ("htcpHandleTstResponse: error condition, F1/MO == 1\n");
+ debugs(31, 2, "htcpHandleTstResponse: error condition, F1/MO == 1");
return;
}
htcpReply.msg_id = hdr->msg_id;
- debug(31, 3) ("htcpHandleTstResponse: msg_id = %d\n", (int) htcpReply.msg_id);
+ debugs(31, 3, "htcpHandleTstResponse: msg_id = " << (int) htcpReply.msg_id);
htcpReply.hit = hdr->response ? 0 : 1;
if (hdr->F1)
{
- debug(31, 3) ("htcpHandleTstResponse: MISS\n");
+ debugs(31, 3, "htcpHandleTstResponse: MISS");
} else
{
- debug(31, 3) ("htcpHandleTstResponse: HIT\n");
+ debugs(31, 3, "htcpHandleTstResponse: HIT");
d = htcpUnpackDetail(buf, sz);
if (d == NULL) {
- debug(31, 1) ("htcpHandleTstResponse: bad DETAIL\n");
+ debugs(31, 1, "htcpHandleTstResponse: bad DETAIL");
return;
}
htcpReply.hdr.parse(t, t + strlen(t));
}
- debug(31, 3) ("htcpHandleTstResponse: key (%p) %s\n", key, storeKeyText(key));
+ debugs(31, 3, "htcpHandleTstResponse: key (" << key << ") " << storeKeyText(key));
neighborsHtcpReply(key, &htcpReply, from);
htcpReply.hdr.clean();
if (sz == 0)
{
- debug(31, 3) ("htcpHandleTst: nothing to do\n");
+ debugs(31, 3, "htcpHandleTst: nothing to do");
return;
}
if (NULL == s)
{
- debug(31, 2) ("htcpHandleTstRequest: htcpUnpackSpecifier failed\n");
+ debugs(31, 2, "htcpHandleTstRequest: htcpUnpackSpecifier failed");
return;
}
if (!s->request)
{
- debug(31, 2) ("htcpHandleTstRequest: failed to parse request\n");
+ debugs(31, 2, "htcpHandleTstRequest: failed to parse request");
htcpFreeSpecifier(s);
return;
}
if (!htcpAccessCheck(Config.accessList.htcp, s, from))
{
- debug(31, 2) ("htcpHandleTstRequest: Access denied\n");
+ debugs(31, 2, "htcpHandleTstRequest: Access denied");
htcpFreeSpecifier(s);
return;
}
- debug(31, 3) ("htcpHandleTstRequest: %s %s %s\n",
- s->method,
- s->uri,
- s->version);
- debug(31, 3) ("htcpHandleTstRequest: %s\n", s->req_hdrs);
+ debugs(31, 3, "htcpHandleTstRequest: " << s->method << " " << s->uri << " " << s->version);
+ debugs(31, 3, "htcpHandleTstRequest: " << s->req_hdrs);
s->checkHit();
}
htcpHandleMon(htcpDataHeader * hdr, char *buf, int sz, struct sockaddr_in *from)
{
- debug(31, 3) ("htcpHandleMon: Unimplemented\n");
+ debugs(31, 3, "htcpHandleMon: Unimplemented");
}
static void
htcpHandleSet(htcpDataHeader * hdr, char *buf, int sz, struct sockaddr_in *from)
{
- debug(31, 3) ("htcpHandleSet: Unimplemented\n");
+ debugs(31, 3, "htcpHandleSet: Unimplemented");
}
static void
htcpSpecifier *s;
/* buf[0/1] is reserved and reason */
int reason = buf[1] << 4;
- debug(31, 3) ("htcpHandleClr: reason=%d\n", reason);
+ debugs(31, 3, "htcpHandleClr: reason=" << reason);
buf += 2;
sz -= 2;
if (sz == 0)
{
- debug(31, 4) ("htcpHandleClr: nothing to do\n");
+ debugs(31, 4, "htcpHandleClr: nothing to do");
return;
}
if (NULL == s)
{
- debug(31, 3) ("htcpHandleClr: htcpUnpackSpecifier failed\n");
+ debugs(31, 3, "htcpHandleClr: htcpUnpackSpecifier failed");
return;
}
if (!htcpAccessCheck(Config.accessList.htcp_clr, s, from))
{
- debug(31, 2) ("htcpHandleClr: Access denied\n");
+ debugs(31, 2, "htcpHandleClr: Access denied");
htcpFreeSpecifier(s);
return;
}
- debug(31, 5) ("htcpHandleClr: %s %s %s\n",
- s->method,
- s->uri,
- s->version);
- debug(31, 5) ("htcpHandleClr: request headers: %s\n", s->req_hdrs);
+ debugs(31, 5, "htcpHandleClr: " << s->method << " " << s->uri << " " << s->version);
+ debugs(31, 5, "htcpHandleClr: request headers: " << s->req_hdrs);
/* Release objects from cache
* analog to clientPurgeRequest in client_side.c
if ((size_t)sz < sizeof(htcpDataHeader))
{
- debug(31, 1) ("htcpHandleData: msg size less than htcpDataHeader size\n");
+ debugs(31, 1, "htcpHandleData: msg size less than htcpDataHeader size");
return;
}
hdr.length = ntohs(hdr.length);
hdr.msg_id = ntohl(hdr.msg_id);
- debug(31, 3) ("htcpHandleData: sz = %d\n", sz);
- debug(31, 3) ("htcpHandleData: length = %d\n", (int) hdr.length);
+ debugs(31, 3, "htcpHandleData: sz = " << sz);
+ debugs(31, 3, "htcpHandleData: length = " << (int) hdr.length);
if (hdr.opcode >= HTCP_END)
{
- debug(31, 1) ("htcpHandleData: client %s, opcode %d out of range\n",
- inet_ntoa(from->sin_addr),
- (int) hdr.opcode);
+ debugs(31, 1, "htcpHandleData: client " << inet_ntoa(from->sin_addr) << ", opcode " << (int) hdr.opcode << " out of range");
return;
}
- debug(31, 3) ("htcpHandleData: opcode = %d %s\n",
- (int) hdr.opcode, htcpOpcodeStr[hdr.opcode]);
- debug(31, 3) ("htcpHandleData: response = %d\n", (int) hdr.response);
- debug(31, 3) ("htcpHandleData: F1 = %d\n", (int) hdr.F1);
- debug(31, 3) ("htcpHandleData: RR = %d\n", (int) hdr.RR);
- debug(31, 3) ("htcpHandleData: msg_id = %d\n", (int) hdr.msg_id);
+ debugs(31, 3, "htcpHandleData: opcode = " << (int) hdr.opcode << " " << htcpOpcodeStr[hdr.opcode]);
+ debugs(31, 3, "htcpHandleData: response = " << (int) hdr.response);
+ debugs(31, 3, "htcpHandleData: F1 = " << (int) hdr.F1);
+ debugs(31, 3, "htcpHandleData: RR = " << (int) hdr.RR);
+ debugs(31, 3, "htcpHandleData: msg_id = " << (int) hdr.msg_id);
if (sz < hdr.length)
{
- debug(31, 1) ("htcpHandleData: sz < hdr.length\n");
+ debugs(31, 1, "htcpHandleData: sz < hdr.length");
return;
}
sz -= sizeof(htcpDataHeader);
- debug(31, 3) ("htcpHandleData: sz = %d\n", sz);
+ debugs(31, 3, "htcpHandleData: sz = " << sz);
htcpHexdump("htcpHandleData", buf, sz);
if ((size_t)sz < sizeof(htcpHeader))
{
- debug(31, 1) ("htcpHandle: msg size less than htcpHeader size\n");
+ debugs(31, 1, "htcpHandle: msg size less than htcpHeader size");
return;
}
else
old_squid_format = 0;
- debug(31, 3) ("htcpHandle: htcpHdr.length = %d\n", (int) htcpHdr.length);
-
- debug(31, 3) ("htcpHandle: htcpHdr.major = %d\n", (int) htcpHdr.major);
-
- debug(31, 3) ("htcpHandle: htcpHdr.minor = %d\n", (int) htcpHdr.minor);
+ debugs(31, 3, "htcpHandle: htcpHdr.length = " << (int) htcpHdr.length);
+ debugs(31, 3, "htcpHandle: htcpHdr.major = " << (int) htcpHdr.major);
+ debugs(31, 3, "htcpHandle: htcpHdr.minor = " << (int) htcpHdr.minor);
if (sz != htcpHdr.length)
{
- debug(31, 1) ("htcpHandle: sz/%d != htcpHdr.length/%d from %s:%d\n",
- sz, htcpHdr.length,
- inet_ntoa(from->sin_addr), (int) ntohs(from->sin_port));
+ debugs(31, 1, "htcpHandle: sz/" << sz << " != htcpHdr.length/" <<
+ htcpHdr.length << " from " << inet_ntoa(from->sin_addr) << ":" <<
+ (int) ntohs(from->sin_port));
+
return;
}
if (htcpHdr.major != 0)
{
- debug(31, 1) ("htcpHandle: Unknown major version %d from %s:%d\n",
- htcpHdr.major,
- inet_ntoa(from->sin_addr), (int) ntohs(from->sin_port));
+ debugs(31, 1, "htcpHandle: Unknown major version " << htcpHdr.major <<
+ " from " << inet_ntoa(from->sin_addr) << ":" <<
+ (int) ntohs(from->sin_port));
+
return;
}
/* Receive up to 8191 bytes, leaving room for a null */
len = comm_udp_recvfrom(fd, buf, sizeof(buf) - 1, 0, (struct sockaddr *) &from, &flen);
- debug(31, 3) ("htcpRecv: FD %d, %d bytes from %s:%d\n",
- fd, len, inet_ntoa(from.sin_addr), ntohs(from.sin_port));
+ debugs(31, 3, "htcpRecv: FD " << fd << ", " << len << " bytes from " <<
+ inet_ntoa(from.sin_addr) << ":" << ntohs(from.sin_port));
if (len)
statCounter.htcp.pkts_recv++;
htcpInit(void)
{
if (Config.Port.htcp <= 0) {
- debug(31, 1) ("HTCP Disabled.\n");
+ debugs(31, 1, "HTCP Disabled.");
return;
}
commSetSelect(htcpInSocket, COMM_SELECT_READ, htcpRecv, NULL, 0);
- debug(31, 1) ("Accepting HTCP messages on port %d, FD %d.\n",
- (int) Config.Port.htcp, htcpInSocket);
+ debugs(31, 1, "Accepting HTCP messages on port " << (int) Config.Port.htcp << ", FD " << htcpInSocket << ".");
if (Config.Addrs.udp_outgoing.s_addr != no_addr.s_addr) {
enter_suid();
commSetSelect(htcpOutSocket, COMM_SELECT_READ, htcpRecv, NULL, 0);
- debug(31, 1) ("Outgoing HTCP messages on port %d, FD %d.\n",
- (int) Config.Port.htcp, htcpOutSocket);
+ debugs(31, 1, "Outgoing HTCP messages on port " << (int) Config.Port.htcp << ", FD " << htcpOutSocket << ".");
fd_note(htcpInSocket, "Incoming HTCP socket");
} else {
mb.clean();
if (!pktlen) {
- debug(31, 1) ("htcpQuery: htcpBuildPacket() failed\n");
+ debugs(31, 1, "htcpQuery: htcpBuildPacket() failed");
return;
}
save_key = queried_keys[stuff.msg_id % N_QUERIED_KEYS];
storeKeyCopy(save_key, (const cache_key *)e->key);
queried_addr[stuff.msg_id % N_QUERIED_KEYS] = p->in_addr;
- debug(31, 3) ("htcpQuery: key (%p) %s\n", save_key, storeKeyText(save_key));
+ debugs(31, 3, "htcpQuery: key (" << save_key << ") " << storeKeyText(save_key));
}
/*
return;
if (htcpInSocket != htcpOutSocket) {
- debug(12, 1) ("FD %d Closing HTCP socket\n", htcpInSocket);
+ debugs(12, 1, "FD " << htcpInSocket << " Closing HTCP socket");
comm_close(htcpInSocket);
}
htcpSocketShutdown();
if (htcpOutSocket > -1) {
- debug(12, 1) ("FD %d Closing HTCP socket\n", htcpOutSocket);
+ debugs(12, 1, "FD " << htcpOutSocket << " Closing HTCP socket");
comm_close(htcpOutSocket);
htcpOutSocket = -1;
}
/*
- * $Id: http.cc,v 1.516 2007/04/24 23:13:25 wessels Exp $
+ * $Id: http.cc,v 1.517 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 11 Hypertext Transfer Protocol (HTTP)
* AUTHOR: Harvest Derived
httpStateFree(int fd, void *data)
{
HttpStateData *httpState = static_cast<HttpStateData *>(data);
- debug(11,5)("httpStateFree: FD %d, httpState=%p\n", fd, data);
+ debugs(11, 5, "httpStateFree: FD " << fd << ", httpState=" << data);
delete httpState;
}
{
HttpStateData *httpState = static_cast<HttpStateData *>(data);
StoreEntry *entry = httpState->entry;
- debug(11, 4) ("httpTimeout: FD %d: '%s'\n", fd, entry->url());
+ debugs(11, 4, "httpTimeout: FD " << fd << ": '" << entry->url() << "'" );
if (entry->store_status == STORE_PENDING) {
httpState->fwd->fail(errorCon(ERR_READ_TIMEOUT, HTTP_GATEWAY_TIMEOUT, httpState->fwd->request));
*/
if (!refreshIsCachable(entry)) {
- debug(22, 3) ("refreshIsCachable() returned non-cacheable..\n");
+ debugs(22, 3, "refreshIsCachable() returned non-cacheable..");
return 0;
}
vary.clean();
#endif
- debug(11, 3) ("httpMakeVaryMark: %s\n", vstr.buf());
+ debugs(11, 3, "httpMakeVaryMark: " << vstr.buf());
return vstr.buf();
}
_peer->stats.n_keepalives_recv++;
if (Config.onoff.detect_broken_server_pconns && reply->bodySize(request->method) == -1) {
- debug(11, 1) ("keepaliveAccounting: Impossible keep-alive header from '%s'\n", entry->url());
- // debug(11, 2) ("GOT HTTP REPLY HDR:\n---------\n%s\n----------\n", readBuf->content());
+ debugs(11, 1, "keepaliveAccounting: Impossible keep-alive header from '" << entry->url() << "'" );
+ // debugs(11, 2, "GOT HTTP REPLY HDR:\n---------\n" << readBuf->content() << "\n----------" );
flags.keepalive_broken = 1;
}
}
int skew = abs((int)(reply->date - squid_curtime));
if (skew > 86400)
- debug(11, 3) ("%s's clock is skewed by %d seconds!\n",
- request->host, skew);
+ debugs(11, 3, "" << request->host << "'s clock is skewed by " << skew << " seconds!");
}
}
*/
HttpReply *newrep = new HttpReply;
Ctx ctx = ctx_enter(entry->mem_obj->url);
- debug(11, 3) ("processReplyHeader: key '%s'\n", entry->getMD5Text());
+ debugs(11, 3, "processReplyHeader: key '" << entry->getMD5Text() << "'");
assert(!flags.headers_parsed);
reply = HTTPMSGLOCK(newrep);
- debug(11, 9) ("GOT HTTP REPLY HDR:\n---------\n%s\n----------\n",
- readBuf->content());
+ debugs(11, 9, "GOT HTTP REPLY HDR:\n---------\n" << readBuf->content() << "\n----------");
header_bytes_read = headersEnd(readBuf->content(), readBuf->contentSize());
readBuf->consume(header_bytes_read);
entry->timestampsSet();
/* Check if object is cacheable or not based on reply code */
- debug(11, 3) ("haveParsedReplyHeaders: HTTP CODE: %d\n", getReply()->sline.status);
+ debugs(11, 3, "haveParsedReplyHeaders: HTTP CODE: " << getReply()->sline.status);
if (neighbors_do_private_keys)
httpMaybeRemovePublic(entry, getReply()->sline.status);
* connection.
*/
if (!flags.request_sent) {
- debug(11, 1) ("statusIfComplete: Request not yet fully sent \"%s %s\"\n",
- RequestMethodStr[orig_request->method],
- entry->url());
+ debugs(11, 1, "statusIfComplete: Request not yet fully sent \"" << RequestMethodStr[orig_request->method] << " " << entry->url() << "\"" );
return COMPLETE_NONPERSISTENT_MSG;
}
HttpStateData::ConnectionStatus
HttpStateData::persistentConnStatus() const
{
- debug(11, 3) ("persistentConnStatus: FD %d\n", fd);
- debug(11, 5) ("persistentConnStatus: content_length=%d\n",
- reply->content_length);
+ debugs(11, 3, "persistentConnStatus: FD " << fd);
+ debugs(11, 5, "persistentConnStatus: content_length=" << reply->content_length);
/* If we haven't seen the end of reply headers, we are not done */
- debug(11,5)("persistentConnStatus: flags.headers_parsed=%d\n", flags.headers_parsed);
+ debugs(11, 5, "persistentConnStatus: flags.headers_parsed=" << flags.headers_parsed);
if (!flags.headers_parsed)
return INCOMPLETE_MSG;
const int clen = reply->bodySize(request->method);
- debug(11,5)("persistentConnStatus: clen=%d\n", clen);
+ debugs(11, 5, "persistentConnStatus: clen=" << clen);
/* If the body size is unknown we must wait for EOF */
if (clen < 0)
*/
if (flag == COMM_ERR_CLOSING) {
- debug (11,3)("http socket closing\n");
+ debugs(11, 3, "http socket closing");
return;
}
errno = 0;
/* prepare the read size for the next read (if any) */
- debug(11, 5) ("httpReadReply: FD %d: len %d.\n", fd, (int)len);
+ debugs(11, 5, "httpReadReply: FD " << fd << ": len " << (int)len << ".");
if (flag == COMM_OK && len > 0) {
readBuf->appended(len);
#endif
if (flag != COMM_OK || len < 0) {
- debug(50, 2) ("httpReadReply: FD %d: read failure: %s.\n",
- fd, xstrerror());
+ debugs(50, 2, "httpReadReply: FD " << fd << ": read failure: " << xstrerror() << ".");
if (ignoreErrno(errno)) {
flags.do_next_read = 1;
switch (persistentConnStatus()) {
case INCOMPLETE_MSG:
- debug(11,5)("processReplyBody: INCOMPLETE_MSG\n");
+ debugs(11, 5, "processReplyBody: INCOMPLETE_MSG");
/* Wait for more data or EOF condition */
if (flags.keepalive_broken) {
break;
case COMPLETE_PERSISTENT_MSG:
- debug(11,5)("processReplyBody: COMPLETE_PERSISTENT_MSG\n");
+ debugs(11, 5, "processReplyBody: COMPLETE_PERSISTENT_MSG");
/* yes we have to clear all these! */
commSetTimeout(fd, -1, NULL, NULL);
flags.do_next_read = 0;
return;
case COMPLETE_NONPERSISTENT_MSG:
- debug(11,5)("processReplyBody: COMPLETE_NONPERSISTENT_MSG\n");
+ debugs(11, 5, "processReplyBody: COMPLETE_NONPERSISTENT_MSG");
serverComplete();
return;
}
HttpStateData::SendComplete(int fd, char *bufnotused, size_t size, comm_err_t errflag, int xerrno, void *data)
{
HttpStateData *httpState = static_cast<HttpStateData *>(data);
- debug(11, 5) ("httpSendComplete: FD %d: size %d: errflag %d.\n",
- fd, (int) size, errflag);
+ debugs(11, 5, "httpSendComplete: FD " << fd << ": size " << (int) size << ": errflag " << errflag << ".");
#if URL_CHECKSUM_DEBUG
entry->mem_obj->checkUrlChecksum();
void
copyOneHeaderFromClientsideRequestToUpstreamRequest(const HttpHeaderEntry *e, String strConnection, HttpRequest * request, HttpRequest * orig_request, HttpHeader * hdr_out, int we_do_ranges, http_state_flags flags)
{
- debug(11, 5) ("httpBuildRequestHeader: %s: %s\n",
- e->name.buf(), e->value.buf());
+ debugs(11, 5, "httpBuildRequestHeader: " << e->name.buf() << ": " << e->value.buf());
if (!httpRequestHdrAllowed(e, &strConnection)) {
- debug(11, 2) ("'%s' header denied by anonymize_headers configuration\n",+ e->name.buf());
+ debugs(11, 2, "'" << e->name.buf() << "' header denied by anonymize_headers configuration");
return;
}
|| orig_request->range->offsetLimitExceeded())
result = false;
- debug(11, 8) ("decideIfWeDoRanges: range specs: %p, cachable: %d; we_do_ranges: %d\n",
- orig_request->range, orig_request->flags.cachable, result);
+ debugs(11, 8, "decideIfWeDoRanges: range specs: " <<
+ orig_request->range << ", cachable: " <<
+ orig_request->flags.cachable << "; we_do_ranges: " << result);
return result;
}
{
MemBuf mb;
- debug(11, 5) ("httpSendRequest: FD %d, request %p, this %p.\n", fd, request, this);
+ debugs(11, 5, "httpSendRequest: FD " << fd << ", request " << request << ", this " << this << ".");
commSetTimeout(fd, Config.Timeout.lifetime, httpTimeout, this);
flags.do_next_read = 1;
mb.init();
buildRequestPrefix(request, orig_request, entry, &mb, flags);
- debug(11, 6) ("httpSendRequest: FD %d:\n%s\n", fd, mb.buf);
+ debugs(11, 6, "httpSendRequest: FD " << fd << ":\n" << mb.buf);
comm_write_mbuf(fd, &mb, requestSender, this);
return true;
void
httpStart(FwdState *fwd)
{
- debug(11, 3) ("httpStart: \"%s %s\"\n",
- RequestMethodStr[fwd->request->method],
- fwd->entry->url());
+ debugs(11, 3, "httpStart: \"" << RequestMethodStr[fwd->request->method] << " " << fwd->entry->url() << "\"" );
HttpStateData *httpState = new HttpStateData(fwd);
if (!httpState->sendRequest()) {
- debug(11, 3) ("httpStart: aborted");
+ debugs(11, 3, "httpStart: aborted");
delete httpState;
return;
}
/* cbdataReferenceDone() happens in either fastCheck() or ~ACLCheckList */
if (!Config.accessList.brokenPosts) {
- debug(11, 5) ("doneSendingRequestBody: No brokenPosts list\n");
+ debugs(11, 5, "doneSendingRequestBody: No brokenPosts list");
HttpStateData::SendComplete(fd, NULL, 0, COMM_OK, 0, this);
} else if (!ch.fastCheck()) {
- debug(11, 5) ("doneSendingRequestBody: didn't match brokenPosts\n");
+ debugs(11, 5, "doneSendingRequestBody: didn't match brokenPosts");
HttpStateData::SendComplete(fd, NULL, 0, COMM_OK, 0, this);
} else {
- debug(11, 2) ("doneSendingRequestBody: matched brokenPosts\n");
+ debugs(11, 2, "doneSendingRequestBody: matched brokenPosts");
comm_write(fd, "\r\n", 2, HttpStateData::SendComplete, this, NULL);
}
}
if (flags.headers_parsed && !flags.abuse_detected) {
flags.abuse_detected = 1;
- debug(11, 1) ("http handleMoreRequestBodyAvailable: Likely proxy abuse detected '%s' -> '%s'\n",
- inet_ntoa(orig_request->client_addr),
- entry->url());
+ debugs(11, 1, "http handleMoreRequestBodyAvailable: Likely proxy abuse detected '" << inet_ntoa(orig_request->client_addr) << "' -> '" << entry->url() << "'" );
if (getReply()->sline.status == HTTP_INVALID_HEADER) {
comm_close(fd);
/*
- * $Id: icmp.cc,v 1.90 2007/04/19 21:25:38 wessels Exp $
+ * $Id: icmp.cc,v 1.91 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 37 ICMP Routines
* AUTHOR: Duane Wessels
0);
if (n < 0 && EAGAIN != errno) {
- debug(37, 1) ("icmpRecv: recv: %s\n", xstrerror());
+ debugs(37, 1, "icmpRecv: recv: " << xstrerror());
if (errno == ECONNREFUSED)
icmpClose();
break;
default:
- debug(37, 1) ("icmpRecv: Bad opcode: %d\n", (int) preply.opcode);
+ debugs(37, 1, "icmpRecv: Bad opcode: " << (int) preply.opcode);
break;
}
}
if (icmp_sock < 0)
return;
- debug(37, 2) ("icmpSend: to %s, opcode %d, len %d\n",
- inet_ntoa(pkt->to), (int) pkt->opcode, pkt->psize);
+ debugs(37, 2, "icmpSend: to " << inet_ntoa(pkt->to) << ", opcode " <<
+ (int) pkt->opcode << ", len " << pkt->psize);
x = comm_udp_send(icmp_sock, (char *) pkt, len, 0);
if (x < 0) {
- debug(37, 1) ("icmpSend: send: %s\n", xstrerror());
+ debugs(37, 1, "icmpSend: send: " << xstrerror());
if (errno == ECONNREFUSED || errno == EPIPE) {
icmpClose();
return;
}
} else if (x != len) {
- debug(37, 1) ("icmpSend: Wrote %d of %d bytes\n", x, len);
+ debugs(37, 1, "icmpSend: Wrote " << x << " of " << len << " bytes");
}
}
xmemcpy(&header, buf, sizeof(icp_common_t));
url = buf + sizeof(icp_common_t);
key = icpGetCacheKey(url, (int) header.reqnum);
- debug(37, 3) ("icmpHandleSourcePing: from %s, key '%s'\n",
- inet_ntoa(from->sin_addr), storeKeyText(key));
+ debugs(37, 3, "icmpHandleSourcePing: from " << inet_ntoa(from->sin_addr) << ", key '" << storeKeyText(key) << "'");
+
/* call neighborsUdpAck even if ping_status != PING_WAITING */
neighborsUdpAck(key, &header, from);
}
char *payload;
int len;
int ulen;
- debug(37, 3) ("icmpSourcePing: '%s'\n", url);
+ debugs(37, 3, "icmpSourcePing: '" << url << "'");
if ((ulen = strlen(url)) > MAX_URL)
return;
icmpDomainPing(struct IN_ADDR to, const char *domain)
{
#if USE_ICMP
- debug(37, 3) ("icmpDomainPing: '%s'\n", domain);
+ debugs(37, 3, "icmpDomainPing: '" << domain << "'");
icmpSendEcho(to, S_ICMP_DOM, domain, 0);
#endif
}
commSetTimeout(icmp_sock, -1, NULL, NULL);
- debug(37, 1) ("Pinger socket opened on FD %d\n", icmp_sock);
+ debugs(37, 1, "Pinger socket opened on FD " << icmp_sock);
#ifdef _SQUID_MSWIN_
- debug(37, 4) ("Pinger handle: 0x%x, PID: %d\n", (unsigned)hIpc, pid);
+ debugs(37, 4, "Pinger handle: 0x" << hex << (unsigned)hIpc << dec << ", PID: " << pid);
#endif
#endif
if (icmp_sock < 0)
return;
- debug(37, 1) ("Closing Pinger socket on FD %d\n", icmp_sock);
+ debugs(37, 1, "Closing Pinger socket on FD " << icmp_sock);
#ifdef _SQUID_MSWIN_
if (hIpc) {
if (WaitForSingleObject(hIpc, 12000) != WAIT_OBJECT_0) {
getCurrentTime();
- debug(37, 1)
- ("icmpClose: WARNING: (pinger,%ld) didn't exit in 12 seconds\n",
- (long int)pid);
+ debugs(37, 1, "icmpClose: WARNING: (pinger," << (long int)pid << ") didn't exit in 12 seconds");
}
CloseHandle(hIpc);
/*
- * $Id: icp_v2.cc,v 1.97 2007/04/21 07:14:14 wessels Exp $
+ * $Id: icp_v2.cc,v 1.98 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 12 Internet Cache Protocol
* AUTHOR: Duane Wessels
ICP2State::created (StoreEntry *newEntry)
{
StoreEntry *entry = newEntry->isNull () ? NULL : newEntry;
- debug(12, 5) ("icpHandleIcpV2: OPCODE %s\n", icp_opcode_str[header.opcode]);
+ debugs(12, 5, "icpHandleIcpV2: OPCODE " << icp_opcode_str[header.opcode]);
icp_opcode codeToSend;
if (icpCheckUdpHit(entry, request)) {
int x;
int len;
len = (int) ntohs(msg->length);
- debug(12, 5) ("icpUdpSend: FD %d sending %s, %d bytes to %s:%d\n",
- fd,
- icp_opcode_str[msg->opcode],
- len,
- inet_ntoa(to->sin_addr),
- ntohs(to->sin_port));
+ debugs(12, 5, "icpUdpSend: FD " << fd << " sending " <<
+ icp_opcode_str[msg->opcode] << ", " << len << " bytes to " <<
+ inet_ntoa(to->sin_addr) << ":" << ntohs(to->sin_port));
+
x = comm_udp_sendto(fd, to, sizeof(*to), msg, len);
if (x >= 0)
icpDenyAccess(struct sockaddr_in *from, char *url, int reqnum, int fd)
{
- debug(12, 2) ("icpDenyAccess: Access Denied for %s by %s.\n",
- inet_ntoa(from->sin_addr), AclMatchedName);
+ debugs(12, 2, "icpDenyAccess: Access Denied for " << inet_ntoa(from->sin_addr) << " by " << AclMatchedName << ".");
if (clientdbCutoffDenied(from->sin_addr))
{
{
if (neighbors_do_private_keys && reqnum == 0)
{
- debug(12, 0) ("icpHandleIcpV2: Neighbor %s returned reqnum = 0\n",
- inet_ntoa(from->sin_addr));
- debug(12, 0) ("icpHandleIcpV2: Disabling use of private keys\n");
+ debugs(12, 0, "icpHandleIcpV2: Neighbor " << inet_ntoa(from->sin_addr) << " returned reqnum = 0");
+ debugs(12, 0, "icpHandleIcpV2: Disabling use of private keys");
neighbors_do_private_keys = 0;
}
char *url = buf + sizeof(icp_common_t);
- debug(12, 3) ("icpHandleIcpV2: %s from %s for '%s'\n",
- icp_opcode_str[opcode],
- inet_ntoa(from->sin_addr),
- url);
+ debugs(12, 3, "icpHandleIcpV2: " << icp_opcode_str[opcode] << " from " << inet_ntoa(from->sin_addr) << " for '" << url << "'");
+
const cache_key *key = icpGetCacheKey(url, (int) reqnum);
/* call neighborsUdpAck even if ping_status != PING_WAITING */
neighborsUdpAck(key, this, from);
{
if (len <= 0)
{
- debug(12, 3) ("icpHandleIcpV2: ICP message is too small\n");
+ debugs(12, 3, "icpHandleIcpV2: ICP message is too small");
return;
}
if (len != header.length)
{
- debug(12, 3) ("icpHandleIcpV2: ICP message is too small\n");
+ debugs(12, 3, "icpHandleIcpV2: ICP message is too small");
return;
}
break;
default:
- debug(12, 0) ("icpHandleIcpV2: UNKNOWN OPCODE: %d from %s\n",
- header.opcode, inet_ntoa(from.sin_addr));
+ debugs(12, 0, "icpHandleIcpV2: UNKNOWN OPCODE: " << header.opcode << " from " << inet_ntoa(from.sin_addr));
+
break;
}
}
struct IN_ADDR a;
- debug(12, 9) ("opcode: %3d %s\n",
- (int) pkt->opcode,
- icp_opcode_str[pkt->opcode]);
- debug(12, 9) ("version: %-8d\n", (int) pkt->version);
- debug(12, 9) ("length: %-8d\n", (int) ntohs(pkt->length));
- debug(12, 9) ("reqnum: %-8d\n", ntohl(pkt->reqnum));
- debug(12, 9) ("flags: %-8x\n", ntohl(pkt->flags));
+ debugs(12, 9, "opcode: " << std::setw(3) << (int) pkt->opcode << " " << icp_opcode_str[pkt->opcode]);
+ debugs(12, 9, "version: "<< std::left << std::setw(8) << (int) pkt->version);
+ debugs(12, 9, "length: "<< std::left << std::setw(8) << (int) ntohs(pkt->length));
+ debugs(12, 9, "reqnum: "<< std::left << std::setw(8) << ntohl(pkt->reqnum));
+ debugs(12, 9, "flags: "<< std::left << std::hex << std::setw(8) << ntohl(pkt->flags));
a.s_addr = pkt->shostid;
- debug(12, 9) ("shostid: %s\n", inet_ntoa(a));
- debug(12, 9) ("payload: %s\n", (char *) pkt + sizeof(icp_common_t));
+ debugs(12, 9, "shostid: " << inet_ntoa(a));
+ debugs(12, 9, "payload: " << (char *) pkt + sizeof(icp_common_t));
}
#endif
if (errno != ECONNREFUSED && errno != EHOSTUNREACH)
#endif
- debug(50, 1) ("icpHandleUdp: FD %d recvfrom: %s\n",
- sock, xstrerror());
+ debugs(50, 1, "icpHandleUdp: FD " << sock << " recvfrom: " << xstrerror());
break;
}
(*N)++;
icpCount(buf, RECV, (size_t) len, 0);
buf[len] = '\0';
- debug(12, 4) ("icpHandleUdp: FD %d: received %lu bytes from %s.\n",
- sock,
- (unsigned long int)len,
- inet_ntoa(from.sin_addr));
+ debugs(12, 4, "icpHandleUdp: FD " << sock << ": received " <<
+ (unsigned long int)len << " bytes from " <<
+ inet_ntoa(from.sin_addr) << ".");
+
#ifdef ICP_PACKET_DUMP
icpPktDump(buf);
#endif
if ((size_t) len < sizeof(icp_common_t)) {
- debug(12, 4) ("icpHandleUdp: Ignoring too-small UDP packet\n");
+ debugs(12, 4, "icpHandleUdp: Ignoring too-small UDP packet");
break;
}
else if (icp_version == ICP_VERSION_3)
icpHandleIcpV3(sock, from, buf, len);
else
- debug(12, 1) ("WARNING: Unused ICP version %d received from %s:%d\n",
- icp_version,
- inet_ntoa(from.sin_addr),
- ntohs(from.sin_port));
+ debugs(12, 1, "WARNING: Unused ICP version " << icp_version <<
+ " received from " << inet_ntoa(from.sin_addr) << ":" << ntohs(from.sin_port));
}
}
for (s = Config.mcast_group_list; s; s = s->next)
ipcache_nbgethostbyname(s->key, mcastJoinGroups, NULL);
- debug(12, 1) ("Accepting ICP messages at %s, port %d, FD %d.\n",
- inet_ntoa(Config.Addrs.udp_incoming),
- (int) port, theInIcpConnection);
+ debugs(12, 1, "Accepting ICP messages at " <<
+ inet_ntoa(Config.Addrs.udp_incoming) << ", port " << (int) port <<
+ ", FD " << theInIcpConnection << ".");
+
if ((addr = Config.Addrs.udp_outgoing).s_addr != no_addr.s_addr) {
enter_suid();
NULL,
0);
- debug(12, 1) ("Outgoing ICP messages on port %d, FD %d.\n",
- (int) port, theOutIcpConnection);
+ debugs(12, 1, "Outgoing ICP messages on port " << (int) port << ", FD " << theOutIcpConnection << ".");
fd_note(theOutIcpConnection, "Outgoing ICP socket");
(struct sockaddr *) &xaddr, &len);
if (x < 0)
- debug(50, 1) ("theOutIcpConnection FD %d: getsockname: %s\n",
- theOutIcpConnection, xstrerror());
+ debugs(50, 1, "theOutIcpConnection FD " << theOutIcpConnection << ": getsockname: " << xstrerror());
else
theOutICPAddr = xaddr.sin_addr;
}
return;
if (theInIcpConnection != theOutIcpConnection) {
- debug(12, 1) ("FD %d Closing ICP connection\n", theInIcpConnection);
+ debugs(12, 1, "FD " << theInIcpConnection << " Closing ICP connection");
comm_close(theInIcpConnection);
}
icpConnectionShutdown();
if (theOutIcpConnection > -1) {
- debug(12, 1) ("FD %d Closing ICP connection\n", theOutIcpConnection);
+ debugs(12, 1, "FD " << theOutIcpConnection << " Closing ICP connection");
comm_close(theOutIcpConnection);
theOutIcpConnection = -1;
}
/*
- * $Id: icp_v3.cc,v 1.41 2007/04/19 20:21:34 wessels Exp $
+ * $Id: icp_v3.cc,v 1.42 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 12 Internet Cache Protocol
* AUTHOR: Duane Wessels
ICP3State::created (StoreEntry *newEntry)
{
StoreEntry *entry = newEntry->isNull () ? NULL : newEntry;
- debug(12, 5) ("icpHandleIcpV3: OPCODE %s\n",
- icp_opcode_str[header.opcode]);
+ debugs(12, 5, "icpHandleIcpV3: OPCODE " << icp_opcode_str[header.opcode]);
icp_opcode codeToSend;
if (icpCheckUdpHit(entry, request)) {
{
if (len <= 0)
{
- debug(12, 3) ("icpHandleIcpV3: ICP message is too small\n");
+ debugs(12, 3, "icpHandleIcpV3: ICP message is too small");
return;
}
if (len != header.length)
{
- debug(12, 3) ("icpHandleIcpV3: ICP message is too small\n");
+ debugs(12, 3, "icpHandleIcpV3: ICP message is too small");
return;
}
break;
default:
- debug(12, 0) ("icpHandleIcpV3: UNKNOWN OPCODE: %d from %s\n",
- header.opcode, inet_ntoa(from.sin_addr));
+ debugs(12, 0, "icpHandleIcpV3: UNKNOWN OPCODE: " << header.opcode << " from " << inet_ntoa(from.sin_addr));
break;
}
}
/*
- * $Id: ident.cc,v 1.74 2006/09/19 07:56:57 adrian Exp $
+ * $Id: ident.cc,v 1.75 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 30 Ident (RFC 931)
* AUTHOR: Duane Wessels
identTimeout(int fd, void *data)
{
IdentStateData *state = (IdentStateData *)data;
- debug(30, 3) ("identTimeout: FD %d, %s\n", fd,
- inet_ntoa(state->my_peer.sin_addr));
+ debugs(30, 3, "identTimeout: FD " << fd << ", " << inet_ntoa(state->my_peer.sin_addr));
+
comm_close(fd);
}
if ((t = strchr(buf, '\n')))
*t = '\0';
- debug(30, 5) ("identReadReply: FD %d: Read '%s'\n", fd, buf);
+ debugs(30, 5, "identReadReply: FD " << fd << ": Read '" << buf << "'");
if (strstr(buf, "USERID")) {
if ((ident = strrchr(buf, ':'))) {
/*
- * $Id: internal.cc,v 1.44 2007/04/21 07:14:14 wessels Exp $
+ * $Id: internal.cc,v 1.45 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 76 Internal Squid Object handling
* AUTHOR: Duane, Alex, Henrik
{
ErrorState *err;
const char *upath = request->urlpath.buf();
- debug(76, 3) ("internalStart: %s requesting '%s'\n",
- inet_ntoa(request->client_addr), upath);
+ debugs(76, 3, "internalStart: " << inet_ntoa(request->client_addr) << " requesting '" << upath << "'");
if (0 == strcmp(upath, "/squid-internal-dynamic/netdb")) {
netdbBinaryExchange(entry);
/*
- * $Id: ipc.cc,v 1.44 2006/09/03 19:28:10 serassio Exp $
+ * $Id: ipc.cc,v 1.45 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 54 Interprocess Communication
* AUTHOR: Duane Wessels
int c2p[2];
if (pipe(p2c) < 0) {
- debug(54, 0) ("ipcCreate: pipe: %s\n", xstrerror());
+ debugs(54, 0, "ipcCreate: pipe: " << xstrerror());
return -1;
}
if (pipe(c2p) < 0) {
- debug(54, 0) ("ipcCreate: pipe: %s\n", xstrerror());
+ debugs(54, 0, "ipcCreate: pipe: " << xstrerror());
return -1;
}
int buflen = 32768;
if (socketpair(AF_UNIX, SOCK_STREAM, 0, fds) < 0) {
- debug(54, 0) ("ipcCreate: socketpair: %s\n", xstrerror());
+ debugs(54, 0, "ipcCreate: socketpair: " << xstrerror());
return -1;
}
int fds[2];
if (socketpair(AF_UNIX, SOCK_DGRAM, 0, fds) < 0) {
- debug(54, 0) ("ipcCreate: socketpair: %s\n", xstrerror());
+ debugs(54, 0, "ipcCreate: socketpair: " << xstrerror());
return -1;
}
assert(IPC_NONE);
}
- debug(54, 3) ("ipcCreate: prfd FD %d\n", prfd);
- debug(54, 3) ("ipcCreate: pwfd FD %d\n", pwfd);
- debug(54, 3) ("ipcCreate: crfd FD %d\n", crfd);
- debug(54, 3) ("ipcCreate: cwfd FD %d\n", cwfd);
+ debugs(54, 3, "ipcCreate: prfd FD " << prfd);
+ debugs(54, 3, "ipcCreate: pwfd FD " << pwfd);
+ debugs(54, 3, "ipcCreate: crfd FD " << crfd);
+ debugs(54, 3, "ipcCreate: cwfd FD " << cwfd);
if (crfd < 0) {
- debug(54, 0) ("ipcCreate: Failed to create child FD.\n");
+ debugs(54, 0, "ipcCreate: Failed to create child FD.");
return ipcCloseAllFD(prfd, pwfd, crfd, cwfd);
}
if (pwfd < 0) {
- debug(54, 0) ("ipcCreate: Failed to create server FD.\n");
+ debugs(54, 0, "ipcCreate: Failed to create server FD.");
return ipcCloseAllFD(prfd, pwfd, crfd, cwfd);
}
memset(&PaS, '\0', len);
if (getsockname(pwfd, (struct sockaddr *) &PaS, &len) < 0) {
- debug(54, 0) ("ipcCreate: getsockname: %s\n", xstrerror());
+ debugs(54, 0, "ipcCreate: getsockname: " << xstrerror());
return ipcCloseAllFD(prfd, pwfd, crfd, cwfd);
}
- debug(54, 3) ("ipcCreate: FD %d sockaddr %s:%d\n",
- pwfd, inet_ntoa(PaS.sin_addr), ntohs(PaS.sin_port));
+ debugs(54, 3, "ipcCreate: FD " << pwfd << " sockaddr " << inet_ntoa(PaS.sin_addr) << ":" << ntohs(PaS.sin_port));
+
len = sizeof(ChS);
memset(&ChS, '\0', len);
if (getsockname(crfd, (struct sockaddr *) &ChS, &len) < 0) {
- debug(54, 0) ("ipcCreate: getsockname: %s\n", xstrerror());
+ debugs(54, 0, "ipcCreate: getsockname: " << xstrerror());
return ipcCloseAllFD(prfd, pwfd, crfd, cwfd);
}
- debug(54, 3) ("ipcCreate: FD %d sockaddr %s:%d\n",
- crfd, inet_ntoa(ChS.sin_addr), ntohs(ChS.sin_port));
+ debugs(54, 3, "ipcCreate: FD " << crfd << " sockaddr " << inet_ntoa(ChS.sin_addr) << ":" << ntohs(ChS.sin_port));
+
}
if (type == IPC_TCP_SOCKET) {
if (listen(crfd, 1) < 0) {
- debug(54, 1) ("ipcCreate: listen FD %d: %s\n", crfd, xstrerror());
+ debugs(54, 1, "ipcCreate: listen FD " << crfd << ": " << xstrerror());
return ipcCloseAllFD(prfd, pwfd, crfd, cwfd);
}
- debug(54, 3) ("ipcCreate: FD %d listening...\n", crfd);
+ debugs(54, 3, "ipcCreate: FD " << crfd << " listening...");
}
/* flush or else we get dup data if unbuffered_logs is set */
logsFlush();
if ((pid = fork()) < 0) {
- debug(54, 1) ("ipcCreate: fork: %s\n", xstrerror());
+ debugs(54, 1, "ipcCreate: fork: " << xstrerror());
return ipcCloseAllFD(prfd, pwfd, crfd, cwfd);
}
x = read(prfd, hello_buf, HELLO_BUF_SZ - 1);
if (x < 0) {
- debug(54, 0) ("ipcCreate: PARENT: hello read test failed\n");
- debug(54, 0) ("--> read: %s\n", xstrerror());
+ debugs(54, 0, "ipcCreate: PARENT: hello read test failed");
+ debugs(54, 0, "--> read: " << xstrerror());
return ipcCloseAllFD(prfd, pwfd, crfd, cwfd);
} else if (strcmp(hello_buf, hello_string)) {
- debug(54, 0) ("ipcCreate: PARENT: hello read test failed\n");
- debug(54, 0) ("--> read returned %d\n", x);
- debug(54, 0) ("--> got '%s'\n", rfc1738_escape(hello_buf));
+ debugs(54, 0, "ipcCreate: PARENT: hello read test failed");
+ debugs(54, 0, "--> read returned " << x);
+ debugs(54, 0, "--> got '" << rfc1738_escape(hello_buf) << "'");
return ipcCloseAllFD(prfd, pwfd, crfd, cwfd);
}
pwfd = prfd = -1;
if (type == IPC_TCP_SOCKET) {
- debug(54, 3) ("ipcCreate: calling accept on FD %d\n", crfd);
+ debugs(54, 3, "ipcCreate: calling accept on FD " << crfd);
if ((fd = accept(crfd, NULL, NULL)) < 0) {
- debug(54, 0) ("ipcCreate: FD %d accept: %s\n", crfd, xstrerror());
+ debugs(54, 0, "ipcCreate: FD " << crfd << " accept: " << xstrerror());
_exit(1);
}
- debug(54, 3) ("ipcCreate: CHILD accepted new FD %d\n", fd);
+ debugs(54, 3, "ipcCreate: CHILD accepted new FD " << fd);
close(crfd);
cwfd = crfd = fd;
} else if (type == IPC_UDP_SOCKET) {
x = comm_udp_send(cwfd, hello_string, strlen(hello_string) + 1, 0);
if (x < 0) {
- debug(54, 0) ("sendto FD %d: %s\n", cwfd, xstrerror());
- debug(54, 0) ("ipcCreate: CHILD: hello write test failed\n");
+ debugs(54, 0, "sendto FD " << cwfd << ": " << xstrerror());
+ debugs(54, 0, "ipcCreate: CHILD: hello write test failed");
_exit(1);
}
} else {
if (write(cwfd, hello_string, strlen(hello_string) + 1) < 0) {
- debug(54, 0) ("write FD %d: %s\n", cwfd, xstrerror());
- debug(54, 0) ("ipcCreate: CHILD: hello write test failed\n");
+ debugs(54, 0, "write FD " << cwfd << ": " << xstrerror());
+ debugs(54, 0, "ipcCreate: CHILD: hello write test failed");
_exit(1);
}
}
debug_log = fdopen(2, "a+");
- debug(54, 0) ("ipcCreate: %s: %s\n", prog, xstrerror());
+ debugs(54, 0, "ipcCreate: " << prog << ": " << xstrerror());
_exit(1);
/*
- * $Id: ipc_win32.cc,v 1.2 2006/09/09 15:29:59 serassio Exp $
+ * $Id: ipc_win32.cc,v 1.3 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 54 Windows Interprocess Communication
* AUTHOR: Andrey Shorin <tolsty@tushino.com>
0,
name);
} else if (type == IPC_FIFO) {
- debug(54, 0)
- ("ipcCreate: %s: use IPC_TCP_SOCKET instead of IP_FIFO on Windows\n",
- prog);
+ debugs(54, 0, "ipcCreate: " << prog << ": use IPC_TCP_SOCKET instead of IP_FIFO on Windows");
assert(0);
} else {
assert(IPC_NONE);
}
- debug(54, 3) ("ipcCreate: prfd FD %d\n", prfd);
- debug(54, 3) ("ipcCreate: pwfd FD %d\n", pwfd);
- debug(54, 3) ("ipcCreate: crfd FD %d\n", crfd);
- debug(54, 3) ("ipcCreate: cwfd FD %d\n", cwfd);
+ debugs(54, 3, "ipcCreate: prfd FD " << prfd);
+ debugs(54, 3, "ipcCreate: pwfd FD " << pwfd);
+ debugs(54, 3, "ipcCreate: crfd FD " << crfd);
+ debugs(54, 3, "ipcCreate: cwfd FD " << cwfd);
if (WIN32_OS_version != _WIN_OS_WINNT) {
getsockopt(INVALID_SOCKET, SOL_SOCKET, SO_OPENTYPE, (char *) &opt, &optlen);
}
if (crfd < 0) {
- debug(54, 0) ("ipcCreate: Failed to create child FD.\n");
+ debugs(54, 0, "ipcCreate: Failed to create child FD.");
return ipcCloseAllFD(prfd, pwfd, crfd, cwfd);
}
if (pwfd < 0) {
- debug(54, 0) ("ipcCreate: Failed to create server FD.\n");
+ debugs(54, 0, "ipcCreate: Failed to create server FD.");
return ipcCloseAllFD(prfd, pwfd, crfd, cwfd);
}
memset(&PS, '\0', len);
if (getsockname(pwfd, (struct sockaddr *) &PS, &len) < 0) {
- debug(54, 0) ("ipcCreate: getsockname: %s\n", xstrerror());
+ debugs(54, 0, "ipcCreate: getsockname: " << xstrerror());
return ipcCloseAllFD(prfd, pwfd, crfd, cwfd);
}
- debug(54, 3) ("ipcCreate: FD %d sockaddr %s:%d\n",
- pwfd, inet_ntoa(PS.sin_addr), ntohs(PS.sin_port));
+ debugs(54, 3, "ipcCreate: FD " << pwfd << " sockaddr " << inet_ntoa(PS.sin_addr) << ":" << ntohs(PS.sin_port));
len = sizeof(CS);
memset(&CS, '\0', len);
if (getsockname(crfd, (struct sockaddr *) &CS, &len) < 0) {
- debug(54, 0) ("ipcCreate: getsockname: %s\n", xstrerror());
+ debugs(54, 0, "ipcCreate: getsockname: " << xstrerror());
return ipcCloseAllFD(prfd, pwfd, crfd, cwfd);
}
- debug(54, 3) ("ipcCreate: FD %d sockaddr %s:%d\n",
- crfd, inet_ntoa(CS.sin_addr), ntohs(CS.sin_port));
+ debugs(54, 3, "ipcCreate: FD " << crfd << " sockaddr " << inet_ntoa(CS.sin_addr) << ":" << ntohs(CS.sin_port));
}
if (type == IPC_TCP_SOCKET) {
if (listen(crfd, 1) < 0) {
- debug(54, 1) ("ipcCreate: listen FD %d: %s\n", crfd, xstrerror());
+ debugs(54, 1, "ipcCreate: listen FD " << crfd << ": " << xstrerror());
return ipcCloseAllFD(prfd, pwfd, crfd, cwfd);
}
- debug(54, 3) ("ipcCreate: FD %d listening...\n", crfd);
+ debugs(54, 3, "ipcCreate: FD " << crfd << " listening...");
}
/* flush or else we get dup data if unbuffered_logs is set */
thread = _beginthreadex(NULL, 0, ipc_thread_1, ¶ms, 0, NULL);
if (thread == 0) {
- debug(54, 1) ("ipcCreate: _beginthread: %s\n", xstrerror());
+ debugs(54, 1, "ipcCreate: _beginthread: " << xstrerror());
return ipcCloseAllFD(prfd, pwfd, crfd, cwfd);
}
x = recv(prfd, (void *)hello_buf, HELLO_BUF_SZ - 1, 0);
if (x < 0) {
- debug(54, 0) ("ipcCreate: PARENT: hello read test failed\n");
- debug(54, 0) ("--> read: %s\n", xstrerror());
+ debugs(54, 0, "ipcCreate: PARENT: hello read test failed");
+ debugs(54, 0, "--> read: " << xstrerror());
CloseHandle((HANDLE) thread);
return ipcCloseAllFD(prfd, pwfd, -1, -1);
} else if (strcmp(hello_buf, hello_string)) {
- debug(54, 0) ("ipcCreate: PARENT: hello read test failed\n");
- debug(54, 0) ("--> read returned %d\n", x);
- debug(54, 0) ("--> got '%s'\n", rfc1738_escape(hello_buf));
+ debugs(54, 0, "ipcCreate: PARENT: hello read test failed");
+ debugs(54, 0, "--> read returned " << x);
+ debugs(54, 0, "--> got '" << rfc1738_escape(hello_buf) << "'");
CloseHandle((HANDLE) thread);
return ipcCloseAllFD(prfd, pwfd, -1, -1);
}
x = send(pwfd, (const void *)ok_string, strlen(ok_string), 0);
if (x < 0) {
- debug(54, 0) ("ipcCreate: PARENT: OK write test failed\n");
- debug(54, 0) ("--> read: %s\n", xstrerror());
+ debugs(54, 0, "ipcCreate: PARENT: OK write test failed");
+ debugs(54, 0, "--> read: " << xstrerror());
CloseHandle((HANDLE) thread);
return ipcCloseAllFD(prfd, pwfd, -1, -1);
}
x = recv(prfd, (void *)hello_buf, HELLO_BUF_SZ - 1, 0);
if (x < 0) {
- debug(54, 0) ("ipcCreate: PARENT: OK read test failed\n");
- debug(54, 0) ("--> read: %s\n", xstrerror());
+ debugs(54, 0, "ipcCreate: PARENT: OK read test failed");
+ debugs(54, 0, "--> read: " << xstrerror());
CloseHandle((HANDLE) thread);
return ipcCloseAllFD(prfd, pwfd, -1, -1);
} else if (!strcmp(hello_buf, err_string)) {
- debug(54, 0) ("ipcCreate: PARENT: OK read test failed\n");
- debug(54, 0) ("--> read returned %d\n", x);
- debug(54, 0) ("--> got '%s'\n", rfc1738_escape(hello_buf));
+ debugs(54, 0, "ipcCreate: PARENT: OK read test failed");
+ debugs(54, 0, "--> read returned " << x);
+ debugs(54, 0, "--> got '" << rfc1738_escape(hello_buf) << "'");
CloseHandle((HANDLE) thread);
return ipcCloseAllFD(prfd, pwfd, -1, -1);
}
x = send(cwfd, (const void *)buf, len, 0);
if (x < 0) {
- debug(54, 0) ("sendto FD %d: %s\n", cwfd, xstrerror());
- debug(54, 0) ("ipcCreate: CHILD: hello write test failed\n");
+ debugs(54, 0, "sendto FD " << cwfd << ": " << xstrerror());
+ debugs(54, 0, "ipcCreate: CHILD: hello write test failed");
}
return x;
prog = xstrdup(prog);
if (type == IPC_TCP_SOCKET) {
- debug(54, 3) ("ipcCreate: calling accept on FD %d\n", crfd);
+ debugs(54, 3, "ipcCreate: calling accept on FD " << crfd);
if ((fd = accept(crfd, NULL, NULL)) < 0) {
- debug(54, 0) ("ipcCreate: FD %d accept: %s\n", crfd, xstrerror());
+ debugs(54, 0, "ipcCreate: FD " << crfd << " accept: " << xstrerror());
goto cleanup;
}
- debug(54, 3) ("ipcCreate: CHILD accepted new FD %d\n", fd);
+ debugs(54, 3, "ipcCreate: CHILD accepted new FD " << fd);
comm_close(crfd);
snprintf(buf1, 8191, "%s CHILD socket", prog);
fd_open(fd, FD_SOCKET, buf1);
x = send(cwfd, (const void *)hello_string, strlen(hello_string) + 1, 0);
if (x < 0) {
- debug(54, 0) ("sendto FD %d: %s\n", cwfd, xstrerror());
- debug(54, 0) ("ipcCreate: CHILD: hello write test failed\n");
+ debugs(54, 0, "sendto FD " << cwfd << ": " << xstrerror());
+ debugs(54, 0, "ipcCreate: CHILD: hello write test failed");
goto cleanup;
}
x = recv(crfd, (void *)buf1, 8191, 0);
if (x < 0) {
- debug(54, 0) ("ipcCreate: CHILD: OK read test failed\n");
- debug(54, 0) ("--> read: %s\n", xstrerror());
+ debugs(54, 0, "ipcCreate: CHILD: OK read test failed");
+ debugs(54, 0, "--> read: " << xstrerror());
goto cleanup;
} else if (strcmp(buf1, ok_string)) {
- debug(54, 0) ("ipcCreate: CHILD: OK read test failed\n");
- debug(54, 0) ("--> read returned %d\n", x);
- debug(54, 0) ("--> got '%s'\n", rfc1738_escape(hello_buf));
+ debugs(54, 0, "ipcCreate: CHILD: OK read test failed");
+ debugs(54, 0, "--> read returned " << x);
+ debugs(54, 0, "--> got '" << rfc1738_escape(hello_buf) << "'");
goto cleanup;
}
/* assign file descriptors to child process */
if (_pipe(p2c, 1024, _O_BINARY | _O_NOINHERIT) < 0) {
- debug(54, 0) ("ipcCreate: CHILD: pipe: %s\n", xstrerror());
+ debugs(54, 0, "ipcCreate: CHILD: pipe: " << xstrerror());
ipcSend(cwfd, err_string, strlen(err_string));
goto cleanup;
}
if (_pipe(c2p, 1024, _O_BINARY | _O_NOINHERIT) < 0) {
- debug(54, 0) ("ipcCreate: CHILD: pipe: %s\n", xstrerror());
+ debugs(54, 0, "ipcCreate: CHILD: pipe: " << xstrerror());
ipcSend(cwfd, err_string, strlen(err_string));
goto cleanup;
}
crfd_ipc = cwfd_ipc = comm_open(SOCK_DGRAM, IPPROTO_UDP, local_addr, 0, 0, buf1);
if (crfd_ipc < 0) {
- debug(54, 0) ("ipcCreate: CHILD: Failed to create child FD for %s.\n",
- prog);
+ debugs(54, 0, "ipcCreate: CHILD: Failed to create child FD for " << prog << ".");
ipcSend(cwfd, err_string, strlen(err_string));
goto cleanup;
}
prfd_ipc = pwfd_ipc = comm_open(SOCK_DGRAM, IPPROTO_UDP, local_addr, 0, 0, buf1);
if (pwfd_ipc < 0) {
- debug(54, 0) ("ipcCreate: CHILD: Failed to create server FD for %s.\n",
- prog);
+ debugs(54, 0, "ipcCreate: CHILD: Failed to create server FD for " << prog << ".");
ipcSend(cwfd, err_string, strlen(err_string));
goto cleanup;
}
memset(&PS_ipc, '\0', tmp_s);
if (getsockname(pwfd_ipc, (struct sockaddr *) &PS_ipc, &tmp_s) < 0) {
- debug(54, 0) ("ipcCreate: getsockname: %s\n", xstrerror());
+ debugs(54, 0, "ipcCreate: getsockname: " << xstrerror());
ipcSend(cwfd, err_string, strlen(err_string));
goto cleanup;
}
- debug(54, 3) ("ipcCreate: FD %d sockaddr %s:%d\n",
- pwfd_ipc, inet_ntoa(PS_ipc.sin_addr), ntohs(PS_ipc.sin_port));
+ debugs(54, 3, "ipcCreate: FD " << pwfd_ipc << " sockaddr " << inet_ntoa(PS_ipc.sin_addr) << ":" << ntohs(PS_ipc.sin_port));
+
tmp_s = sizeof(CS_ipc);
memset(&CS_ipc, '\0', tmp_s);
if (getsockname(crfd_ipc, (struct sockaddr *) &CS_ipc, &tmp_s) < 0) {
- debug(54, 0) ("ipcCreate: getsockname: %s\n", xstrerror());
+ debugs(54, 0, "ipcCreate: getsockname: " << xstrerror());
ipcSend(cwfd, err_string, strlen(err_string));
goto cleanup;
}
- debug(54, 3) ("ipcCreate: FD %d sockaddr %s:%d\n",
- crfd_ipc, inet_ntoa(CS_ipc.sin_addr), ntohs(CS_ipc.sin_port));
+ debugs(54, 3, "ipcCreate: FD " << crfd_ipc << " sockaddr " << inet_ntoa(CS_ipc.sin_addr) << ":" << ntohs(CS_ipc.sin_port));
if (comm_connect_addr(pwfd_ipc, &CS_ipc) == COMM_ERROR) {
ipcSend(cwfd, err_string, strlen(err_string));
if (pid == -1) {
errno = x;
- debug(54, 0) ("ipcCreate: CHILD: %s: %s\n", params->prog, xstrerror());
+ debugs(54, 0, "ipcCreate: CHILD: " << params->prog << ": " << xstrerror());
+
ipcSend(cwfd, err_string, strlen(err_string));
goto cleanup;
}
memset(&wpi, 0, sizeof(wpi));
if (SOCKET_ERROR == WSADuplicateSocket(crfd_ipc, pid, &wpi)) {
- debug(54, 0) ("ipcCreate: CHILD: WSADuplicateSocket: %s\n",
- xstrerror());
+ debugs(54, 0, "ipcCreate: CHILD: WSADuplicateSocket: " << xstrerror());
+
ipcSend(cwfd, err_string, strlen(err_string));
goto cleanup;
}
x = write(c2p[1], (const char *) &wpi, sizeof(wpi));
if (x < (ssize_t)sizeof(wpi)) {
- debug(54, 0) ("ipcCreate: CHILD: write FD %d: %s\n", c2p[1],
- xstrerror());
- debug(54, 0) ("ipcCreate: CHILD: %s: socket exchange failed\n",
- prog);
+ debugs(54, 0, "ipcCreate: CHILD: write FD " << c2p[1] << ": " << xstrerror());
+ debugs(54, 0, "ipcCreate: CHILD: " << prog << ": socket exchange failed");
+
ipcSend(cwfd, err_string, strlen(err_string));
goto cleanup;
}
x = read(p2c[0], buf1, 8192);
if (x < 0) {
- debug(54, 0) ("ipcCreate: CHILD: read FD %d: %s\n", p2c[0],
- xstrerror());
- debug(54, 0) ("ipcCreate: CHILD: %s: socket exchange failed\n",
- prog);
+ debugs(54, 0, "ipcCreate: CHILD: read FD " << p2c[0] << ": " << xstrerror());
+ debugs(54, 0, "ipcCreate: CHILD: " << prog << ": socket exchange failed");
+
ipcSend(cwfd, err_string, strlen(err_string));
goto cleanup;
} else if (strncmp(buf1, ok_string, strlen(ok_string))) {
- debug(54, 0) ("ipcCreate: CHILD: %s: socket exchange failed\n",
- prog);
- debug(54, 0) ("--> read returned %d\n", x);
+ debugs(54, 0, "ipcCreate: CHILD: " << prog << ": socket exchange failed");
+ debugs(54, 0, "--> read returned " << x);
buf1[x] = '\0';
- debug(54, 0) ("--> got '%s'\n", rfc1738_escape(buf1));
+ debugs(54, 0, "--> got '" << rfc1738_escape(buf1) << "'");
ipcSend(cwfd, err_string, strlen(err_string));
goto cleanup;
}
x = write(c2p[1], (const char *) &PS_ipc, sizeof(PS_ipc));
if (x < (ssize_t)sizeof(PS_ipc)) {
- debug(54, 0) ("ipcCreate: CHILD: write FD %d: %s\n", c2p[1],
- xstrerror());
- debug(54, 0) ("ipcCreate: CHILD: %s: socket exchange failed\n",
- prog);
+ debugs(54, 0, "ipcCreate: CHILD: write FD " << c2p[1] << ": " << xstrerror());
+ debugs(54, 0, "ipcCreate: CHILD: " << prog << ": socket exchange failed");
+
ipcSend(cwfd, err_string, strlen(err_string));
goto cleanup;
}
x = read(p2c[0], buf1, 8192);
if (x < 0) {
- debug(54, 0) ("ipcCreate: CHILD: read FD %d: %s\n", p2c[0],
- xstrerror());
- debug(54, 0) ("ipcCreate: CHILD: %s: socket exchange failed\n",
- prog);
+ debugs(54, 0, "ipcCreate: CHILD: read FD " << p2c[0] << ": " << xstrerror());
+ debugs(54, 0, "ipcCreate: CHILD: " << prog << ": socket exchange failed");
+
ipcSend(cwfd, err_string, strlen(err_string));
goto cleanup;
} else if (strncmp(buf1, ok_string, strlen(ok_string))) {
- debug(54, 0) ("ipcCreate: CHILD: %s: socket exchange failed\n",
- prog);
- debug(54, 0) ("--> read returned %d\n", x);
+ debugs(54, 0, "ipcCreate: CHILD: " << prog << ": socket exchange failed");
+ debugs(54, 0, "--> read returned " << x);
buf1[x] = '\0';
- debug(54, 0) ("--> got '%s'\n", rfc1738_escape(buf1));
+ debugs(54, 0, "--> got '" << rfc1738_escape(buf1) << "'");
ipcSend(cwfd, err_string, strlen(err_string));
goto cleanup;
}
(HANDLE) _beginthreadex(NULL, 0, ipc_thread_2, &thread_params, 0, NULL);
if (!thread) {
- debug(54, 0) ("ipcCreate: CHILD: _beginthreadex: %s\n", xstrerror());
+ debugs(54, 0, "ipcCreate: CHILD: _beginthreadex: " << xstrerror());
ipcSend(cwfd, err_string, strlen(err_string));
goto cleanup;
}
if (-1 == ipcSend(cwfd, buf1, strlen(buf1)))
goto cleanup;
- debug(54, 2) ("ipc(%s,%ld): started successfully\n", prog, (long int) pid);
+ debugs(54, 2, "ipc(" << prog << "," << (long int) pid << "): started successfully");
/* cycle */
for (;;) {
x = recv(crfd, (void *)buf1, 8192, 0);
if (x <= 0) {
- debug(54, 3) ("ipc(%s,%d): %d bytes received from parent. Exiting...\n",
- prog, pid, x);
+ debugs(54, 3, "ipc(" << prog << "," << pid << "): " << x << " bytes received from parent. Exiting...");
break;
}
buf1[x] = '\0';
if (type == IPC_UDP_SOCKET && !strcmp(buf1, shutdown_string)) {
- debug(54, 3)
- ("ipc(%s,%d): request for shutdown received from parent. Exiting...\n",
- prog, pid);
+ debugs(54, 3, "ipc(" << prog << "," << pid << "): request for shutdown received from parent. Exiting...");
+
TerminateProcess(hProcess, 0);
break;
}
- debug(54, 5) ("ipc(%s,%d): received from parent: %s\n", prog, pid,
- rfc1738_escape_unescaped(buf1));
+ debugs(54, 5, "ipc(" << prog << "," << pid << "): received from parent: " << rfc1738_escape_unescaped(buf1));
if (type == IPC_TCP_SOCKET)
x = write(c2p[1], buf1, x);
x = send(pwfd_ipc, (const void *)buf1, x, 0);
if (x <= 0) {
- debug(54, 3) ("ipc(%s,%d): %d bytes written to %s. Exiting...\n",
- prog, pid, x, prog);
+ debugs(54, 3, "ipc(" << prog << "," << pid << "): " << x << " bytes written to " << prog << ". Exiting...");
+
break;
}
}
WaitForSingleObject(hProcess, type == IPC_UDP_SOCKET ? 12000 : 5000)) {
getCurrentTime();
- debug(54, 0) ("ipc(%s,%d): WARNING: %s didn't exit in %d seconds.\n",
- prog, pid, prog, type == IPC_UDP_SOCKET ? 12 : 5);
+ debugs(54, 0, "ipc(" << prog << "," << pid << "): WARNING: " << prog <<
+ " didn't exit in " << (type == IPC_UDP_SOCKET ? 12 : 5) << " seconds.");
+
}
if (thread && WAIT_OBJECT_0 != WaitForSingleObject(thread, 3000)) {
getCurrentTime();
- debug(54, 0)
- ("ipc(%s,%d): WARNING: ipc_thread_2 didn't exit in 3 seconds.\n",
- prog, pid);
+ debugs(54, 0, "ipc(" << prog << "," << pid << "): WARNING: ipc_thread_2 didn't exit in 3 seconds.");
+
}
getCurrentTime();
if (!retval)
- debug(54, 2) ("ipc(%s,%d): normal exit\n", prog, pid);
+ debugs(54, 2, "ipc(" << prog << "," << pid << "): normal exit");
if (buf1)
xfree(buf1);
if ((x <= 0 && type == IPC_TCP_SOCKET) ||
(x < 0 && type == IPC_UDP_SOCKET)) {
- debug(54, 3) ("ipc(%s,%d): %d bytes read from %s. Exiting...\n",
- prog, pid, x, prog);
+ debugs(54, 3, "ipc(" << prog << "," << pid << "): " << x << " bytes read from " << prog << ". Exiting...");
+
break;
}
buf2[x] = '\0';
if (type == IPC_UDP_SOCKET && !strcmp(buf2, shutdown_string)) {
- debug(54, 3) ("ipc(%s,%d): request for shutdown received. Exiting...\n",
- prog, pid);
+ debugs(54, 3, "ipc(" << prog << "," << pid << "): request for shutdown received. Exiting...");
+
break;
}
}
}
- debug(54, 5) ("ipc(%s,%d): received from child : %s\n", prog, pid,
- rfc1738_escape_unescaped(buf2));
+ debugs(54, 5, "ipc(" << prog << "," << pid << "): received from child : " << rfc1738_escape_unescaped(buf2));
+
x = send(send_fd, (const void *)buf2, x, 0);
if ((x <= 0 && type == IPC_TCP_SOCKET) ||
(x < 0 && type == IPC_UDP_SOCKET)) {
- debug(54, 3) ("ipc(%s,%d): %d bytes sent to parent. Exiting...\n",
- prog, pid, x);
+ debugs(54, 3, "ipc(" << prog << "," << pid << "): " << x << " bytes sent to parent. Exiting...");
+
break;
}
}
/*
- * $Id: ipcache.cc,v 1.258 2006/08/21 00:50:41 robertc Exp $
+ * $Id: ipcache.cc,v 1.259 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 14 IP Cache
* AUTHOR: Harvest Derived
ipcache_testname(void)
{
wordlist *w = NULL;
- debug(14, 1) ("Performing DNS Tests...\n");
+ debugs(14, 1, "Performing DNS Tests...");
if ((w = Config.dns_testname_list) == NULL)
return 1;
static void
ipcacheRelease(ipcache_entry * i)
{
- debug(14, 3) ("ipcacheRelease: Releasing entry for '%s'\n", (const char *) i->hash.key);
+ debugs(14, 3, "ipcacheRelease: Releasing entry for '" << (const char *) i->hash.key << "'");
+
hash_remove_link(ip_table, (hash_link *) i);
dlinkDelete(&i->lru, &lru_list);
ipcacheFreeEntry(i);
removed++;
}
- debug(14, 9) ("ipcache_purgelru: removed %d entries\n", removed);
+ debugs(14, 9, "ipcache_purgelru: removed " << removed << " entries");
}
/* purges entries added from /etc/hosts (or whatever). */
i->addrs.count = 0;
if (inbuf == NULL) {
- debug(14, 1) ("ipcacheParse: Got <NULL> reply\n");
+ debugs(14, 1, "ipcacheParse: Got <NULL> reply");
i->error_message = xstrdup("Internal Error");
return -1;
}
xstrncpy(buf, inbuf, DNS_INBUF_SZ);
- debug(14, 5) ("ipcacheParse: parsing: {%s}\n", buf);
+ debugs(14, 5, "ipcacheParse: parsing: {" << buf << "}");
token = strtok(buf, w_space);
if (NULL == token) {
- debug(14, 1) ("ipcacheParse: expecting result, got '%s'\n", inbuf);
+ debugs(14, 1, "ipcacheParse: expecting result, got '" << inbuf << "'");
+
i->error_message = xstrdup("Internal Error");
return -1;
}
}
if (0 != strcmp(token, "$addr")) {
- debug(14, 1) ("ipcacheParse: expecting '$addr', got '%s' in response to '%s'\n", inbuf, name);
+ debugs(14, 1, "ipcacheParse: expecting '$addr', got '" << inbuf << "' in response to '" << name << "'");
+
i->error_message = xstrdup("Internal Error");
return -1;
}
token = strtok(NULL, w_space);
if (NULL == token) {
- debug(14, 1) ("ipcacheParse: expecting TTL, got '%s' in response to '%s'\n", inbuf, name);
+ debugs(14, 1, "ipcacheParse: expecting TTL, got '" << inbuf << "' in response to '" << name << "'");
+
i->error_message = xstrdup("Internal Error");
return -1;
}
if (safe_inet_addr(A[k], &i->addrs.in_addrs[j]))
j++;
else
- debug(14, 1) ("ipcacheParse: Invalid IP address '%s' in response to '%s'\n", A[k], name);
+ debugs(14, 1, "ipcacheParse: Invalid IP address '" << A[k] << "' in response to '" << name << "'");
}
i->addrs.count = (unsigned char) j;
}
if (i->addrs.count <= 0) {
- debug(14, 1) ("ipcacheParse: No addresses in response to '%s'\n", name);
+ debugs(14, 1, "ipcacheParse: No addresses in response to '" << name << "'");
return -1;
}
i->addrs.count = 0;
if (nr < 0) {
- debug(14, 3) ("ipcacheParse: Lookup failed '%s' for '%s'\n",
- error_message, (const char *)i->hash.key);
+ debugs(14, 3, "ipcacheParse: Lookup failed '" << error_message << "' for '" << (const char *)i->hash.key << "'");
i->error_message = xstrdup(error_message);
return -1;
}
if (nr == 0) {
- debug(14, 3) ("ipcacheParse: No DNS records in response to '%s'\n", name);
+ debugs(14, 3, "ipcacheParse: No DNS records in response to '" << name << "'");
i->error_message = xstrdup("No DNS records");
return 0;
}
continue;
if (answers[k].rdlength != 4) {
- debug(14, 1)("ipcacheParse: Invalid IP address in response to '%s'\n", name);
+ debugs(14, 1, "ipcacheParse: Invalid IP address in response to '" << name << "'");
continue;
}
}
if (na == 0) {
- debug(14, 1) ("ipcacheParse: No Address records in response to '%s'\n", name);
+ debugs(14, 1, "ipcacheParse: No Address records in response to '" << name << "'");
i->error_message = xstrdup("No Address records");
return 0;
}
xmemcpy(&i->addrs.in_addrs[j++], answers[k].rdata, 4);
- debug(14, 3) ("ipcacheParse: #%d %s\n",
- j - 1,
- inet_ntoa(i->addrs.in_addrs[j - 1]));
+ debugs(14, 3, "ipcacheParse: #" << j - 1 << " " << inet_ntoa(i->addrs.in_addrs[j - 1]));
+
} else if (answers[k].type != RFC1035_TYPE_CNAME)
continue;
const ipcache_addrs *addrs = NULL;
generic_cbdata *c;
assert(handler != NULL);
- debug(14, 4) ("ipcache_nbgethostbyname: Name '%s'.\n", name);
+ debugs(14, 4, "ipcache_nbgethostbyname: Name '" << name << "'.");
IpcacheStats.requests++;
if (name == NULL || name[0] == '\0') {
- debug(14, 4) ("ipcache_nbgethostbyname: Invalid name!\n");
+ debugs(14, 4, "ipcache_nbgethostbyname: Invalid name!");
dns_error_message = "Invalid hostname";
handler(NULL, handlerData);
return;
i = NULL;
} else {
/* hit */
- debug(14, 4) ("ipcache_nbgethostbyname: HIT for '%s'\n", name);
+ debugs(14, 4, "ipcache_nbgethostbyname: HIT for '" << name << "'");
if (i->flags.negcached)
IpcacheStats.negative_hits++;
return;
}
- debug(14, 5) ("ipcache_nbgethostbyname: MISS for '%s'\n", name);
+ debugs(14, 5, "ipcache_nbgethostbyname: MISS for '" << name << "'");
IpcacheStats.misses++;
i = ipcacheCreateEntry(name);
i->handler = handler;
ipcache_init(void)
{
int n;
- debug(14, 3) ("Initializing IP Cache...\n");
+ debugs(14, 3, "Initializing IP Cache...");
memset(&IpcacheStats, '\0', sizeof(IpcacheStats));
memset(&lru_list, '\0', sizeof(lru_list));
/* test naming lookup */
if (!opt_dns_tests) {
- debug(14, 4) ("ipcache_init: Skipping DNS name lookup tests.\n");
+ debugs(14, 4, "ipcache_init: Skipping DNS name lookup tests.");
} else if (!ipcache_testname()) {
fatal("ipcache_init: DNS name lookup tests failed.");
} else {
- debug(14, 1) ("Successful DNS name lookup tests...\n");
+ debugs(14, 1, "Successful DNS name lookup tests...");
}
memset(&static_addrs, '\0', sizeof(ipcache_addrs));
ipcache_entry *i = NULL;
ipcache_addrs *addrs;
assert(name);
- debug(14, 3) ("ipcache_gethostbyname: '%s', flags=%x\n", name, flags);
+ debugs(14, 3, "ipcache_gethostbyname: '" << name << "', flags=" << std::hex << flags);
IpcacheStats.requests++;
i = ipcache_get(name);
if (k == ia->count) {
/* All bad, reset to All good */
- debug(14, 3) ("ipcacheCycleAddr: Changing ALL %s addrs from BAD to OK\n",
- name);
+ debugs(14, 3, "ipcacheCycleAddr: Changing ALL " << name << " addrs from BAD to OK");
for (k = 0; k < ia->count; k++)
ia->bad_mask[k] = 0;
ia->cur = 0;
}
- debug(14, 3) ("ipcacheCycleAddr: %s now at %s\n", name,
- inet_ntoa(ia->in_addrs[ia->cur]));
+ debugs(14, 3, "ipcacheCycleAddr: " << name << " now at " << inet_ntoa(ia->in_addrs[ia->cur]));
}
/*
ia->bad_mask[k] = TRUE;
ia->badcount++;
i->expires = XMIN(squid_curtime + XMAX((time_t)60, Config.negativeDnsTtl), i->expires);
- debug(14, 2) ("ipcacheMarkBadAddr: %s [%s]\n", name, inet_ntoa(addr));
+ debugs(14, 2, "ipcacheMarkBadAddr: " << name << " [" << inet_ntoa(addr) << "]");
}
ipcacheCycleAddr(name, ia);
ia->badcount--;
- debug(14, 2) ("ipcacheMarkGoodAddr: %s [%s]\n", name, inet_ntoa(addr));
+ debugs(14, 2, "ipcacheMarkGoodAddr: " << name << " [" << inet_ntoa(addr) << "]");
}
static void
if (!safe_inet_addr(ipaddr, &ip)) {
if (strchr(ipaddr, ':') && strspn(ipaddr, "0123456789abcdefABCDEF:") == strlen(ipaddr)) {
- debug(14, 3) ("ipcacheAddEntryFromHosts: Skipping IPv6 address '%s'\n", ipaddr);
+ debugs(14, 3, "ipcacheAddEntryFromHosts: Skipping IPv6 address '" << ipaddr << "'");
} else {
- debug(14, 1) ("ipcacheAddEntryFromHosts: Bad IP address '%s'\n",
- ipaddr);
+ debugs(14, 1, "ipcacheAddEntryFromHosts: Bad IP address '" << ipaddr << "'");
}
return 1;
if (1 == i->flags.fromhosts) {
ipcacheUnlockEntry(i);
} else if (i->locks > 0) {
- debug(14, 1) ("ipcacheAddEntryFromHosts: can't add static entry"
- " for locked name '%s'\n", name);
+ debugs(14, 1, "ipcacheAddEntryFromHosts: can't add static entry for locked name '" << name << "'");
return 1;
} else {
ipcacheRelease(i);
snmp_netIpFn(variable_list * Var, snint * ErrP)
{
variable_list *Answer = NULL;
- debug(49, 5) ("snmp_netIpFn: Processing request:\n");
+ debugs(49, 5, "snmp_netIpFn: Processing request:");
snmpDebugOid(5, Var->name, Var->name_length);
*ErrP = SNMP_ERR_NOERROR;
/*
- * $Id: logfile.cc,v 1.21 2006/06/05 21:08:15 serassio Exp $
+ * $Id: logfile.cc,v 1.22 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 50 Log file handling
* AUTHOR: Duane Wessels
"\tuser '%s', which is the cache_effective_user\n"
"\tset in squid.conf.", path, Config.effectiveUser);
} else {
- debug(50, 1) ("logfileOpen: %s: %s\n", path, xstrerror());
+ debugs(50, 1, "logfileOpen: " << path << ": " << xstrerror());
return NULL;
}
}
#endif
- debug(0, 1) ("logfileRotate: %s\n", lf->path);
+ debugs(0, 1, "logfileRotate: " << lf->path);
/* Rotate numbers 0 through N up one */
for (i = Config.Log.rotateNumber; i > 1;) {
lf->fd = file_open(lf->path, O_WRONLY | O_CREAT | O_TEXT);
if (DISK_ERROR == lf->fd && lf->flags.fatal) {
- debug(50, 1) ("logfileRotate: %s: %s\n", lf->path, xstrerror());
+ debugs(50, 1, "logfileRotate: " << lf->path << ": " << xstrerror());
fatalf("Cannot open %s: %s", lf->path, xstrerror());
}
}
/*
- * $Id: main.cc,v 1.445 2007/04/15 14:46:17 serassio Exp $
+ * $Id: main.cc,v 1.446 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 1 Startup and Main Loop
* AUTHOR: Harvest Derived
do_rotate = 0;
} else if (do_shutdown) {
time_t wait = do_shutdown > 0 ? (int) Config.shutdownLifetime : 0;
- debug(1, 1) ("Preparing for shutdown after %d requests\n",
- statCounter.client_http.requests);
- debug(1, 1) ("Waiting %d seconds for active connections to finish\n",
- (int) wait);
+ debugs(1, 1, "Preparing for shutdown after " << statCounter.client_http.requests << " requests");
+ debugs(1, 1, "Waiting " << (int) wait << " seconds for active connections to finish");
do_shutdown = 0;
shutting_down = 1;
#if USE_WIN32_SERVICE
static void
mainReconfigure(void)
{
- debug(1, 1) ("Reconfiguring Squid Cache (version %s)...\n", version_string);
+ debugs(1, 1, "Reconfiguring Squid Cache (version " << version_string << ")...");
reconfiguring = 1;
/* Already called serverConnectionsClose and ipcacheShutdownServers() */
serverConnectionsClose();
writePidFile(); /* write PID file */
- debug(1, 1) ("Ready to serve requests.\n");
+ debugs(1, 1, "Ready to serve requests.");
reconfiguring = 0;
}
#endif
if (geteuid() == 0) {
- debug(0, 0) ("Squid is not safe to run as root! If you must\n");
- debug(0, 0) ("start Squid as root, then you must configure\n");
- debug(0, 0) ("it to run as a non-priveledged user with the\n");
- debug(0, 0) ("'cache_effective_user' option in the config file.\n");
+ debugs(0, 0, "Squid is not safe to run as root! If you must");
+ debugs(0, 0, "start Squid as root, then you must configure");
+ debugs(0, 0, "it to run as a non-priveledged user with the");
+ debugs(0, 0, "'cache_effective_user' option in the config file.");
fatal("Don't run Squid as root, set 'cache_effective_user'!");
}
}
if (0 == strcmp("none", Config.coredump_dir)) {
(void) 0;
} else if (chdir(Config.coredump_dir) == 0) {
- debug(0, 1) ("Set Current Directory to %s\n", Config.coredump_dir);
+ debugs(0, 1, "Set Current Directory to " << Config.coredump_dir);
return;
} else {
- debug(50, 0) ("chdir: %s: %s\n", Config.coredump_dir, xstrerror());
+ debugs(50, 0, "chdir: " << Config.coredump_dir << ": " << xstrerror());
}
}
/* If we don't have coredump_dir or couldn't cd there, report current dir */
if (getcwd(pathbuf, MAXPATHLEN)) {
- debug(0, 1) ("Current Directory is %s\n", pathbuf);
+ debugs(0, 1, "Current Directory is " << pathbuf);
} else {
- debug(50, 0) ("WARNING: Can't find current directory, getcwd: %s\n", xstrerror());
+ debugs(50, 0, "WARNING: Can't find current directory, getcwd: " << xstrerror());
}
}
#endif
- debug(1, 0) ("Starting Squid Cache version %s for %s...\n",
- version_string,
- CONFIG_HOST_TYPE);
+ debugs(1, 0, "Starting Squid Cache version " << version_string << " for " << CONFIG_HOST_TYPE << "...");
#ifdef _SQUID_WIN32_
if (WIN32_run_mode == _WIN_SQUID_RUN_MODE_SERVICE) {
- debug(1, 0) ("Running as %s Windows System Service on %s\n", WIN32_Service_name, WIN32_OS_string);
- debug(1, 0) ("Service command line is: %s\n", WIN32_Service_Command_Line);
+ debugs(1, 0, "Running as " << WIN32_Service_name << " Windows System Service on " << WIN32_OS_string);
+ debugs(1, 0, "Service command line is: " << WIN32_Service_Command_Line);
} else
- debug(1, 0) ("Running on %s\n",WIN32_OS_string);
+ debugs(1, 0, "Running on " << WIN32_OS_string);
#endif
debugs(1, 1, "Process ID " << getpid());
- debug(1, 1) ("With %d file descriptors available\n", Squid_MaxFD);
+ debugs(1, 1, "With " << Squid_MaxFD << " file descriptors available");
#ifdef _SQUID_MSWIN_
- debug(1, 1) ("With %d CRT stdio descriptors available\n", _getmaxstdio());
+ debugs(1, 1, "With " << _getmaxstdio() << " CRT stdio descriptors available");
if (WIN32_Socks_initialized)
- debug(1, 1)("Windows sockets initialized\n");
+ debugs(1, 1, "Windows sockets initialized");
#endif
memCheckInit();
- debug(1, 1) ("Ready to serve requests.\n");
+ debugs(1, 1, "Ready to serve requests.");
if (!configured_once) {
eventAdd("storeMaintain", Store::Maintain, NULL, 1.0, 1);
}
setEffectiveUser();
- debug(0, 0) ("Creating Swap Directories\n");
+ debugs(0, 0, "Creating Swap Directories");
Store::Root().create();
return 0;
debug_log = stderr;
if (strcmp(Config.pidFilename, "none") == 0) {
- debug(0, 1) ("No pid_filename specified. Trusting you know what you are doing.\n");
+ debugs(0, 1, "No pid_filename specified. Trusting you know what you are doing.");
}
pid = readPidFile();
WIN32_svcstatusupdate(SERVICE_STOP_PENDING, 10000);
#endif
- debug(1, 1) ("Shutting down...\n");
+ debugs(1, 1, "Shutting down...");
#if USE_DNSSERVERS
dnsShutdown();
xmalloc_find_leaks();
- debug(1, 0) ("Memory used after shutdown: %d\n", xmalloc_total);
+ debugs(1, 0, "Memory used after shutdown: " << xmalloc_total);
#endif
#if MEM_GEN_TRACE
leave_suid();
}
- debug(1, 1) ("Squid Cache (Version %s): Exiting normally.\n",
- version_string);
+ debugs(1, 1, "Squid Cache (Version " << version_string << "): Exiting normally.");
/*
* DPW 2006-10-23
/*
- * $Id: mem.cc,v 1.103 2007/04/20 07:29:47 wessels Exp $
+ * $Id: mem.cc,v 1.104 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 13 High Level Memory Pool Management
* AUTHOR: Harvest Derived
long int leaked = 0, dubious = 0, reachable = 0, suppressed = 0;
stream << "Valgrind Report:\n";
stream << "Type\tAmount\n";
- debug(13, 1) ("Asking valgrind for memleaks\n");
+ debugs(13, 1, "Asking valgrind for memleaks");
VALGRIND_DO_LEAK_CHECK;
- debug(13, 1) ("Getting valgrind statistics\n");
+ debugs(13, 1, "Getting valgrind statistics");
VALGRIND_COUNT_LEAKS(leaked, dubious, reachable, suppressed);
stream << "Leaked\t" << leaked << "\n";
stream << "Dubious\t" << dubious << "\n";
* stderr when doing things like 'squid -k reconfigure'
*/
if (MemPools::GetInstance().idleLimit() > new_pool_limit)
- debug(13, 1) ("Shrinking idle mem pools to %.2f MB\n", toMB(new_pool_limit));
+ debugs(13, 1, "Shrinking idle mem pools to "<< std::setprecision(3) << toMB(new_pool_limit) << " MB");
#endif
MemPools::GetInstance().setIdleLimit(new_pool_limit);
* debug messages here at level 0 or 1 will always be printed
* on stderr.
*/
- debug(13, 3) ("Memory pools are '%s'; limit: %.2f MB\n",
- (Config.onoff.mem_pools ? "on" : "off"), toMB(MemPools::GetInstance().idleLimit()));
+ debugs(13, 3, "Memory pools are '" << ((Config.onoff.mem_pools ? "on" : "off")) << "'; limit: "<<
+ std::setprecision(3) << toMB(MemPools::GetInstance().idleLimit()) << " MB");
/* set all pointers to null */
memset(MemPools, '\0', sizeof(MemPools));
memPoolGetGlobalStats(&stats);
if (stats.tot_items_inuse)
- debug(13, 2) ("memCleanModule: %d items in %d chunks and %d pools are left dirty\n", stats.tot_items_inuse,
- stats.tot_chunks_inuse, stats.tot_pools_inuse);
+ debugs(13, 2, "memCleanModule: " << stats.tot_items_inuse <<
+ " items in " << stats.tot_chunks_inuse << " chunks and " <<
+ stats.tot_pools_inuse << " pools are left dirty");
}
int
/*
- * $Id: mime.cc,v 1.130 2007/04/21 07:14:14 wessels Exp $
+ * $Id: mime.cc,v 1.131 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 25 MIME Parsing
* AUTHOR: Harvest Derived
assert(NULL != name);
- debug(25, 5) ("mime_get_header: looking for '%s'\n", name);
+ debugs(25, 5, "mime_get_header: looking for '" << name << "'");
for (p = mime; *p; p += strcspn(p, "\n\r")) {
if (strcmp(p, "\r\n\r\n") == 0 || strcmp(p, "\n\n") == 0)
xstrncpy(header, p, l);
- debug(25, 5) ("mime_get_header: checking '%s'\n", header);
+ debugs(25, 5, "mime_get_header: checking '" << header << "'");
q = header;
}
if (got) {
- debug(25, 5) ("mime_get_header: returning '%s'\n", q);
+ debugs(25, 5, "mime_get_header: returning '" << q << "'");
return q;
}
}
return;
if ((fp = fopen(filename, "r")) == NULL) {
- debug(25, 1) ("mimeInit: %s: %s\n", filename, xstrerror());
+ debugs(25, 1, "mimeInit: " << filename << ": " << xstrerror());
return;
}
xstrncpy(chopbuf, buf, BUFSIZ);
if ((pattern = strtok(chopbuf, w_space)) == NULL) {
- debug(25, 1) ("mimeInit: parse error: '%s'\n", buf);
+ debugs(25, 1, "mimeInit: parse error: '" << buf << "'");
continue;
}
if ((type = strtok(NULL, w_space)) == NULL) {
- debug(25, 1) ("mimeInit: parse error: '%s'\n", buf);
+ debugs(25, 1, "mimeInit: parse error: '" << buf << "'");
continue;
}
if ((icon = strtok(NULL, w_space)) == NULL) {
- debug(25, 1) ("mimeInit: parse error: '%s'\n", buf);
+ debugs(25, 1, "mimeInit: parse error: '" << buf << "'");
continue;
}
if ((encoding = strtok(NULL, w_space)) == NULL) {
- debug(25, 1) ("mimeInit: parse error: '%s'\n", buf);
+ debugs(25, 1, "mimeInit: parse error: '" << buf << "'");
continue;
}
if ((mode = strtok(NULL, w_space)) == NULL) {
- debug(25, 1) ("mimeInit: parse error: '%s'\n", buf);
+ debugs(25, 1, "mimeInit: parse error: '" << buf << "'");
continue;
}
else if (!strcmp(option, "+view"))
view_option = 1;
else
- debug(25, 1) ("mimeInit: unknown option: '%s' (%s)\n", buf, option);
+ debugs(25, 1, "mimeInit: unknown option: '" << buf << "' (" << option << ")");
}
if (regcomp(&re, pattern, re_flags) != 0) {
- debug(25, 1) ("mimeInit: regcomp error: '%s'\n", buf);
+ debugs(25, 1, "mimeInit: regcomp error: '" << buf << "'");
continue;
}
MimeTableTail = &m->next;
- debug(25, 5) ("mimeInit: added '%s'\n", buf);
+ debugs(25, 5, "mimeInit: added '" << buf << "'");
}
fclose(fp);
for (m = MimeTable; m != NULL; m = m->next)
m->theIcon.load();
- debug(25, 1) ("Loaded Icons.\n");
+ debugs(25, 1, "Loaded Icons.");
}
void
fd = file_open(path, O_RDONLY | O_BINARY);
if (fd < 0) {
- debug(25, 0) ("mimeLoadIconFile: %s: %s\n", path, xstrerror());
+ debugs(25, 0, "mimeLoadIconFile: " << path << ": " << xstrerror());
return;
}
if (fstat(fd, &sb) < 0) {
- debug(25, 0) ("mimeLoadIconFile: FD %d: fstat: %s\n", fd, xstrerror());
+ debugs(25, 0, "mimeLoadIconFile: FD " << fd << ": fstat: " << xstrerror());
file_close(fd);
return;
}
e->timestampsSet();
- debug(25, 3) ("Loaded icon %s\n", url);
+ debugs(25, 3, "Loaded icon " << url);
e->unlock();
/*
- * $Id: multicast.cc,v 1.11 2003/02/21 22:50:10 robertc Exp $
+ * $Id: multicast.cc,v 1.12 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 7 Multicast
* AUTHOR: Martin Hamilton
char ttl = (char) mcast_ttl;
if (setsockopt(fd, IPPROTO_IP, IP_MULTICAST_TTL, &ttl, 1) < 0)
- debug(50, 1) ("comm_set_mcast_ttl: FD %d, TTL: %d: %s\n",
- fd, mcast_ttl, xstrerror());
+ debugs(50, 1, "comm_set_mcast_ttl: FD " << fd << ", TTL: " << mcast_ttl << ": " << xstrerror());
#endif
char c = 0;
if (ia == NULL) {
- debug(7, 0) ("comm_join_mcast_groups: Unknown host\n");
+ debugs(7, 0, "comm_join_mcast_groups: Unknown host");
return;
}
for (i = 0; i < (int) ia->count; i++) {
- debug(7, 10) ("Listening for ICP requests on %s\n",
- inet_ntoa(*(ia->in_addrs + i)));
+ debugs(7, 10, "Listening for ICP requests on " << inet_ntoa(*(ia->in_addrs + i)));
mr.imr_multiaddr.s_addr = (ia->in_addrs + i)->s_addr;
mr.imr_interface.s_addr = INADDR_ANY;
x = setsockopt(fd, IPPROTO_IP, IP_ADD_MEMBERSHIP,
(char *) &mr, sizeof(struct ip_mreq));
if (x < 0)
- debug(7, 1) ("comm_join_mcast_groups: FD %d, [%s]\n",
- fd, inet_ntoa(*(ia->in_addrs + i)));
+ debugs(7, 1, "comm_join_mcast_groups: FD " << fd << ", [" << inet_ntoa(*(ia->in_addrs + i)) << "]");
x = setsockopt(fd, IPPROTO_IP, IP_MULTICAST_LOOP, &c, 1);
if (x < 0)
- debug(7, 1) ("Can't disable multicast loopback: %s\n", xstrerror());
+ debugs(7, 1, "Can't disable multicast loopback: " << xstrerror());
}
#endif
/*
- * $Id: neighbors.cc,v 1.347 2007/04/21 07:14:14 wessels Exp $
+ * $Id: neighbors.cc,v 1.348 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 15 Neighbor Routines
* AUTHOR: Harvest Derived
struct IN_ADDR ip = from->sin_addr;
peer *p = NULL;
- debug(15, 3) ("whichPeer: from %s port %d\n", inet_ntoa(ip), port);
+ debugs(15, 3, "whichPeer: from " << inet_ntoa(ip) << " port " << port);
for (p = Config.peers; p; p = p->next)
{
if (peerWouldBePinged(p, request))
count++;
- debug(15, 3) ("neighborsCount: %d\n", count);
+ debugs(15, 3, "neighborsCount: " << count);
return count;
}
break;
}
- debug(15, 3) ("getFirstUpParent: returning %s\n", p ? p->host : "NULL");
+ debugs(15, 3, "getFirstUpParent: returning " << (p ? p->host : "NULL"));
return p;
}
if (q)
q->rr_count++;
- debug(15, 3) ("getRoundRobinParent: returning %s\n", q ? q->host : "NULL");
+ debugs(15, 3, "getRoundRobinParent: returning " << (q ? q->host : "NULL"));
return q;
}
q->rr_count += weighted_rtt;
- debug(15, 3) ("getWeightedRoundRobinParent: weighted_rtt %d\n", (int) weighted_rtt);
+ debugs(15, 3, "getWeightedRoundRobinParent: weighted_rtt " << (int) weighted_rtt);
}
- debug(15, 3) ("getWeightedRoundRobinParent: returning %s\n", q ? q->host : "NULL");
+ debugs(15, 3, "getWeightedRoundRobinParent: returning " << (q ? q->host : "NULL"));
return q;
}
if (!peerHTTPOkay(p, request))
continue;
- debug(15, 3) ("getDefaultParent: returning %s\n", p->host);
+ debugs(15, 3, "getDefaultParent: returning " << p->host);
return p;
}
- debug(15, 3) ("getDefaultParent: returning NULL\n");
+ debugs(15, 3, "getDefaultParent: returning NULL");
return NULL;
}
if (!peerHTTPOkay(p, request))
continue;
- debug(15, 3) ("getAnyParent: returning %s\n", p->host);
+ debugs(15, 3, "getAnyParent: returning " << p->host);
return p;
}
- debug(15, 3) ("getAnyParent: returning NULL\n");
+ debugs(15, 3, "getAnyParent: returning NULL");
return NULL;
}
memset(&name, '\0', sizeof(struct sockaddr_in));
if (getsockname(fd, (struct sockaddr *) &name, &len) < 0)
- debug(15, 1) ("getsockname(%d,%p,%p) failed.\n", fd, &name, &len);
+ debugs(15, 1, "getsockname(" << fd << "," << &name << "," << &len << ") failed.");
for (thisPeer = Config.peers; thisPeer; thisPeer = next) {
http_port_list *s;
if (thisPeer->http_port != ntohs(s->s.sin_port))
continue;
- debug(15, 1) ("WARNING: Peer looks like this host\n");
+ debugs(15, 1, "WARNING: Peer looks like this host");
+
+ debugs(15, 1, " Ignoring " <<
+ neighborTypeStr(thisPeer) << " " << thisPeer->host <<
+ "/" << thisPeer->http_port << "/" <<
+ thisPeer->icp.port);
- debug(15, 1) (" Ignoring %s %s/%d/%d\n",
- neighborTypeStr(thisPeer), thisPeer->host, thisPeer->http_port,
- thisPeer->icp.port);
neighborRemove(thisPeer);
}
if (p == NULL)
p = Config.peers;
- debug(15, 5) ("neighborsUdpPing: Peer %s\n", p->host);
+ debugs(15, 5, "neighborsUdpPing: Peer " << p->host);
if (!peerWouldBePinged(p, request))
continue; /* next peer */
peers_pinged++;
- debug(15, 4) ("neighborsUdpPing: pinging peer %s for '%s'\n",
- p->host, url);
+ debugs(15, 4, "neighborsUdpPing: pinging peer " << p->host << " for '" << url << "'");
if (p->type == PEER_MULTICAST)
mcastSetTtl(theOutIcpConnection, p->mcast.ttl);
- debug(15, 3) ("neighborsUdpPing: key = '%s'\n", entry->getMD5Text());
+ debugs(15, 3, "neighborsUdpPing: key = '" << entry->getMD5Text() << "'");
- debug(15, 3) ("neighborsUdpPing: reqnum = %d\n", reqnum);
+ debugs(15, 3, "neighborsUdpPing: reqnum = " << reqnum);
#if USE_HTCP
if (p->options.htcp) {
- debug(15, 3) ("neighborsUdpPing: sending HTCP query\n");
+ debugs(15, 3, "neighborsUdpPing: sending HTCP query");
htcpQuery(entry, request, p);
} else
#endif
if (p->icp.port == echo_port) {
- debug(15, 4) ("neighborsUdpPing: Looks like a dumb cache, send DECHO ping\n");
+ debugs(15, 4, "neighborsUdpPing: Looks like a dumb cache, send DECHO ping");
echo_hdr.reqnum = reqnum;
query = _icp_common_t::createMessage(ICP_DECHO, 0, url, reqnum, 0);
icpUdpSend(theOutIcpConnection,
/* log it once at the threshold */
if (p->stats.logged_state == PEER_ALIVE) {
- debug(15, 1) ("Detected DEAD %s: %s\n",
- neighborTypeStr(p), p->name);
+ debugs(15, 1, "Detected DEAD " << neighborTypeStr(p) << ": " << p->name);
p->stats.logged_state = PEER_DEAD;
}
}
char *host = request->host;
if (!Config.onoff.source_ping) {
- debug(15, 6) ("neighborsUdpPing: Source Ping is disabled.\n");
+ debugs(15, 6, "neighborsUdpPing: Source Ping is disabled.");
} else if ((ia = ipcache_gethostbyname(host, 0))) {
- debug(15, 6) ("neighborsUdpPing: Source Ping: to %s for '%s'\n",
- host, url);
+ debugs(15, 6, "neighborsUdpPing: Source Ping: to " << host << " for '" << url << "'");
echo_hdr.reqnum = reqnum;
if (icmp_sock != -1) {
0);
}
} else {
- debug(15, 6) ("neighborsUdpPing: Source Ping: unknown host: %s\n",
- host);
+ debugs(15, 6, "neighborsUdpPing: Source Ping: unknown host: " << host);
}
}
const cache_key *key = request ? storeKeyPublicByRequest(request) : NULL;
assert(p);
assert(request);
- debug(15, 5) ("peerDigestLookup: peer %s\n", p->host);
+ debugs(15, 5, "peerDigestLookup: peer " << p->host);
/* does the peeer have a valid digest? */
if (!p->digest) {
- debug(15, 5) ("peerDigestLookup: gone!\n");
+ debugs(15, 5, "peerDigestLookup: gone!");
return LOOKUP_NONE;
} else if (!peerHTTPOkay(p, request)) {
- debug(15, 5) ("peerDigestLookup: !peerHTTPOkay\n");
+ debugs(15, 5, "peerDigestLookup: !peerHTTPOkay");
return LOOKUP_NONE;
} else if (!p->digest->flags.needed) {
- debug(15, 5) ("peerDigestLookup: note need\n");
+ debugs(15, 5, "peerDigestLookup: note need");
peerDigestNeeded(p->digest);
return LOOKUP_NONE;
} else if (!p->digest->flags.usable) {
- debug(15, 5) ("peerDigestLookup: !ready && %srequested\n",
- p->digest->flags.requested ? "" : "!");
+ debugs(15, 5, "peerDigestLookup: !ready && " << (p->digest->flags.requested ? "" : "!") << "requested");
return LOOKUP_NONE;
}
- debug(15, 5) ("peerDigestLookup: OK to lookup peer %s\n", p->host);
+ debugs(15, 5, "peerDigestLookup: OK to lookup peer " << p->host);
assert(p->digest->cd);
/* does digest predict a hit? */
if (!cacheDigestTest(p->digest->cd, key))
return LOOKUP_MISS;
- debug(15, 5) ("peerDigestLookup: peer %s says HIT!\n", p->host);
+ debugs(15, 5, "peerDigestLookup: peer " << p->host << " says HIT!");
return LOOKUP_HIT;
p_rtt = netdbHostRtt(p->host);
- debug(15, 5) ("neighborsDigestSelect: peer %s rtt: %d\n",
- p->host, p_rtt);
+ debugs(15, 5, "neighborsDigestSelect: peer " << p->host << " rtt: " << p_rtt);
/* is this peer better than others in terms of rtt ? */
if (!best_p || (p_rtt && p_rtt < best_rtt)) {
if (p_rtt) /* informative choice (aka educated guess) */
ichoice_count++;
- debug(15, 4) ("neighborsDigestSelect: peer %s leads with rtt %d\n",
- p->host, best_rtt);
+ debugs(15, 4, "neighborsDigestSelect: peer " << p->host << " leads with rtt " << best_rtt);
}
}
- debug(15, 4) ("neighborsDigestSelect: choices: %d (%d)\n",
- choice_count, ichoice_count);
+ debugs(15, 4, "neighborsDigestSelect: choices: " << choice_count << " (" << ichoice_count << ")");
peerNoteDigestLookup(request, best_p,
best_p ? LOOKUP_HIT : (choice_count ? LOOKUP_MISS : LOOKUP_NONE));
request->hier.n_choices = choice_count;
request->hier.cd_lookup = lookup;
- debug(15, 4) ("peerNoteDigestLookup: peer %s, lookup: %s\n",
- p ? p->host : "<none>", lookup_t_str[lookup]);
+ debugs(15, 4, "peerNoteDigestLookup: peer " <<
+ (p ? p->host : "<none>") << ", lookup: " <<
+ lookup_t_str[lookup] );
#endif
}
neighborAlive(peer * p, const MemObject * mem, const icp_common_t * header)
{
if (p->stats.logged_state == PEER_DEAD && p->tcp_up) {
- debug(15, 1) ("Detected REVIVED %s: %s\n",
- neighborTypeStr(p), p->name);
+ debugs(15, 1, "Detected REVIVED " << neighborTypeStr(p) << ": " << p->name);
p->stats.logged_state = PEER_ALIVE;
}
neighborAliveHtcp(peer * p, const MemObject * mem, const htcpReplyData * htcp)
{
if (p->stats.logged_state == PEER_DEAD && p->tcp_up) {
- debug(15, 1) ("Detected REVIVED %s: %s\n",
- neighborTypeStr(p), p->name);
+ debugs(15, 1, "Detected REVIVED " << neighborTypeStr(p) << ": " << p->name);
p->stats.logged_state = PEER_ALIVE;
}
np->icp.counts[opcode]++;
if (isPowTen(++np->stats.ignored_replies))
- debug(15, 1) ("WARNING: Ignored %d replies from non-peer %s\n",
- np->stats.ignored_replies, np->host);
+ debugs(15, 1, "WARNING: Ignored " << np->stats.ignored_replies << " replies from non-peer " << np->host);
}
/* ignoreMulticastReply
char *opcode_d;
icp_opcode opcode = (icp_opcode) header->opcode;
- debug(15, 6) ("neighborsUdpAck: opcode %d '%s'\n",
- (int) opcode, storeKeyText(key));
+ debugs(15, 6, "neighborsUdpAck: opcode " << (int) opcode << " '" << storeKeyText(key) << "'");
if (NULL != (entry = Store::Root().get(key)))
mem = entry->mem_obj;
/* Does the entry exist? */
if (NULL == entry)
{
- debug(12, 3) ("neighborsUdpAck: Cache key '%s' not found\n",
- storeKeyText(key));
+ debugs(12, 3, "neighborsUdpAck: Cache key '" << storeKeyText(key) << "' not found");
neighborCountIgnored(p);
return;
}
/* check if someone is already fetching it */
if (EBIT_TEST(entry->flags, ENTRY_DISPATCHED))
{
- debug(15, 3) ("neighborsUdpAck: '%s' already being fetched.\n",
- storeKeyText(key));
+ debugs(15, 3, "neighborsUdpAck: '" << storeKeyText(key) << "' already being fetched.");
neighborCountIgnored(p);
return;
}
if (mem == NULL)
{
- debug(15, 2) ("Ignoring %s for missing mem_obj: %s\n",
- opcode_d, storeKeyText(key));
+ debugs(15, 2, "Ignoring " << opcode_d << " for missing mem_obj: " << storeKeyText(key));
neighborCountIgnored(p);
return;
}
if (entry->ping_status != PING_WAITING)
{
- debug(15, 2) ("neighborsUdpAck: Late %s for %s\n",
- opcode_d, storeKeyText(key));
+ debugs(15, 2, "neighborsUdpAck: Late " << opcode_d << " for " << storeKeyText(key));
neighborCountIgnored(p);
return;
}
if (entry->lock_count == 0)
{
- debug(12, 1) ("neighborsUdpAck: '%s' has no locks\n",
- storeKeyText(key));
+ debugs(12, 1, "neighborsUdpAck: '" << storeKeyText(key) << "' has no locks");
neighborCountIgnored(p);
return;
}
- debug(15, 3) ("neighborsUdpAck: %s for '%s' from %s \n",
- opcode_d, storeKeyText(key), p ? p->host : "source");
+ debugs(15, 3, "neighborsUdpAck: " << opcode_d << " for '" << storeKeyText(key) << "' from " << (p ? p->host : "source") << " ");
if (p)
{
} else if (opcode == ICP_SECHO)
{
if (p) {
- debug(15, 1) ("Ignoring SECHO from neighbor %s\n", p->host);
+ debugs(15, 1, "Ignoring SECHO from neighbor " << p->host);
neighborCountIgnored(p);
#if ALLOW_SOURCE_PING
#endif
} else {
- debug(15, 1) ("Unsolicited SECHO from %s\n", inet_ntoa(from->sin_addr));
+ debugs(15, 1, "Unsolicited SECHO from " << inet_ntoa(from->sin_addr));
}
} else if (opcode == ICP_DENIED)
{
neighborIgnoreNonPeer(from, opcode);
} else if (p->stats.pings_acked > 100) {
if (100 * p->icp.counts[ICP_DENIED] / p->stats.pings_acked > 95) {
- debug(15, 0) ("95%% of replies from '%s' are UDP_DENIED\n", p->host);
- debug(15, 0) ("Disabling '%s', please check your configuration.\n", p->host);
+ debugs(15, 0, "95%% of replies from '" << p->host << "' are UDP_DENIED");
+ debugs(15, 0, "Disabling '" << p->host << "', please check your configuration.");
neighborRemove(p);
p = NULL;
} else {
mem->ping_reply_callback(p, ntype, PROTO_ICP, header, mem->ircb_data);
} else
{
- debug(15, 0) ("neighborsUdpAck: Unexpected ICP reply: %s\n", opcode_d);
+ debugs(15, 0, "neighborsUdpAck: Unexpected ICP reply: " << opcode_d);
}
}
int j;
if (p->n_addresses == 0) {
- debug(15, 1) ("Configuring %s %s/%d/%d\n", neighborTypeStr(p),
- p->host, p->http_port, p->icp.port);
+ debugs(15, 1, "Configuring " << neighborTypeStr(p) << " " << p->host << "/" << p->http_port << "/" << p->icp.port);
if (p->type == PEER_MULTICAST)
- debug(15, 1) (" Multicast TTL = %d\n", p->mcast.ttl);
+ debugs(15, 1, " Multicast TTL = " << p->mcast.ttl);
}
p->n_addresses = 0;
if (ia == NULL) {
- debug(0, 0) ("WARNING: DNS lookup for '%s' failed!\n", p->host);
+ debugs(0, 0, "WARNING: DNS lookup for '" << p->host << "' failed!");
return;
}
if ((int) ia->count < 1) {
- debug(0, 0) ("WARNING: No IP address found for '%s'!\n", p->host);
+ debugs(0, 0, "WARNING: No IP address found for '" << p->host << "'!");
return;
}
for (j = 0; j < (int) ia->count && j < PEER_MAX_ADDRESSES; j++) {
p->addresses[j] = ia->in_addrs[j];
- debug(15, 2) ("--> IP address #%d: %s\n", j, inet_ntoa(p->addresses[j]));
+ debugs(15, 2, "--> IP address #" << j << ": " << inet_ntoa(p->addresses[j]));
p->n_addresses++;
}
p->stats.last_connect_failure = squid_curtime;
if (!p->tcp_up) {
- debug(15, 2) ("TCP connection to %s/%d dead\n", p->host, p->http_port);
+ debugs(15, 2, "TCP connection to " << p->host << "/" << p->http_port <<
+ " dead");
return;
}
p->tcp_up--;
if (!p->tcp_up) {
- debug(15, 1) ("Detected DEAD %s: %s\n",
- neighborTypeStr(p), p->name);
+ debugs(15, 1, "Detected DEAD " << neighborTypeStr(p) << ": " << p->name);
p->stats.logged_state = PEER_DEAD;
}
}
void
peerConnectFailed(peer *p)
{
- debug(15, 1) ("TCP connection to %s/%d failed\n", p->host, p->http_port);
+ debugs(15, 1, "TCP connection to " << p->host << "/" << p->http_port << " failed");
peerConnectFailedSilent(p);
}
peerConnectSucceded(peer * p)
{
if (!p->tcp_up) {
- debug(15, 2) ("TCP connection to %s/%d succeded\n", p->host, p->http_port);
- debug(15, 1) ("Detected REVIVED %s: %s\n",
- neighborTypeStr(p), p->name);
+ debugs(15, 2, "TCP connection to " << p->host << "/" << p->http_port << " succeded");
+ debugs(15, 1, "Detected REVIVED " << neighborTypeStr(p) << ": " << p->name);
p->stats.logged_state = PEER_ALIVE;
if (!p->n_addresses)
ipcache_nbgethostbyname(p->host, peerDNSConfigure, p);
(double) psstate->ping.n_recv,
++p->mcast.n_times_counted,
10);
- debug(15, 1) ("Group %s: %d replies, %4.1f average, RTT %d\n",
- p->host,
- psstate->ping.n_recv,
- p->mcast.avg_n_members,
- p->stats.rtt);
+ debugs(15, 1, "Group " << p->host << ": " << psstate->ping.n_recv <<
+ " replies, "<< std::setw(4)<< std::setprecision(2) <<
+ p->mcast.avg_n_members <<" average, RTT " << p->stats.rtt);
p->mcast.n_replies_expected = (int) p->mcast.avg_n_members;
}
MemObject *mem = NULL;
peer *p;
peer_t ntype = PEER_NONE;
- debug(15, 6) ("neighborsHtcpReply: %s %s\n",
- htcp->hit ? "HIT" : "MISS", storeKeyText(key));
+ debugs(15, 6, "neighborsHtcpReply: " <<
+ (htcp->hit ? "HIT" : "MISS") << " " <<
+ storeKeyText(key) );
if (NULL != e)
mem = e->mem_obj;
/* Does the entry exist? */
if (NULL == e)
{
- debug(12, 3) ("neighyborsHtcpReply: Cache key '%s' not found\n",
- storeKeyText(key));
+ debugs(12, 3, "neighyborsHtcpReply: Cache key '" << storeKeyText(key) << "' not found");
neighborCountIgnored(p);
return;
}
/* check if someone is already fetching it */
if (EBIT_TEST(e->flags, ENTRY_DISPATCHED))
{
- debug(15, 3) ("neighborsUdpAck: '%s' already being fetched.\n",
- storeKeyText(key));
+ debugs(15, 3, "neighborsUdpAck: '" << storeKeyText(key) << "' already being fetched.");
neighborCountIgnored(p);
return;
}
if (mem == NULL)
{
- debug(15, 2) ("Ignoring reply for missing mem_obj: %s\n",
- storeKeyText(key));
+ debugs(15, 2, "Ignoring reply for missing mem_obj: " << storeKeyText(key));
neighborCountIgnored(p);
return;
}
if (e->ping_status != PING_WAITING)
{
- debug(15, 2) ("neighborsUdpAck: Entry %s is not PING_WAITING\n",
- storeKeyText(key));
+ debugs(15, 2, "neighborsUdpAck: Entry " << storeKeyText(key) << " is not PING_WAITING");
neighborCountIgnored(p);
return;
}
if (e->lock_count == 0)
{
- debug(12, 1) ("neighborsUdpAck: '%s' has no locks\n",
- storeKeyText(key));
+ debugs(12, 1, "neighborsUdpAck: '" << storeKeyText(key) << "' has no locks");
neighborCountIgnored(p);
return;
}
return;
}
- debug(15, 3) ("neighborsHtcpReply: e = %p\n", e);
+ debugs(15, 3, "neighborsHtcpReply: e = " << e);
mem->ping_reply_callback(p, ntype, PROTO_HTCP, htcp, mem->ircb_data);
}
/*
- * $Id: net_db.cc,v 1.192 2007/04/21 07:14:14 wessels Exp $
+ * $Id: net_db.cc,v 1.193 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 38 Network Measurement Database
* AUTHOR: Duane Wessels
if (na == NULL)
na = netdbAdd(addr);
- debug(38, 3) ("netdbSendPing: %s moved from %s to %s\n",
- hostname, n->network, na->network);
+ debugs(38, 3, "netdbSendPing: " << hostname << " moved from " << n->network << " to " << na->network);
x = (net_db_name *) hash_lookup(host_table, hostname);
if (x == NULL) {
- debug(38, 1) ("netdbSendPing: net_db_name list bug: %s not found", hostname);
+ debugs(38, 1, "netdbSendPing: net_db_name list bug: " << hostname << " not found");
xfree(hostname);
return;
}
}
if (n->next_ping_time <= squid_curtime) {
- debug(38, 3) ("netdbSendPing: pinging %s\n", hostname);
+ debugs(38, 3, "netdbSendPing: pinging " << hostname);
icmpDomainPing(addr, hostname);
n->pings_sent++;
n->next_ping_time = squid_curtime + Config.Netdb.period;
else
n->n_peers_alloc <<= 1;
- debug(38, 3) ("netdbPeerAdd: Growing peer list for '%s' to %d\n",
- n->network, n->n_peers_alloc);
+ debugs(38, 3, "netdbPeerAdd: Growing peer list for '" << n->network << "' to " << n->n_peers_alloc);
n->peers = (net_db_peer *)xcalloc(n->n_peers_alloc, sizeof(net_db_peer));
lf = logfileOpen(path, 4096, 0);
if (NULL == lf) {
- debug(50, 1) ("netdbSaveState: %s: %s\n", path, xstrerror());
+ debugs(50, 1, "netdbSaveState: " << path << ": " << xstrerror());
return;
}
logfileClose(lf);
getCurrentTime();
- debug(38, 1) ("NETDB state saved; %d entries, %d msec\n",
- count, tvSubMsec(start, current_time));
+ debugs(38, 1, "NETDB state saved; " <<
+ count << " entries, " <<
+ tvSubMsec(start, current_time) << " msec" );
eventAddIsh("netdbSaveState", netdbSaveState, NULL, 3600.0, 1);
}
xfree(buf);
getCurrentTime();
- debug(38, 1) ("NETDB state reloaded; %d entries, %d msec\n",
- count, tvSubMsec(start, current_time));
+ debugs(38, 1, "NETDB state reloaded; " <<
+ count << " entries, " <<
+ tvSubMsec(start, current_time) << " msec" );
}
static const char *
rec_sz += 1 + sizeof(addr.s_addr);
rec_sz += 1 + sizeof(int);
rec_sz += 1 + sizeof(int);
- debug(38, 3) ("netdbExchangeHandleReply: %d read bytes\n", (int) recievedData.length);
+ debugs(38, 3, "netdbExchangeHandleReply: " << (int) recievedData.length << " read bytes");
if (!cbdataReferenceValid(ex->p)) {
- debug(38, 3) ("netdbExchangeHandleReply: Peer became invalid\n");
+ debugs(38, 3, "netdbExchangeHandleReply: Peer became invalid");
netdbExchangeDone(ex);
return;
}
- debug(38, 3) ("netdbExchangeHandleReply: for '%s:%d'\n", ex->p->host, ex->p->http_port);
+ debugs(38, 3, "netdbExchangeHandleReply: for '" << ex->p->host << ":" << ex->p->http_port << "'");
if (recievedData.length == 0 &&
!recievedData.flags.error) {
- debug(38, 3) ("netdbExchangeHandleReply: Done\n");
+ debugs(38, 3, "netdbExchangeHandleReply: Done");
netdbExchangeDone(ex);
return;
}
debugs(38, 5, "netdbExchangeHandleReply: hdr_sz = " << hdr_sz);
rep = ex->e->getReply();
assert (0 != rep->sline.status);
- debug(38, 3) ("netdbExchangeHandleReply: reply status %d\n",
- rep->sline.status);
+ debugs(38, 3, "netdbExchangeHandleReply: reply status " << rep->sline.status);
if (HTTP_OK != rep->sline.status) {
netdbExchangeDone(ex);
assert(ex->connstate == STATE_BODY);
/* If we get here, we have some body to parse .. */
- debug(38, 5) ("netdbExchangeHandleReply: start parsing loop, size = %d\n",
- size);
+ debugs(38, 5, "netdbExchangeHandleReply: start parsing loop, size = " << size);
while (size >= rec_sz) {
- debug(38, 5) ("netdbExchangeHandleReply: in parsing loop, size = %d\n",
- size);
+ debugs(38, 5, "netdbExchangeHandleReply: in parsing loop, size = " << size);
addr.s_addr = any_addr.s_addr;
hops = rtt = 0.0;
break;
default:
- debug(38, 1) ("netdbExchangeHandleReply: corrupt data, aborting\n");
+ debugs(38, 1, "netdbExchangeHandleReply: corrupt data, aborting");
netdbExchangeDone(ex);
return;
}
*/
ex->used -= oldbufofs;
- debug(38, 3) ("netdbExchangeHandleReply: size left over in this buffer: %d bytes\n", size);
+ debugs(38, 3, "netdbExchangeHandleReply: size left over in this buffer: " << size << " bytes");
- debug(38, 3) ("netdbExchangeHandleReply: used %d entries, (x %d bytes) == %d bytes total\n",
- nused, rec_sz, nused * rec_sz);
+ debugs(38, 3, "netdbExchangeHandleReply: used " << nused <<
+ " entries, (x " << rec_sz << " bytes) == " << nused * rec_sz <<
+ " bytes total");
- debug(38, 3) ("netdbExchangeHandleReply: used %ld\n", (long int) ex->used);
+ debugs(38, 3, "netdbExchangeHandleReply: used " << (long int) ex->used);
if (EBIT_TEST(ex->e->flags, ENTRY_ABORTED)) {
- debug(38, 3) ("netdbExchangeHandleReply: ENTRY_ABORTED\n");
+ debugs(38, 3, "netdbExchangeHandleReply: ENTRY_ABORTED");
netdbExchangeDone(ex);
} else if (ex->e->store_status == STORE_PENDING) {
StoreIOBuffer tempBuffer;
tempBuffer.offset = ex->used;
tempBuffer.length = ex->buf_sz - ex->buf_ofs;
tempBuffer.data = ex->buf + ex->buf_ofs;
- debug(38, 3) ("netdbExchangeHandleReply: EOF not recieved\n");
+ debugs(38, 3, "netdbExchangeHandleReply: EOF not recieved");
storeClientCopy(ex->sc, ex->e, tempBuffer,
netdbExchangeHandleReply, ex);
}
netdbExchangeDone(void *data)
{
netdbExchangeState *ex = (netdbExchangeState *)data;
- debug(38, 3) ("netdbExchangeDone: %s\n", ex->e->url());
+ debugs(38, 3, "netdbExchangeDone: " << ex->e->url() );
HTTPMSGUNLOCK(ex->r);
storeUnregister(ex->sc, ex->e, ex);
ex->e->unlock();
#if USE_ICMP
netdbEntry *n;
int N;
- debug(38, 3) ("netdbHandlePingReply: from %s\n", inet_ntoa(from->sin_addr));
+ debugs(38, 3, "netdbHandlePingReply: from " << inet_ntoa(from->sin_addr));
if ((n = netdbLookupAddr(from->sin_addr)) == NULL)
return;
n->rtt = ((n->rtt * (N - 1)) + rtt) / N;
- debug(38, 3) ("netdbHandlePingReply: %s; rtt=%5.1f hops=%4.1f\n",
- n->network,
- n->rtt,
- n->hops);
+ debugs(38, 3, "netdbHandlePingReply: " << n->network << "; rtt="<<
+ std::setw(5)<< std::setprecision(2) << n->rtt << " hops="<<
+ std::setw(4) << n->hops);
#endif
}
*(list + i++) = n;
if (i != memInUse(MEM_NETDBENTRY))
- debug(38, 0) ("WARNING: netdb_addrs count off, found %d, expected %d\n",
- i, memInUse(MEM_NETDBENTRY));
+ debugs(38, 0, "WARNING: netdb_addrs count off, found " << i <<
+ ", expected " << memInUse(MEM_NETDBENTRY));
qsort((char *) list,
i,
double rtt = (double) irtt;
double hops = (double) ihops;
net_db_peer *p;
- debug(38, 3) ("netdbUpdatePeer: '%s', %d hops, %d rtt\n", r->host, ihops, irtt);
+ debugs(38, 3, "netdbUpdatePeer: '" << r->host << "', " << ihops << " hops, " << irtt << " rtt");
n = netdbLookupHost(r->host);
if (n == NULL) {
- debug(38, 3) ("netdbUpdatePeer: host '%s' not found\n", r->host);
+ debugs(38, 3, "netdbUpdatePeer: host '" << r->host << "' not found");
return;
}
#if USE_ICMP
netdbEntry *n;
net_db_peer *p;
- debug(38, 5) ("netdbExchangeUpdatePeer: '%s', %0.1f hops, %0.1f rtt\n",
- inet_ntoa(addr), hops, rtt);
+ debugs(38, 5, "netdbExchangeUpdatePeer: '" << inet_ntoa(addr) << "', "<<
+ std::setfill('0')<< std::setprecision(2) << hops << " hops, " <<
+ rtt << " rtt");
+
n = netdbLookupAddr(addr);
if (n == NULL)
if (n == NULL)
return;
- debug(38, 3) ("netdbDeleteAddrNetwork: %s\n", n->network);
+ debugs(38, 3, "netdbDeleteAddrNetwork: " << n->network);
netdbRelease(n);
ex = cbdataAlloc(netdbExchangeState);
ex->p = cbdataReference(p);
uri = internalRemoteUri(p->host, p->http_port, "/squid-internal-dynamic/", "netdb");
- debug(38, 3) ("netdbExchangeStart: Requesting '%s'\n", uri);
+ debugs(38, 3, "netdbExchangeStart: Requesting '" << uri << "'");
assert(NULL != uri);
ex->r = HttpRequest::CreateFromUrl(uri);
if (NULL == ex->r) {
- debug(38, 1) ("netdbExchangeStart: Bad URI %s\n", uri);
+ debugs(38, 1, "netdbExchangeStart: Bad URI " << uri);
return;
}
/*
- * $Id: pconn.cc,v 1.48 2007/04/15 14:46:17 serassio Exp $
+ * $Id: pconn.cc,v 1.49 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 48 Persistent Connections
* AUTHOR: Duane Wessels
{
int index = findFDIndex(fd);
assert(index >= 0);
- debug(48, 3) ("IdleConnList::removeFD: found FD %d at index %d\n", fd, index);
+ debugs(48, 3, "IdleConnList::removeFD: found FD " << fd << " at index " << index);
for (; index < nfds - 1; index++)
fds[index] = fds[index + 1];
if (--nfds == 0) {
- debug(48, 3) ("IdleConnList::removeFD: deleting %s\n", hashKeyStr(&hash));
+ debugs(48, 3, "IdleConnList::removeFD: deleting " << hashKeyStr(&hash));
delete this;
}
}
IdleConnList::push(int fd)
{
if (nfds == nfds_alloc) {
- debug(48, 3) ("IdleConnList::push: growing FD array\n");
+ debugs(48, 3, "IdleConnList::push: growing FD array");
nfds_alloc <<= 1;
int *old = fds;
fds = (int *)xmalloc(nfds_alloc * sizeof(int));
void
IdleConnList::read(int fd, char *buf, size_t len, comm_err_t flag, int xerrno, void *data)
{
- debug(48, 3) ("IdleConnList::read: %d bytes from FD %d\n", (int) len, fd);
+ debugs(48, 3, "IdleConnList::read: " << (int) len << " bytes from FD " << fd);
if (flag == COMM_ERR_CLOSING) {
/* Bail out early on COMM_ERR_CLOSING - close handlers will tidy up for us */
void
IdleConnList::timeout(int fd, void *data)
{
- debug(48, 3) ("IdleConnList::timeout: FD %d\n", fd);
+ debugs(48, 3, "IdleConnList::timeout: FD " << fd);
IdleConnList *list = (IdleConnList *) data;
list->removeFD(fd); /* might delete list */
comm_close(fd);
if (fdUsageHigh())
{
- debug(48, 3) ("PconnPool::push: Not many unused FDs\n");
+ debugs(48, 3, "PconnPool::push: Not many unused FDs");
comm_close(fd);
return;
} else if (shutting_down)
if (list == NULL)
{
list = new IdleConnList(aKey, this);
- debug(48, 3) ("pconnNew: adding %s\n", hashKeyStr(&list->hash));
+ debugs(48, 3, "pconnNew: adding " << hashKeyStr(&list->hash));
hash_join(table, &list->hash);
}
assert(!comm_has_incomplete_write(fd));
snprintf(desc, FD_DESC_SZ, "%s idle connection", host);
fd_note(fd, desc);
- debug(48, 3) ("PconnPool::push: pushed FD %d for %s\n", fd, aKey);
+ debugs(48, 3, "PconnPool::push: pushed FD " << fd << " for " << aKey);
}
/*
{
pools = (PconnPool **) xcalloc(MAX_NUM_PCONN_POOLS, sizeof(*pools));
pconn_fds_pool = memPoolCreate("pconn_fds", PCONN_FDS_SZ * sizeof(int));
- debug(48, 0) ("persistent connection module initialized\n");
+ debugs(48, 0, "persistent connection module initialized");
}
PconnModule *
/*
- * $Id: peer_digest.cc,v 1.121 2007/04/21 07:14:14 wessels Exp $
+ * $Id: peer_digest.cc,v 1.122 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 72 Peer Digest Routines
* AUTHOR: Alex Rousskov
static void
peerDigestDisable(PeerDigest * pd)
{
- debug(72, 2) ("peerDigestDisable: peer %s disabled for good\n",
- pd->host.buf());
+ debugs(72, 2, "peerDigestDisable: peer " << pd->host.buf() << " disabled for good");
pd->times.disabled = squid_curtime;
pd->times.next_check = -1; /* never */
pd->flags.usable = 0;
{
eventAdd("peerDigestCheck", peerDigestCheck, pd, (double) delay, 1);
pd->times.next_check = squid_curtime + delay;
- debug(72, 3) ("peerDigestSetCheck: will check peer %s in %d secs\n",
- pd->host.buf(), (int) delay);
+ debugs(72, 3, "peerDigestSetCheck: will check peer " << pd->host.buf() << " in " << (int) delay << " secs");
}
/*
peerDigestNotePeerGone(PeerDigest * pd)
{
if (pd->flags.requested) {
- debug(72, 2) ("peerDigest: peer %s gone, will destroy after fetch.\n",
- pd->host.buf());
+ debugs(72, 2, "peerDigest: peer " << pd->host.buf() << " gone, will destroy after fetch.");
/* do nothing now, the fetching chain will notice and take action */
} else {
- debug(72, 2) ("peerDigest: peer %s is gone, destroying now.\n",
- pd->host.buf());
+ debugs(72, 2, "peerDigest: peer " << pd->host.buf() << " is gone, destroying now.");
peerDigestDestroy(pd);
}
}
return;
}
- debug(72, 3) ("peerDigestCheck: peer %s:%d\n", pd->peer->host, pd->peer->http_port);
- debug(72, 3) ("peerDigestCheck: time: %ld, last received: %ld (%+d)\n",
- (long int) squid_curtime, (long int) pd->times.received, (int) (squid_curtime - pd->times.received));
+ debugs(72, 3, "peerDigestCheck: peer " << pd->peer->host << ":" << pd->peer->http_port);
+ debugs(72, 3, "peerDigestCheck: time: " << (long int) squid_curtime <<
+ ", last received: " << (long int) pd->times.received << " (" <<
+ std::showpos << (int) (squid_curtime - pd->times.received) << ")");
/* decide when we should send the request:
* request now unless too close to other requests */
/* per-peer limit */
if (req_time - pd->times.received < PeerDigestReqMinGap) {
- debug(72, 2) ("peerDigestCheck: %s, avoiding close peer requests (%d < %d secs).\n",
- pd->host.buf(), (int) (req_time - pd->times.received),
- (int) PeerDigestReqMinGap);
+ debugs(72, 2, "peerDigestCheck: " << pd->host.buf() <<
+ ", avoiding close peer requests (" <<
+ (int) (req_time - pd->times.received) << " < " <<
+ (int) PeerDigestReqMinGap << " secs).");
+
req_time = pd->times.received + PeerDigestReqMinGap;
}
/* global limit */
if (req_time - pd_last_req_time < GlobDigestReqMinGap) {
- debug(72, 2) ("peerDigestCheck: %s, avoiding close requests (%d < %d secs).\n",
- pd->host.buf(), (int) (req_time - pd_last_req_time),
- (int) GlobDigestReqMinGap);
+ debugs(72, 2, "peerDigestCheck: " << pd->host.buf() <<
+ ", avoiding close requests (" <<
+ (int) (req_time - pd_last_req_time) << " < " <<
+ (int) GlobDigestReqMinGap << " secs).");
+
req_time = pd_last_req_time + GlobDigestReqMinGap;
}
key = storeKeyPublicByRequest(req);
- debug(72, 2) ("peerDigestRequest: %s key: %s\n", url, storeKeyText(key));
+ debugs(72, 2, "peerDigestRequest: " << url << " key: " << storeKeyText(key));
/* add custom headers */
assert(!req->header.len);
old_e = fetch->old_entry = Store::Root().get(key);
if (old_e) {
- debug(72, 5) ("peerDigestRequest: found old entry\n");
+ debugs(72, 5, "peerDigestRequest: found old entry");
old_e->lock()
e->lastmod = old_e->lastmod;
/* push towards peer cache */
- debug(72, 3) ("peerDigestRequest: forwarding to fwdStart...\n");
+ debugs(72, 3, "peerDigestRequest: forwarding to fwdStart...");
FwdState::fwdStart(-1, e, req);
assert(reply);
assert (reply->sline.status != 0);
status = reply->sline.status;
- debug(72, 3) ("peerDigestFetchReply: %s status: %d, expires: %ld (%+d)\n",
- pd->host.buf(), status,
- (long int) reply->expires, (int) (reply->expires - squid_curtime));
+ debugs(72, 3, "peerDigestFetchReply: " << pd->host.buf() << " status: " << status <<
+ ", expires: " << (long int) reply->expires << " (" << std::showpos <<
+ (int) (reply->expires - squid_curtime) << ")");
/* this "if" is based on clientHandleIMSReply() */
/* get rid of old entry if any */
if (fetch->old_entry) {
- debug(72, 3) ("peerDigestFetchReply: got new digest, releasing old one\n");
+ debugs(72, 3, "peerDigestFetchReply: got new digest, releasing old one");
storeUnregister(fetch->old_sc, fetch->old_entry, fetch);
fetch->old_entry->releaseRequest();
fetch->old_entry->unlock();
assert (fetch->entry->getReply()->sline.status != 0);
if (fetch->entry->getReply()->sline.status != HTTP_OK) {
- debug(72, 1) ("peerDigestSwapInHeaders: %s status %d got cached!\n",
- fetch->pd->host.buf(), fetch->entry->getReply()->sline.status);
+ debugs(72, 1, "peerDigestSwapInHeaders: " << fetch->pd->host.buf() <<
+ " status " << fetch->entry->getReply()->sline.status <<
+ " got cached!");
+
peerDigestFetchAbort(fetch, buf, "internal status error");
return -1;
}
/* finish if we have a reason */
if (reason) {
const int level = strstr(reason, "?!") ? 1 : 3;
- debug(72, level) ("%s: peer %s, exiting after '%s'\n",
- step_name, host, reason);
+ debugs(72, level, "" << step_name << ": peer " << host << ", exiting after '" << reason << "'");
peerDigestReqFinish(fetch, buf,
1, pdcb_valid, pcb_valid, reason, !no_bug);
} else {
peerDigestFetchStop(DigestFetchState * fetch, char *buf, const char *reason)
{
assert(reason);
- debug(72, 2) ("peerDigestFetchStop: peer %s, reason: %s\n",
- fetch->pd->host.buf(), reason);
+ debugs(72, 2, "peerDigestFetchStop: peer " << fetch->pd->host.buf() << ", reason: " << reason);
peerDigestReqFinish(fetch, buf, 1, 1, 1, reason, 0);
}
peerDigestFetchAbort(DigestFetchState * fetch, char *buf, const char *reason)
{
assert(reason);
- debug(72, 2) ("peerDigestFetchAbort: peer %s, reason: %s\n",
- fetch->pd->host.buf(), reason);
+ debugs(72, 2, "peerDigestFetchAbort: peer " << fetch->pd->host.buf() << ", reason: " << reason);
peerDigestReqFinish(fetch, buf, 1, 1, 1, reason, 1);
}
pd->stats.recv.msgs += fetch->recv.msg;
if (err) {
- debug(72, 1) ("%sdisabling (%s) digest from %s\n",
- pcb_valid ? "temporary " : "",
- pd->req_result, host);
+ debugs(72, 1, "" << (pcb_valid ? "temporary " : "" ) << "disabling (" << pd->req_result << ") digest from " << host);
if (pd->cd) {
cacheDigestDestroy(pd->cd);
/* XXX: ugly condition, but how? */
if (fetch->entry->store_status == STORE_OK)
- debug(72, 2) ("re-used old digest from %s\n", host);
+ debugs(72, 2, "re-used old digest from " << host);
else
- debug(72, 2) ("received valid digest from %s\n", host);
+ debugs(72, 2, "received valid digest from " << host);
}
cbdataReferenceDone(fetch->pd);
assert(fetch->entry && fetch->request);
if (fetch->old_entry) {
- debug(72, 2) ("peerDigestFetchFinish: deleting old entry\n");
+ debugs(72, 2, "peerDigestFetchFinish: deleting old entry");
storeUnregister(fetch->old_sc, fetch->old_entry, fetch);
fetch->old_entry->releaseRequest();
fetch->old_entry->unlock();
fetch->expires = fetch->entry->expires;
fetch->resp_time = squid_curtime - fetch->start_time;
- debug(72, 3) ("peerDigestFetchFinish: recv %d bytes in %d secs\n",
- fetch->recv.bytes, (int) fetch->resp_time);
- debug(72, 3) ("peerDigestFetchFinish: expires: %ld (%+d), lmt: %ld (%+d)\n",
- (long int) fetch->expires, (int) (fetch->expires - squid_curtime),
- (long int) fetch->entry->lastmod, (int) (fetch->entry->lastmod - squid_curtime));
+ debugs(72, 3, "peerDigestFetchFinish: recv " << fetch->recv.bytes <<
+ " bytes in " << (int) fetch->resp_time << " secs");
+
+ debugs(72, 3, "peerDigestFetchFinish: expires: " <<
+ (long int) fetch->expires << " (" << std::showpos <<
+ (int) (fetch->expires - squid_curtime) << "), lmt: " <<
+ std::noshowpos << (long int) fetch->entry->lastmod << " (" <<
+ std::showpos << (int) (fetch->entry->lastmod - squid_curtime) <<
+ ")");
+
}
cblock.count = ntohl(cblock.count);
cblock.del_count = ntohl(cblock.del_count);
cblock.mask_size = ntohl(cblock.mask_size);
- debug(72, 2) ("got digest cblock from %s; ver: %d (req: %d)\n",
- host, (int) cblock.ver.current, (int) cblock.ver.required);
- debug(72, 2) ("\t size: %d bytes, e-cnt: %d, e-util: %d%%\n",
- cblock.mask_size, cblock.count,
- xpercentInt(cblock.count, cblock.capacity));
+ debugs(72, 2, "got digest cblock from " << host << "; ver: " <<
+ (int) cblock.ver.current << " (req: " << (int) cblock.ver.required <<
+ ")");
+
+ debugs(72, 2, "\t size: " <<
+ cblock.mask_size << " bytes, e-cnt: " <<
+ cblock.count << ", e-util: " <<
+ xpercentInt(cblock.count, cblock.capacity) << "%" );
/* check version requirements (both ways) */
if (cblock.ver.required > CacheDigestVer.current) {
- debug(72, 1) ("%s digest requires version %d; have: %d\n",
- host, cblock.ver.required, CacheDigestVer.current);
+ debugs(72, 1, "" << host << " digest requires version " <<
+ cblock.ver.required << "; have: " << CacheDigestVer.current);
+
return 0;
}
if (cblock.ver.current < CacheDigestVer.required) {
- debug(72, 1) ("%s digest is version %d; we require: %d\n",
- host, cblock.ver.current, CacheDigestVer.required);
+ debugs(72, 1, "" << host << " digest is version " <<
+ cblock.ver.current << "; we require: " <<
+ CacheDigestVer.required);
+
return 0;
}
if (cblock.ver.required > cblock.ver.current ||
cblock.mask_size <= 0 || cblock.capacity <= 0 ||
cblock.bits_per_entry <= 0 || cblock.hash_func_count <= 0) {
- debug(72, 0) ("%s digest cblock is corrupted.\n", host);
+ debugs(72, 0, "" << host << " digest cblock is corrupted.");
return 0;
}
/* there are some things we cannot do yet */
if (cblock.hash_func_count != CacheDigestHashFuncCount) {
- debug(72, 0) ("%s digest: unsupported #hash functions: %d ? %d.\n",
- host, cblock.hash_func_count, CacheDigestHashFuncCount);
+ debugs(72, 0, "" << host << " digest: unsupported #hash functions: " <<
+ cblock.hash_func_count << " ? " << CacheDigestHashFuncCount << ".");
return 0;
}
}
if (!pd->cd) {
- debug(72, 2) ("creating %s digest; size: %d (%+d) bytes\n",
- host, cblock.mask_size, (int) (cblock.mask_size - freed_size));
+ debugs(72, 2, "creating " << host << " digest; size: " << cblock.mask_size << " (" <<
+ std::showpos << (int) (cblock.mask_size - freed_size) << ") bytes");
pd->cd = cacheDigestCreate(cblock.capacity, cblock.bits_per_entry);
if (cblock.mask_size >= freed_size)
const int bit_util = cacheDigestBitUtil(pd->cd);
if (bit_util > 65) {
- debug(72, 0) ("Warning: %s peer digest has too many bits on (%d%%).\n",
- pd->host.buf(), bit_util);
+ debugs(72, 0, "Warning: " << pd->host.buf() <<
+ " peer digest has too many bits on (" << bit_util << "%%).");
+
return 0;
}
/*
- * $Id: peer_select.cc,v 1.145 2007/04/21 07:14:15 wessels Exp $
+ * $Id: peer_select.cc,v 1.146 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 44 Peer Selection Algorithm
* AUTHOR: Duane Wessels
peerSelectStateFree(ps_state * psstate)
{
if (psstate->acl_checklist) {
- debug(44, 1) ("calling aclChecklistFree() from peerSelectStateFree\n");
+ debugs(44, 1, "calling aclChecklistFree() from peerSelectStateFree");
delete (psstate->acl_checklist);
}
assert(entry);
assert(entry->ping_status == PING_NONE);
assert(direct != DIRECT_YES);
- debug(44, 3) ("peerSelectIcpPing: %s\n", entry->url());
+ debugs(44, 3, "peerSelectIcpPing: " << entry->url() );
if (!request->flags.hierarchical && direct != DIRECT_NO)
return 0;
n = neighborsCount(request);
- debug(44, 3) ("peerSelectIcpPing: counted %d neighbors\n", n);
+ debugs(44, 3, "peerSelectIcpPing: counted " << n << " neighbors");
return n;
}
ps_state *psstate;
if (entry)
- debug(44, 3) ("peerSelect: %s\n", entry->url());
+ debugs(44, 3, "peerSelect: " << entry->url() );
else
- debug(44, 3) ("peerSelect: %s\n", RequestMethodStr[request->method]);
+ debugs(44, 3, "peerSelect: " << RequestMethodStr[request->method]);
psstate = new ps_state;
{
ps_state *psstate = (ps_state *) data;
psstate->acl_checklist = NULL;
- debug(44, 3) ("peerCheckNeverDirectDone: %d\n", answer);
+ debugs(44, 3, "peerCheckNeverDirectDone: " << answer);
psstate->never_direct = answer ? 1 : -1;
peerSelectFoo(psstate);
}
{
ps_state *psstate = (ps_state *)data;
psstate->acl_checklist = NULL;
- debug(44, 3) ("peerCheckAlwaysDirectDone: %d\n", answer);
+ debugs(44, 3, "peerCheckAlwaysDirectDone: " << answer);
psstate->always_direct = answer ? 1 : -1;
peerSelectFoo(psstate);
}
void *cbdata;
if (entry) {
- debug(44, 3) ("peerSelectCallback: %s\n", entry->url());
+ debugs(44, 3, "peerSelectCallback: " << entry->url() );
if (entry->ping_status == PING_WAITING)
eventDelete(peerPingTimeout, psstate);
}
if (fs == NULL) {
- debug(44, 1) ("Failed to select source for '%s'\n", entry->url());
- debug(44, 1) (" always_direct = %d\n", psstate->always_direct);
- debug(44, 1) (" never_direct = %d\n", psstate->never_direct);
- debug(44, 1) (" timedout = %d\n", psstate->ping.timedout);
+ debugs(44, 1, "Failed to select source for '" << entry->url() << "'" );
+ debugs(44, 1, " always_direct = " << psstate->always_direct );
+ debugs(44, 1, " never_direct = " << psstate->never_direct );
+ debugs(44, 1, " timedout = " << psstate->ping.timedout );
}
psstate->ping.stop = current_time;
myrtt = netdbHostRtt(psstate->request->host);
- debug(44, 3) ("peerCheckNetdbDirect: MY RTT = %d msec\n", myrtt);
+ debugs(44, 3, "peerCheckNetdbDirect: MY RTT = " << myrtt << " msec");
+ debugs(44, 3, "peerCheckNetdbDirect: minimum_direct_rtt = " << Config.minDirectRtt << " msec");
- debug(44, 3) ("peerCheckNetdbDirect: minimum_direct_rtt = %d msec\n",
- Config.minDirectRtt);
if (myrtt && myrtt <= Config.minDirectRtt)
return 1;
myhops = netdbHostHops(psstate->request->host);
- debug(44, 3) ("peerCheckNetdbDirect: MY hops = %d\n", myhops);
+ debugs(44, 3, "peerCheckNetdbDirect: MY hops = " << myhops);
+ debugs(44, 3, "peerCheckNetdbDirect: minimum_direct_hops = " << Config.minDirectHops);
- debug(44, 3) ("peerCheckNetdbDirect: minimum_direct_hops = %d\n",
- Config.minDirectHops);
if (myhops && myhops <= Config.minDirectHops)
return 1;
if (p == NULL)
return 0;
- debug(44, 3) ("peerCheckNetdbDirect: closest_parent_miss RTT = %d msec\n",
- psstate->ping.p_rtt);
+ debugs(44, 3, "peerCheckNetdbDirect: closest_parent_miss RTT = " << psstate->ping.p_rtt << " msec");
if (myrtt && myrtt <= psstate->ping.p_rtt)
return 1;
{
StoreEntry *entry = ps->entry;
HttpRequest *request = ps->request;
- debug(44, 3) ("peerSelectFoo: '%s %s'\n",
- RequestMethodStr[request->method],
- request->host);
+ debugs(44, 3, "peerSelectFoo: '" << RequestMethodStr[request->method] << " " << request->host << "'");
if (ps->direct == DIRECT_UNKNOWN) {
if (ps->always_direct == 0 && Config.accessList.AlwaysDirect) {
ps->direct = DIRECT_MAYBE;
}
- debug(44, 3) ("peerSelectFoo: direct = %s\n",
- DirectStr[ps->direct]);
+ debugs(44, 3, "peerSelectFoo: direct = " << DirectStr[ps->direct]);
}
if (entry == NULL) {
if ((p = netdbClosestParent(request))) {
code = CLOSEST_PARENT;
} else if (peerSelectIcpPing(request, ps->direct, entry)) {
- debug(44, 3) ("peerSelect: Doing ICP pings\n");
+ debugs(44, 3, "peerSelect: Doing ICP pings");
ps->ping.start = current_time;
ps->ping.n_sent = neighborsUdpPing(request,
entry,
&ps->ping.timeout);
if (ps->ping.n_sent == 0)
- debug(44, 0) ("WARNING: neighborsUdpPing returned 0\n");
+ debugs(44, 0, "WARNING: neighborsUdpPing returned 0");
+ debugs(44, 3, "peerSelect: " << ps->ping.n_replies_expected <<
+ " ICP replies expected, RTT " << ps->ping.timeout <<
+ " msec");
- debug(44, 3) ("peerSelect: %d ICP replies expected, RTT %d msec\n",
- ps->ping.n_replies_expected, ps->ping.timeout);
if (ps->ping.n_replies_expected > 0) {
entry->ping_status = PING_WAITING;
if (code != HIER_NONE) {
assert(p);
- debug(44, 3) ("peerSelect: %s/%s\n", hier_strings[code], p->host);
+ debugs(44, 3, "peerSelect: " << hier_strings[code] << "/" << p->host);
peerAddFwdServer(&ps->servers, p, code);
}
if (peerCheckNetdbDirect(ps)) {
code = CLOSEST_DIRECT;
- debug(44, 3) ("peerSelect: %s/%s\n", hier_strings[code], request->host);
+ debugs(44, 3, "peerSelect: " << hier_strings[code] << "/" << request->host);
peerAddFwdServer(&ps->servers, NULL, code);
return;
}
}
if (p && code != HIER_NONE) {
- debug(44, 3) ("peerSelect: %s/%s\n", hier_strings[code], p->host);
+ debugs(44, 3, "peerSelect: " << hier_strings[code] << "/" << p->host);
peerAddFwdServer(&ps->servers, p, code);
}
}
peer *p;
HttpRequest *request = ps->request;
hier_code code = HIER_NONE;
- debug(44, 3) ("peerGetSomeParent: %s %s\n",
- RequestMethodStr[request->method],
- request->host);
+ debugs(44, 3, "peerGetSomeParent: " << RequestMethodStr[request->method] << " " << request->host);
if (ps->direct == DIRECT_YES)
return;
}
if (code != HIER_NONE) {
- debug(44, 3) ("peerSelect: %s/%s\n", hier_strings[code], p->host);
+ debugs(44, 3, "peerSelect: " << hier_strings[code] << "/" << p->host);
peerAddFwdServer(&ps->servers, p, code);
}
}
if (!peerHTTPOkay(p, request))
continue;
- debug(15, 3) ("peerGetAllParents: adding alive parent %s\n", p->host);
+ debugs(15, 3, "peerGetAllParents: adding alive parent " << p->host);
peerAddFwdServer(&ps->servers, p, ANY_OLD_PARENT);
}
StoreEntry *entry = psstate->entry;
if (entry)
- debug(44, 3) ("peerPingTimeout: '%s'\n", entry->url());
+ debugs(44, 3, "peerPingTimeout: '" << entry->url() << "'" );
if (!cbdataReferenceValid(psstate->callback_data)) {
/* request aborted */
{
ps_state *psstate = (ps_state *)data;
icp_opcode op = header->getOpCode();
- debug(44, 3) ("peerHandleIcpReply: %s %s\n",
- icp_opcode_str[op],
- psstate->entry->url());
+ debugs(44, 3, "peerHandleIcpReply: " << icp_opcode_str[op] << " " << psstate->entry->url() );
#if USE_CACHE_DIGESTS && 0
/* do cd lookup to count false misses */
peerHandleHtcpReply(peer * p, peer_t type, htcpReplyData * htcp, void *data)
{
ps_state *psstate = (ps_state *)data;
- debug(44, 3) ("peerHandleHtcpReply: %s %s\n",
- htcp->hit ? "HIT" : "MISS",
- psstate->entry->url());
+ debugs(44, 3, "peerHandleHtcpReply: " <<
+ (htcp->hit ? "HIT" : "MISS") << " " <<
+ psstate->entry->url() );
psstate->ping.n_recv++;
if (htcp->hit) {
#endif
else
- debug(44, 1) ("peerHandlePingReply: unknown protocol_t %d\n", (int) proto);
+ debugs(44, 1, "peerHandlePingReply: unknown protocol_t " << (int) proto);
}
static void
peerAddFwdServer(FwdServer ** FSVR, peer * p, hier_code code)
{
FwdServer *fs = (FwdServer *)memAllocate(MEM_FWD_SERVER);
- debug(44, 5) ("peerAddFwdServer: adding %s %s\n",
- p ? p->host : "DIRECT",
- hier_strings[code]);
+ debugs(44, 5, "peerAddFwdServer: adding " <<
+ (p ? p->host : "DIRECT") << " " <<
+ hier_strings[code] );
fs->_peer = cbdataReference(p);
fs->code = code;
/*
- * $Id: pinger.cc,v 1.57 2007/04/24 15:04:22 hno Exp $
+ * $Id: pinger.cc,v 1.58 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 42 ICMP Pinger program
* AUTHOR: Duane Wessels
if (x < (int)sizeof(wpi)) {
getCurrentTime();
- debug(42, 0) ("pingerOpen: read: FD 0: %s\n", xstrerror());
+ debugs(42, 0, "pingerOpen: read: FD 0: " << xstrerror());
write(1, "ERR\n", 4);
exit(1);
}
if (x < (int)sizeof(PS)) {
getCurrentTime();
- debug(42, 0) ("pingerOpen: read: FD 0: %s\n", xstrerror());
+ debugs(42, 0, "pingerOpen: read: FD 0: " << xstrerror());
write(1, "ERR\n", 4);
exit(1);
}
#endif
if ((proto = getprotobyname("icmp")) == 0) {
- debug(42, 0) ("pingerOpen: unknown protocol: icmp\n");
+ debugs(42, 0, "pingerOpen: unknown protocol: icmp");
exit(1);
}
icmp_sock = socket(PF_INET, SOCK_RAW, proto->p_proto);
if (icmp_sock < 0) {
- debug(50, 0) ("pingerOpen: icmp_sock: %s\n", xstrerror());
+ debugs(50, 0, "pingerOpen: icmp_sock: " << xstrerror());
exit(1);
}
icmp_ident = getpid() & 0xffff;
- debug(42, 0) ("pinger: ICMP socket opened\n");
+ debugs(42, 0, "pinger: ICMP socket opened");
#ifdef _SQUID_MSWIN_
socket_to_squid =
if (socket_to_squid == -1) {
getCurrentTime();
- debug(42, 0) ("pingerOpen: WSASocket: %s\n", xstrerror());
+ debugs(42, 0, "pingerOpen: WSASocket: " << xstrerror());
write(1, "ERR\n", 4);
exit(1);
}
if (SOCKET_ERROR == x) {
getCurrentTime();
- debug(42, 0) ("pingerOpen: connect: %s\n", xstrerror());
+ debugs(42, 0, "pingerOpen: connect: " << xstrerror());
write(1, "ERR\n", 4);
exit(1);
}
x = recv(socket_to_squid, (void *) buf, sizeof(buf), 0);
if (x < 3) {
- debug(42, 0) ("icmpOpen: recv: %s\n", xstrerror());
+ debugs(42, 0, "icmpOpen: recv: " << xstrerror());
exit(1);
}
x = send(socket_to_squid, (const void *) buf, strlen(buf), 0);
if (x < 3 || strncmp("OK\n", buf, 3)) {
- debug(42, 0) ("icmpOpen: recv: %s\n", xstrerror());
+ debugs(42, 0, "icmpOpen: recv: " << xstrerror());
exit(1);
}
getCurrentTime();
- debug(42, 0) ("pinger: Squid socket opened\n");
+ debugs(42, 0, "pinger: Squid socket opened");
#endif
}
#endif
- debug(42, 9) ("pingerRecv: %d bytes from %s\n", n, inet_ntoa(from.sin_addr));
+ debugs(42, 9, "pingerRecv: " << n << " bytes from " <<
+ inet_ntoa(from.sin_addr));
ip = (struct iphdr *) (void *) pkt;
pingerLog(struct icmphdr *icmp, struct IN_ADDR addr, int rtt, int hops)
{
- debug(42, 2) ("pingerLog: %9d.%06d %-16s %d %-15.15s %dms %d hops\n",
- (int) current_time.tv_sec,
- (int) current_time.tv_usec,
- inet_ntoa(addr),
- (int) icmp->icmp_type,
- icmpPktStr[icmp->icmp_type],
- rtt,
- hops);
+ debugs(42, 2, "pingerLog: " << std::setw(9) << (int) current_time.tv_sec <<
+ "."<< std::setfill('0') << std::setw(6) <<
+ (int) current_time.tv_usec << " "<< std::left << std::setfill(' ')<<
+ std::setw(16) << inet_ntoa(addr) << " "<< (int) icmp->icmp_type <<
+ " " << std::setw(15) << icmpPktStr[icmp->icmp_type] << " " << rtt <<
+ "ms " << hops << " hops");
}
static int
int len = sizeof(pingerReplyData) - MAX_PKT_SZ + preply->psize;
if (send(socket_to_squid, preply, len, 0) < 0) {
- debug(50, 0) ("pinger: send: %s\n", xstrerror());
+ debugs(50, 0, "pinger: send: " << xstrerror());
pingerClose();
exit(1);
}
if (FD_ISSET(socket_from_squid, &R))
if (pingerReadRequest() < 0) {
- debug(42, 0) ("Pinger exiting.\n");
+ debugs(42, 0, "Pinger exiting.");
pingerClose();
exit(1);
}
/*
- * $Id: redirect.cc,v 1.116 2007/04/20 22:11:34 wessels Exp $
+ * $Id: redirect.cc,v 1.117 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 61 Redirector
* AUTHOR: Duane Wessels
redirectStateData *r = static_cast<redirectStateData *>(data);
char *t;
void *cbdata;
- debug(61, 5) ("redirectHandleRead: {%s}\n", reply ? reply : "<NULL>");
+ debugs(61, 5, "redirectHandleRead: {" << (reply ? reply : "<NULL>") << "}");
if (reply) {
if ((t = strchr(reply, ' ')))
char buf[8192];
assert(http);
assert(handler);
- debug(61, 5) ("redirectStart: '%s'\n", http->uri);
+ debugs(61, 5, "redirectStart: '" << http->uri << "'");
if (Config.onoff.redirector_bypass && redirectors->stats.queue_size) {
/* Skip redirector if there is one request queued */
/*
- * $Id: referer.cc,v 1.8 2007/04/25 11:30:18 adrian Exp $
+ * $Id: referer.cc,v 1.9 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 40 Referer Logging
* AUTHOR: Joe Ramey <ramey@csc.ti.com> (useragent)
assert(NULL == refererlog);
if (!Config.Log.referer || (0 == strcmp(Config.Log.referer, "none"))) {
- debug(40, 1) ("Referer logging is disabled.\n");
+ debugs(40, 1, "Referer logging is disabled.");
return;
}
/*
- * $Id: refresh.cc,v 1.73 2006/09/13 15:42:15 adrian Exp $
+ * $Id: refresh.cc,v 1.74 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 22 Refresh Calculation
* AUTHOR: Harvest Derived
sf->expires = true;
if (entry->expires > check_time) {
- debug(22, 3) ("FRESH: expires %d >= check_time %d \n",
- (int) entry->expires, (int) check_time);
+ debugs(22, 3, "FRESH: expires " << (int) entry->expires <<
+ " >= check_time " << (int) check_time << " ");
+
return -1;
} else {
- debug(22, 3) ("STALE: expires %d < check_time %d \n",
- (int) entry->expires, (int) check_time);
+ debugs(22, 3, "STALE: expires " << (int) entry->expires <<
+ " < check_time " << (int) check_time << " ");
+
return (check_time - entry->expires);
}
}
*/
if (age > R->max) {
- debug(22, 3) ("STALE: age %d > max %d \n", (int) age, (int) R->max);
+ debugs(22, 3, "STALE: age " << (int) age << " > max " << (int) R->max << " ");
sf->max = true;
return (age - R->max);
}
sf->lmfactor = true;
if (age >= stale_age) {
- debug(22, 3) ("STALE: age %d > stale_age %d\n",
- (int) age, (int) stale_age);
+ debugs(22, 3, "STALE: age " << (int) age << " > stale_age " << (int) stale_age);
return (age - stale_age);
} else {
- debug(22, 3) ("FRESH: age %d <= stale_age %d\n",
- (int) age, (int) stale_age);
+ debugs(22, 3, "FRESH: age " << (int) age << " <= stale_age " << (int) stale_age);
return -1;
}
}
* configured minimum age.
*/
if (age <= R->min) {
- debug(22, 3) ("FRESH: age %d <= min %d\n", (int) age, (int) R->min);
+ debugs(22, 3, "FRESH: age " << (int) age << " <= min " << (int) R->min);
sf->min = true;
return -1;
}
- debug(22, 3) ("STALE: age %d > min %d\n", (int) age, (int) R->min);
+ debugs(22, 3, "STALE: age " << (int) age << " > min " << (int) R->min);
return (age - R->min);
}
else if (request)
uri = urlCanonical(request);
- debug(22, 3) ("refreshCheck: '%s'\n", uri ? uri : "<none>");
+ debugs(22, 3, "refreshCheck: '" << (uri ? uri : "<none>") << "'");
if (check_time > entry->timestamp)
age = check_time - entry->timestamp;
staleness = refreshStaleness(entry, check_time, age, R, &sf);
- debug(22, 3) ("Staleness = %d\n", staleness);
+ debugs(22, 3, "Staleness = " << staleness);
+
+ debugs(22, 3, "refreshCheck: Matched '" << R->pattern << " " <<
+ (int) R->min << " " << (int) (100.0 * R->pct) << "%% " <<
+ (int) R->max << "'");
- debug(22, 3) ("refreshCheck: Matched '%s %d %d%% %d'\n",
- R->pattern, (int) R->min, (int) (100.0 * R->pct), (int) R->max);
- debug(22, 3) ("refreshCheck: age = %d\n", (int) age);
+ debugs(22, 3, "refreshCheck: age = " << (int) age);
- debug(22, 3) ("\tcheck_time:\t%s\n", mkrfc1123(check_time));
+ debugs(22, 3, "\tcheck_time:\t" << mkrfc1123(check_time));
- debug(22, 3) ("\tentry->timestamp:\t%s\n", mkrfc1123(entry->timestamp));
+ debugs(22, 3, "\tentry->timestamp:\t" << mkrfc1123(entry->timestamp));
if (EBIT_TEST(entry->flags, ENTRY_REVALIDATE) && staleness > -1) {
- debug(22, 3) ("refreshCheck: YES: Must revalidate stale response\n");
+ debugs(22, 3, "refreshCheck: YES: Must revalidate stale response");
return STALE_MUST_REVALIDATE;
}
if (request->flags.ims && (R->flags.refresh_ims || Config.onoff.refresh_all_ims)) {
/* The clients no-cache header is changed into a IMS query */
- debug(22, 3) ("refreshCheck: YES: refresh-ims\n");
+ debugs(22, 3, "refreshCheck: YES: refresh-ims");
return STALE_FORCED_RELOAD;
}
(void) 0;
} else if (R->flags.ignore_reload) {
/* The clients no-cache header is ignored */
- debug(22, 3) ("refreshCheck: MAYBE: ignore-reload\n");
+ debugs(22, 3, "refreshCheck: MAYBE: ignore-reload");
} else if (R->flags.reload_into_ims || Config.onoff.reload_into_ims) {
/* The clients no-cache header is changed into a IMS query */
- debug(22, 3) ("refreshCheck: YES: reload-into-ims\n");
+ debugs(22, 3, "refreshCheck: YES: reload-into-ims");
return STALE_RELOAD_INTO_IMS;
} else {
/* The clients no-cache header is not overridden on this request */
- debug(22, 3) ("refreshCheck: YES: client reload\n");
+ debugs(22, 3, "refreshCheck: YES: client reload");
request->flags.nocache = 1;
return STALE_FORCED_RELOAD;
}
#if 0
if (cc->max_age == 0) {
- debug (22,3) ("refreshCheck: YES: client-max-age = 0\n");
+ debugs(22, 3, "refreshCheck: YES: client-max-age = 0");
return STALE_EXCEEDS_REQUEST_MAX_AGE_VALUE;
}
#endif
if (age > cc->max_age) {
- debug(22, 3) ("refreshCheck: YES: age > client-max-age\n");
+ debugs(22, 3, "refreshCheck: YES: age > client-max-age");
return STALE_EXCEEDS_REQUEST_MAX_AGE_VALUE;
}
}
if (EBIT_TEST(cc->mask, CC_MAX_STALE) && staleness > -1) {
if (cc->max_stale < 0) {
/* max-stale directive without a value */
- debug(22, 3) ("refreshCheck: NO: max-stale wildcard\n");
+ debugs(22, 3, "refreshCheck: NO: max-stale wildcard");
return FRESH_REQUEST_MAX_STALE_ALL;
} else if (staleness < cc->max_stale) {
- debug(22, 3) ("refreshCheck: NO: staleness < max-stale\n");
+ debugs(22, 3, "refreshCheck: NO: staleness < max-stale");
return FRESH_REQUEST_MAX_STALE_VALUE;
}
}
}
if (-1 == staleness) {
- debug(22, 3) ("refreshCheck: object isn't stale..\n");
+ debugs(22, 3, "refreshCheck: object isn't stale..");
if (sf.expires) {
- debug(22, 3) ("refreshCheck: returning FRESH_EXPIRES\n");
+ debugs(22, 3, "refreshCheck: returning FRESH_EXPIRES");
return FRESH_EXPIRES;
}
assert(!sf.max);
if (sf.lmfactor) {
- debug(22, 3) ("refreshCheck: returning FRESH_LMFACTOR_RULE\n");
+ debugs(22, 3, "refreshCheck: returning FRESH_LMFACTOR_RULE");
return FRESH_LMFACTOR_RULE;
}
assert(sf.min);
- debug(22, 3) ("refreshCheck: returning FRESH_MIN_RULE\n");
+ debugs(22, 3, "refreshCheck: returning FRESH_MIN_RULE");
return FRESH_MIN_RULE;
}
#if HTTP_VIOLATIONS
if (R->flags.override_expire && age < R->min) {
- debug(22, 3) ("refreshCheck: NO: age < min && override-expire\n");
+ debugs(22, 3, "refreshCheck: NO: age < min && override-expire");
return FRESH_OVERRIDE_EXPIRES;
}
#if HTTP_VIOLATIONS
if (R->flags.override_lastmod && age < R->min) {
- debug(22, 3) ("refreshCheck: NO: age < min && override-lastmod\n");
+ debugs(22, 3, "refreshCheck: NO: age < min && override-lastmod");
return FRESH_OVERRIDE_LASTMOD;
}
return STALE_LMFACTOR_RULE;
}
- debug(22, 3) ("refreshCheck: returning STALE_DEFAULT\n");
+ debugs(22, 3, "refreshCheck: returning STALE_DEFAULT");
return STALE_DEFAULT;
}
getMaxAge(const char *url)
{
const refresh_t *R;
- debug(22, 3) ("getMaxAge: '%s'\n", url);
+ debugs(22, 3, "getMaxAge: '" << url << "'");
if ((R = refreshLimits(url)))
return R->max;
/*
- * $Id: store_heap_replacement.cc,v 1.14 2006/05/08 23:38:35 robertc Exp $
+ * $Id: store_heap_replacement.cc,v 1.15 2007/04/28 22:26:51 hno Exp $
*
* DEBUG: section 20 Storage Manager Heap-based replacement
* AUTHOR: John Dilley
" heap_age=" << heap_age << " tie=" << tie << " -> " << key);
if (e->mem_obj && e->mem_obj->url)
- debug(81, 3) ("HeapKeyGen_StoreEntry_LFUDA: url=%s\n",
- e->mem_obj->url);
+ debugs(81, 3, "HeapKeyGen_StoreEntry_LFUDA: url=" << e->mem_obj->url);
return (double) key;
}
" -> " << key);
if (e->mem_obj && e->mem_obj->url)
- debug(81, 3) ("HeapKeyGen_StoreEntry_GDSF: url=%s\n",
- e->mem_obj->url);
+ debugs(81, 3, "HeapKeyGen_StoreEntry_GDSF: url=" << e->mem_obj->url);
return key;
}
HeapKeyGen_StoreEntry_LRU(void *entry, double heap_age)
{
StoreEntry *e = (StoreEntry *)entry;
- debug(81, 3) ("HeapKeyGen_StoreEntry_LRU: %s heap_age=%f lastref=%f\n",
- e->getMD5Text(), heap_age, (double) e->lastref);
+ debugs(81, 3, "HeapKeyGen_StoreEntry_LRU: " <<
+ e->getMD5Text() << " heap_age=" << heap_age <<
+ " lastref=" << (double) e->lastref );
if (e->mem_obj && e->mem_obj->url)
- debug(81, 3) ("HeapKeyGen_StoreEntry_LRU: url=%s\n",
- e->mem_obj->url);
+ debugs(81, 3, "HeapKeyGen_StoreEntry_LRU: url=" << e->mem_obj->url);
return (heap_key) e->lastref;
}
/*
- * $Id: store_repl_heap.cc,v 1.23 2007/04/25 11:30:19 adrian Exp $
+ * $Id: store_repl_heap.cc,v 1.24 2007/04/28 22:26:51 hno Exp $
*
* DEBUG: section 81 Store HEAP Removal Policies
* AUTHOR: Henrik Nordstrom
if (heap_walker->min_age > 0) {
heap->theHeap->age = heap_walker->min_age;
- debug(81, 3) ("heap_purgeDone: Heap age set to %f\n",
- (double) heap->theHeap->age);
+ debugs(81, 3, "heap_purgeDone: Heap age set to " << (double) heap->theHeap->age );
}
/*
keytype = args->key;
args = args->next;
} else {
- debug(81, 1) ("createRemovalPolicy_heap: No key type specified. Using LRU\n");
+ debugs(81, 1, "createRemovalPolicy_heap: No key type specified. Using LRU");
keytype = "LRU";
}
else if (!strcmp(keytype, "LRU"))
heap_data->keyfunc = HeapKeyGen_StoreEntry_LRU;
else {
- debug(81, 0) ("createRemovalPolicy_heap: Unknown key type \"%s\". Using LRU\n",
- keytype);
+ debugs(81, 0, "createRemovalPolicy_heap: Unknown key type \"" << keytype << "\". Using LRU");
heap_data->keyfunc = HeapKeyGen_StoreEntry_LRU;
}
/*
- * $Id: send-announce.cc,v 1.67 2006/08/07 02:28:22 robertc Exp $
+ * $Id: send-announce.cc,v 1.68 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 27 Cache Announcer
* AUTHOR: Duane Wessels
int x;
if (ia == NULL) {
- debug(27, 1) ("send_announce: Unknown host '%s'\n", host);
+ debugs(27, 1, "send_announce: Unknown host '" << host << "'");
return;
}
- debug(27, 1) ("Sending Announcement to %s\n", host);
+ debugs(27, 1, "Sending Announcement to " << host);
sndbuf[0] = '\0';
snprintf(tbuf, 256, "cache_version SQUID/%s\n", version_string);
strcat(sndbuf, tbuf);
sndbuf[l] = '\0';
file_close(fd);
} else {
- debug(50, 1) ("send_announce: %s: %s\n", file, xstrerror());
+ debugs(50, 1, "send_announce: " << file << ": " << xstrerror());
}
}
sndbuf, strlen(sndbuf) + 1);
if (x < 0)
- debug(27, 1) ("send_announce: FD %d: %s\n", theOutIcpConnection,
- xstrerror());
+ debugs(27, 1, "send_announce: FD " << theOutIcpConnection << ": " << xstrerror());
}
/*
- * $Id: snmp_agent.cc,v 1.95 2007/04/25 11:30:18 adrian Exp $
+ * $Id: snmp_agent.cc,v 1.96 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 49 SNMP Interface
* AUTHOR: Kostas Anagnostakis
snmp_sysFn(variable_list * Var, snint * ErrP)
{
variable_list *Answer = NULL;
- debug(49, 5) ("snmp_sysFn: Processing request:\n");
+ debugs(49, 5, "snmp_sysFn: Processing request:");
snmpDebugOid(5, Var->name, Var->name_length);
*ErrP = SNMP_ERR_NOERROR;
{
variable_list *Answer = NULL;
const char *cp = NULL;
- debug(49, 5) ("snmp_confFn: Processing request with magic %d!\n", Var->name[8]);
+ debugs(49, 5, "snmp_confFn: Processing request with magic " << Var->name[8] << "!");
*ErrP = SNMP_ERR_NOERROR;
switch (Var->name[LEN_SQ_CONF]) {
char *cp = NULL;
peer *p = NULL;
int cnt = 0;
- debug(49, 5) ("snmp_meshPtblFn: peer %d requested!\n", Var->name[LEN_SQ_MESH + 3]);
+ debugs(49, 5, "snmp_meshPtblFn: peer " << Var->name[LEN_SQ_MESH + 3] << " requested!");
*ErrP = SNMP_ERR_NOERROR;
laddr = oid2addr(&Var->name[LEN_SQ_MESH + 3]);
variable_list *Answer = NULL;
static struct rusage rusage;
- debug(49, 5) ("snmp_prfSysFn: Processing request with magic %d!\n", Var->name[LEN_SQ_PRF + 1]);
+ debugs(49, 5, "snmp_prfSysFn: Processing request with magic " << Var->name[LEN_SQ_PRF + 1] << "!");
*ErrP = SNMP_ERR_NOERROR;
switch (Var->name[LEN_SQ_PRF + 1]) {
static StatCounters *l = NULL;
double x;
int minutes;
- debug(49, 5) ("snmp_prfProtoFn: Processing request with magic %d!\n", Var->name[LEN_SQ_PRF]);
+ debugs(49, 5, "snmp_prfProtoFn: Processing request with magic " << Var->name[LEN_SQ_PRF] << "!");
*ErrP = SNMP_ERR_NOERROR;
switch (Var->name[LEN_SQ_PRF + 1]) {
l = snmpStatGet(minutes);
- debug(49, 8) ("median: min= %d, %d l= %p , f = %p\n", minutes,
- Var->name[LEN_SQ_PRF + 3], l, f);
-
- debug(49, 8) ("median: l= %p , f = %p\n", l, f);
+ debugs(49, 8, "median: min= " << minutes << ", " << Var->name[LEN_SQ_PRF + 3] << " l= " << l << " , f = " << f);
+ debugs(49, 8, "median: l= " << l << " , f = " << f);
switch (Var->name[LEN_SQ_PRF + 3]) {
/*
- * $Id: snmp_core.cc,v 1.76 2007/04/20 07:29:47 wessels Exp $
+ * $Id: snmp_core.cc,v 1.77 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 49 SNMP support
* AUTHOR: Glenn Chisholm
void
snmpInit(void)
{
- debug(49, 5) ("snmpInit: Called.\n");
-
- debug(49, 5) ("snmpInit: Building SNMP mib tree structure\n");
+ debugs(49, 5, "snmpInit: Building SNMP mib tree structure");
snmplib_debug_hook = snmpSnmplibDebug;
)
);
- debug(49, 9) ("snmpInit: Completed SNMP mib tree structure\n");
+ debugs(49, 9, "snmpInit: Completed SNMP mib tree structure");
}
void
socklen_t len;
int x;
- debug(49, 5) ("snmpConnectionOpen: Called\n");
+ debugs(49, 5, "snmpConnectionOpen: Called");
if ((port = Config.Port.snmp) > (u_short) 0) {
enter_suid();
commSetSelect(theInSnmpConnection, COMM_SELECT_READ, snmpHandleUdp, NULL, 0);
- debug(1, 1) ("Accepting SNMP messages on port %d, FD %d.\n",
- (int) port, theInSnmpConnection);
+ debugs(1, 1, "Accepting SNMP messages on port " << (int) port << ", FD " << theInSnmpConnection << ".");
if (Config.Addrs.snmp_outgoing.s_addr != no_addr.s_addr) {
enter_suid();
snmpHandleUdp,
NULL, 0);
- debug(1, 1) ("Outgoing SNMP messages on port %d, FD %d.\n",
- (int) port, theOutSnmpConnection);
+ debugs(1, 1, "Outgoing SNMP messages on port " << (int) port << ", FD " << theOutSnmpConnection << ".");
fd_note(theOutSnmpConnection, "Outgoing SNMP socket");
(struct sockaddr *) &xaddr, &len);
if (x < 0)
- debug(51, 1) ("theOutSnmpConnection FD %d: getsockname: %s\n",
- theOutSnmpConnection, xstrerror());
+ debugs(51, 1, "theOutSnmpConnection FD " << theOutSnmpConnection << ": getsockname: " << xstrerror());
else
theOutSNMPAddr = xaddr.sin_addr;
}
return;
if (theInSnmpConnection != theOutSnmpConnection) {
- debug(49, 1) ("FD %d Closing SNMP socket\n", theInSnmpConnection);
+ debugs(49, 1, "FD " << theInSnmpConnection << " Closing SNMP socket");
comm_close(theInSnmpConnection);
}
snmpConnectionShutdown();
if (theOutSnmpConnection > -1) {
- debug(49, 1) ("FD %d Closing SNMP socket\n", theOutSnmpConnection);
+ debugs(49, 1, "FD " << theOutSnmpConnection << " Closing SNMP socket");
comm_close(theOutSnmpConnection);
}
}
snmp_request_t *snmp_rq;
int len;
- debug(49, 5) ("snmpHandleUdp: Called.\n");
+ debugs(49, 5, "snmpHandleUdp: Called.");
commSetSelect(sock, COMM_SELECT_READ, snmpHandleUdp, NULL, 0);
if (len > 0) {
buf[len] = '\0';
- debug(49, 3) ("snmpHandleUdp: FD %d: received %d bytes from %s.\n",
- sock,
- len,
- inet_ntoa(from.sin_addr));
+ debugs(49, 3, "snmpHandleUdp: FD " << sock << ": received " << len << " bytes from " << inet_ntoa(from.sin_addr) << ".");
snmp_rq = (snmp_request_t *)xcalloc(1, sizeof(snmp_request_t));
snmp_rq->buf = (u_char *) buf;
xfree(snmp_rq->outbuf);
xfree(snmp_rq);
} else {
- debug(49, 1) ("snmpHandleUdp: FD %d recvfrom: %s\n", sock, xstrerror());
+ debugs(49, 1, "snmpHandleUdp: FD " << sock << " recvfrom: " << xstrerror());
}
}
int len = rq->len;
int allow = 0;
- debug(49, 5) ("snmpDecodePacket: Called.\n");
+ debugs(49, 5, "snmpDecodePacket: Called.");
/* Now that we have the data, turn it into a PDU */
PDU = snmp_pdu_create(0);
rq->session.Version = SNMP_VERSION_1;
if ((snmp_coexist_V2toV1(PDU)) && (Community) && (allow)) {
rq->community = Community;
rq->PDU = PDU;
- debug(49, 5) ("snmpAgentParse: reqid=[%d]\n", PDU->reqid);
+ debugs(49, 5, "snmpAgentParse: reqid=[" << PDU->reqid << "]");
snmpConstructReponse(rq);
} else {
- debug(49, 1) ("Failed SNMP agent query from : %s.\n",
- inet_ntoa(rq->from.sin_addr));
+ debugs(49, 1, "Failed SNMP agent query from : " << inet_ntoa(rq->from.sin_addr) << ".");
snmp_free_pdu(PDU);
}
struct snmp_pdu *RespPDU;
- debug(49, 5) ("snmpConstructReponse: Called.\n");
+ debugs(49, 5, "snmpConstructReponse: Called.");
RespPDU = snmpAgentResponse(rq->PDU);
snmp_free_pdu(rq->PDU);
struct snmp_pdu *Answer = NULL;
- debug(49, 5) ("snmpAgentResponse: Called.\n");
+ debugs(49, 5, "snmpAgentResponse: Called.");
if ((Answer = snmp_pdu_create(SNMP_PDU_RESPONSE)))
{
if (ParseFn == NULL) {
Answer->errstat = SNMP_ERR_NOSUCHNAME;
- debug(49, 5) ("snmpAgentResponse: No such oid. ");
+ debugs(49, 5, "snmpAgentResponse: No such oid. ");
} else {
if (get_next) {
VarPtr = snmp_var_new(NextOidName, NextOidNameLen);
/* Was there an error? */
if ((Answer->errstat != SNMP_ERR_NOERROR) || (VarNew == NULL)) {
Answer->errindex = index;
- debug(49, 5) ("snmpAgentResponse: error.\n");
+ debugs(49, 5, "snmpAgentResponse: error.");
if (VarNew)
snmp_var_free(VarNew);
mib_tree_entry *mibTreeEntry = NULL;
int count = 0;
- debug(49, 5) ("snmpTreeGet: Called\n");
+ debugs(49, 5, "snmpTreeGet: Called");
- debug(49, 6) ("snmpTreeGet: Current : \n");
+ debugs(49, 6, "snmpTreeGet: Current : ");
snmpDebugOid(6, Current, CurrentLen);
mibTreeEntry = mib_tree_head;
if (mibTreeEntry && mibTreeEntry->parsefunction)
Fn = mibTreeEntry->parsefunction;
- debug(49, 5) ("snmpTreeGet: return\n");
+ debugs(49, 5, "snmpTreeGet: return");
return (Fn);
}
mib_tree_entry *mibTreeEntry = NULL, *nextoid = NULL;
int count = 0;
- debug(49, 5) ("snmpTreeNext: Called\n");
+ debugs(49, 5, "snmpTreeNext: Called");
- debug(49, 6) ("snmpTreeNext: Current : \n");
+ debugs(49, 6, "snmpTreeNext: Current : ");
snmpDebugOid(6, Current, CurrentLen);
mibTreeEntry = mib_tree_head;
count++;
}
- debug(49, 5) ("snmpTreeNext: Recursed down to requested object\n");
+ debugs(49, 5, "snmpTreeNext: Recursed down to requested object");
} else {
return NULL;
}
nextoid = snmpTreeSiblingEntry(Current[count], count, mibTreeEntry->parent);
if (nextoid) {
- debug(49, 5) ("snmpTreeNext: Next OID found for sibling\n");
+ debugs(49, 5, "snmpTreeNext: Next OID found for sibling");
mibTreeEntry = nextoid;
count++;
} else {
- debug(49, 5) ("snmpTreeNext: Attempting to recurse up for next object\n");
+ debugs(49, 5, "snmpTreeNext: Attempting to recurse up for next object");
while (!nextoid) {
count--;
children = va_arg(args, int);
#endif
- debug(49, 6) ("snmpAddNode: Children : %d, Oid : \n", children);
+ debugs(49, 6, "snmpAddNode: Children : " << children << ", Oid : ");
snmpDebugOid(6, name, len);
va_start(args, children);
strncat(objid, mbuf, sizeof(objid));
}
- debug(49, lvl) (" oid = %s\n", objid);
+ debugs(49, lvl, " oid = " << objid);
}
static void
/*
- * $Id: ssl_support.cc,v 1.34 2006/07/02 19:52:49 hno Exp $
+ * $Id: ssl_support.cc,v 1.35 2007/04/28 22:26:37 hno Exp $
*
* AUTHOR: Benno Rice
* DEBUG: section 83 SSL accelerator support
break;
default:
- debug(83,1)("ssl_temp_rsa_cb: Unexpected key length %d\n", keylen);
+ debugs(83, 1, "ssl_temp_rsa_cb: Unexpected key length " << keylen);
return NULL;
}
if (rsa == NULL) {
- debug(83,1)("ssl_temp_rsa_cb: Failed to generate key %d\n", keylen);
+ debugs(83, 1, "ssl_temp_rsa_cb: Failed to generate key " << keylen);
return NULL;
}
if (do_debug(83, 5))
PEM_write_RSAPrivateKey(debug_log, rsa, NULL, NULL, 0, NULL, NULL);
- debug(83,1)("Generated ephemeral RSA key of length %d\n", keylen);
+ debugs(83, 1, "Generated ephemeral RSA key of length " << keylen);
}
return rsa;
sizeof(buffer));
if (ok) {
- debug(83, 5) ("SSL Certificate signature OK: %s\n", buffer);
+ debugs(83, 5, "SSL Certificate signature OK: " << buffer);
if (server) {
int i;
int found = 0;
char cn[1024];
X509_NAME *name = X509_get_subject_name(peer_cert);
- debug(83, 3) ("Verifying server domain %s to certificate dn %s\n",
- server, buffer);
+ debugs(83, 3, "Verifying server domain " << server << " to certificate dn " << buffer);
for (i = X509_NAME_get_index_by_NID(name, NID_commonName, -1); i >= 0; i = X509_NAME_get_index_by_NID(name, NID_commonName, i)) {
ASN1_STRING *data = X509_NAME_ENTRY_get_data(X509_NAME_get_entry(name, i));
cn[data->length] = '\0';
- debug(83, 4) ("Verifying server domain %s to certificate cn %s\n",
- server, cn);
+ debugs(83, 4, "Verifying server domain " << server << " to certificate cn " << cn);
if (matchDomainName(server, cn[0] == '*' ? cn + 1 : cn) == 0) {
found = 1;
}
if (!found) {
- debug(83, 2) ("ERROR: Certificate %s does not match domainname %s\n", buffer, server);
+ debugs(83, 2, "ERROR: Certificate " << buffer << " does not match domainname " << server);
ok = 0;
}
}
switch (ctx->error) {
case X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT:
- debug(83, 5) ("SSL Certficate error: CA not known: %s\n", buffer);
+ debugs(83, 5, "SSL Certficate error: CA not known: " << buffer);
break;
case X509_V_ERR_CERT_NOT_YET_VALID:
- debug(83, 5) ("SSL Certficate not yet valid: %s\n", buffer);
+ debugs(83, 5, "SSL Certficate not yet valid: " << buffer);
break;
case X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD:
- debug(83, 5) ("SSL Certificate has illegal \'not before\' field: %s\n", buffer);
+ debugs(83, 5, "SSL Certificate has illegal \'not before\' field: " <<
+ buffer);
+
break;
case X509_V_ERR_CERT_HAS_EXPIRED:
- debug(83, 5) ("SSL Certificate expired: %s\n", buffer);
+ debugs(83, 5, "SSL Certificate expired: " << buffer);
break;
case X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD:
- debug(83, 5) ("SSL Certificate has invalid \'not after\' field: %s\n", buffer);
+ debugs(83, 5, "SSL Certificate has invalid \'not after\' field: " << buffer);
break;
default:
- debug(83, 1) ("SSL unknown certificate error %d in %s\n",
- ctx->error, buffer);
+ debugs(83, 1, "SSL unknown certificate error " << ctx->error << " in " << buffer);
break;
}
}
int count = 0;
if (!in) {
- debug(83, 2)("WARNING: Failed to open CRL file '%s'\n", CRLfile);
+ debugs(83, 2, "WARNING: Failed to open CRL file '" << CRLfile << "'");
return 0;
}
while ((crl = PEM_read_bio_X509_CRL(in,NULL,NULL,NULL))) {
if (!X509_STORE_add_crl(st, crl))
- debug(83, 2)("WARNING: Failed to add CRL from file '%s'\n", CRLfile);
+ debugs(83, 2, "WARNING: Failed to add CRL from file '" << CRLfile << "'");
else
count++;
switch (version) {
case 2:
- debug(83, 5) ("Using SSLv2.\n");
+ debugs(83, 5, "Using SSLv2.");
method = SSLv2_server_method();
break;
case 3:
- debug(83, 5) ("Using SSLv3.\n");
+ debugs(83, 5, "Using SSLv3.");
method = SSLv3_server_method();
break;
case 4:
- debug(83, 5) ("Using TLSv1.\n");
+ debugs(83, 5, "Using TLSv1.");
method = TLSv1_server_method();
break;
case 1:
default:
- debug(83, 5) ("Using SSLv2/SSLv3.\n");
+ debugs(83, 5, "Using SSLv2/SSLv3.");
method = SSLv23_server_method();
break;
}
}
if (Config.SSL.unclean_shutdown) {
- debug(83, 5) ("Enabling quiet SSL shutdowns (RFC violation).\n");
+ debugs(83, 5, "Enabling quiet SSL shutdowns (RFC violation).");
SSL_CTX_set_quiet_shutdown(sslContext, 1);
}
if (cipher) {
- debug(83, 5) ("Using chiper suite %s.\n", cipher);
+ debugs(83, 5, "Using chiper suite " << cipher << ".");
if (!SSL_CTX_set_cipher_list(sslContext, cipher)) {
ssl_error = ERR_get_error();
}
}
- debug(83, 1) ("Using certificate in %s\n", certfile);
+ debugs(83, 1, "Using certificate in " << certfile);
if (!SSL_CTX_use_certificate_chain_file(sslContext, certfile)) {
ssl_error = ERR_get_error();
- debug(83, 0) ("Failed to acquire SSL certificate '%s': %s\n",
- certfile, ERR_error_string(ssl_error, NULL));
+ debugs(83, 0, "Failed to acquire SSL certificate '" << certfile << "': " << ERR_error_string(ssl_error, NULL) );
goto error;
}
- debug(83, 1) ("Using private key in %s\n", keyfile);
+ debugs(83, 1, "Using private key in " << keyfile);
ssl_ask_password(sslContext, keyfile);
if (!SSL_CTX_use_PrivateKey_file(sslContext, keyfile, SSL_FILETYPE_PEM)) {
ssl_error = ERR_get_error();
- debug(83, 0) ("Failed to acquire SSL private key '%s': %s\n",
- keyfile, ERR_error_string(ssl_error, NULL));
+ debugs(83, 0, "Failed to acquire SSL private key '" << keyfile << "': " << ERR_error_string(ssl_error, NULL) );
goto error;
}
- debug(83, 5) ("Comparing private and public SSL keys.\n");
+ debugs(83, 5, "Comparing private and public SSL keys.");
if (!SSL_CTX_check_private_key(sslContext)) {
ssl_error = ERR_get_error();
- debug(83, 0) ("SSL private key '%s' does not match public key '%s': %s\n",
- certfile, keyfile, ERR_error_string(ssl_error, NULL));
+ debugs(83, 0, "SSL private key '" <<
+ certfile << "' does not match public key '" <<
+ keyfile << "': " << ERR_error_string(ssl_error, NULL) );
goto error;
}
- debug(83, 9) ("Setting RSA key generation callback.\n");
+ debugs(83, 9, "Setting RSA key generation callback.");
SSL_CTX_set_tmp_rsa_callback(sslContext, ssl_temp_rsa_cb);
- debug(83, 9) ("Setting CA certificate locations.\n");
+ debugs(83, 9, "Setting CA certificate locations.");
if ((CAfile || CApath) && !SSL_CTX_load_verify_locations(sslContext, CAfile, CApath)) {
ssl_error = ERR_get_error();
- debug(83, 1) ("Error setting CA certificate locations: %s\n",
- ERR_error_string(ssl_error, NULL));
- debug(83, 1) ("continuing anyway...\n");
+ debugs(83, 1, "Error setting CA certificate locations: " << ERR_error_string(ssl_error, NULL) );
+ debugs(83, 1, "continuing anyway..." );
}
if (!(fl & SSL_FLAG_NO_DEFAULT_CA) &&
!SSL_CTX_set_default_verify_paths(sslContext)) {
ssl_error = ERR_get_error();
- debug(83, 1) ("Error setting default CA certificate location: %s\n",
- ERR_error_string(ssl_error, NULL));
- debug(83, 1) ("continuing anyway...\n");
+ debugs(83, 1, "Error setting default CA certificate location: " << ERR_error_string(ssl_error, NULL) );
+ debugs(83, 1, "continuing anyway..." );
}
if (clientCA) {
STACK_OF(X509_NAME) *cert_names;
- debug(83, 9) ("Set client certifying authority list.\n");
+ debugs(83, 9, "Set client certifying authority list.");
cert_names = SSL_load_client_CA_file(clientCA);
if (cert_names == NULL) {
- debug(83, 1) ("Error loading the client CA certificates from '%s\': %s\n", clientCA, ERR_error_string(ERR_get_error(), NULL));
+ debugs(83, 1, "Error loading the client CA certificates from '" << clientCA << "\': " << ERR_error_string(ERR_get_error(),NULL) );
goto error;
}
SSL_CTX_set_client_CA_list(sslContext, cert_names);
if (fl & SSL_FLAG_DELAYED_AUTH) {
- debug(83, 9) ("Not requesting client certificates until acl processing requires one\n");
+ debugs(83, 9, "Not requesting client certificates until acl processing requires one");
SSL_CTX_set_verify(sslContext, SSL_VERIFY_NONE, NULL);
} else {
- debug(83, 9) ("Requiring client certificates.\n");
+ debugs(83, 9, "Requiring client certificates.");
SSL_CTX_set_verify(sslContext, SSL_VERIFY_PEER | SSL_VERIFY_FAIL_IF_NO_PEER_CERT, ssl_verify_cb);
}
#endif
} else {
- debug(83, 9) ("Not requiring any client certificates\n");
+ debugs(83, 9, "Not requiring any client certificates");
SSL_CTX_set_verify(sslContext, SSL_VERIFY_NONE, NULL);
}
}
if (!dh)
- debug(83, 1) ("WARNING: Failed to read DH parameters '%s'\n", dhfile);
+ debugs(83, 1, "WARNING: Failed to read DH parameters '" << dhfile << "'");
else if (dh && DH_check(dh, &codes) == 0) {
if (codes) {
- debug(83, 1) ("WARNING: Failed to verify DH parameters '%s' (%x)\n", dhfile, codes);
+ debugs(83, 1, "WARNING: Failed to verify DH parameters '" << dhfile << "' (" << std::hex << codes << ")");
DH_free(dh);
dh = NULL;
}
switch (version) {
case 2:
- debug(83, 5) ("Using SSLv2.\n");
+ debugs(83, 5, "Using SSLv2.");
method = SSLv2_client_method();
break;
case 3:
- debug(83, 5) ("Using SSLv3.\n");
+ debugs(83, 5, "Using SSLv3.");
method = SSLv3_client_method();
break;
case 4:
- debug(83, 5) ("Using TLSv1.\n");
+ debugs(83, 5, "Using TLSv1.");
method = TLSv1_client_method();
break;
case 1:
default:
- debug(83, 5) ("Using SSLv2/SSLv3.\n");
+ debugs(83, 5, "Using SSLv2/SSLv3.");
method = SSLv23_client_method();
break;
}
SSL_CTX_set_options(sslContext, ssl_parse_options(options));
if (cipher) {
- debug(83, 5) ("Using chiper suite %s.\n", cipher);
+ debugs(83, 5, "Using chiper suite " << cipher << ".");
if (!SSL_CTX_set_cipher_list(sslContext, cipher)) {
ssl_error = ERR_get_error();
}
if (certfile) {
- debug(83, 1) ("Using certificate in %s\n", certfile);
+ debugs(83, 1, "Using certificate in " << certfile);
if (!SSL_CTX_use_certificate_chain_file(sslContext, certfile)) {
ssl_error = ERR_get_error();
certfile, ERR_error_string(ssl_error, NULL));
}
- debug(83, 1) ("Using private key in %s\n", keyfile);
+ debugs(83, 1, "Using private key in " << keyfile);
ssl_ask_password(sslContext, keyfile);
if (!SSL_CTX_use_PrivateKey_file(sslContext, keyfile, SSL_FILETYPE_PEM)) {
keyfile, ERR_error_string(ssl_error, NULL));
}
- debug(83, 5) ("Comparing private and public SSL keys.\n");
+ debugs(83, 5, "Comparing private and public SSL keys.");
if (!SSL_CTX_check_private_key(sslContext)) {
ssl_error = ERR_get_error();
}
}
- debug(83, 9) ("Setting RSA key generation callback.\n");
+ debugs(83, 9, "Setting RSA key generation callback.");
SSL_CTX_set_tmp_rsa_callback(sslContext, ssl_temp_rsa_cb);
if (fl & SSL_FLAG_DONT_VERIFY_PEER) {
- debug(83, 1) ("NOTICE: Peer certificates are not verified for validity!\n");
+ debugs(83, 1, "NOTICE: Peer certificates are not verified for validity!");
SSL_CTX_set_verify(sslContext, SSL_VERIFY_NONE, NULL);
} else {
- debug(83, 9) ("Setting certificate verification callback.\n");
+ debugs(83, 9, "Setting certificate verification callback.");
SSL_CTX_set_verify(sslContext, SSL_VERIFY_PEER | SSL_VERIFY_FAIL_IF_NO_PEER_CERT, ssl_verify_cb);
}
- debug(83, 9) ("Setting CA certificate locations.\n");
+ debugs(83, 9, "Setting CA certificate locations.");
if ((CAfile || CApath) && !SSL_CTX_load_verify_locations(sslContext, CAfile, CApath)) {
ssl_error = ERR_get_error();
- debug(83, 1) ("Error setting CA certificate locations: %s\n",
- ERR_error_string(ssl_error, NULL));
- debug(83, 1) ("continuing anyway...\n");
+ debugs(83, 1, "Error setting CA certificate locations: " << ERR_error_string(ssl_error, NULL));
+ debugs(83, 1, "continuing anyway..." );
}
if (CRLfile) {
if (!(fl & SSL_FLAG_NO_DEFAULT_CA) &&
!SSL_CTX_set_default_verify_paths(sslContext)) {
ssl_error = ERR_get_error();
- debug(83, 1) ("Error setting default CA certificate location: %s\n",
- ERR_error_string(ssl_error, NULL));
- debug(83, 1) ("continuing anyway...\n");
+ debugs(83, 1, "Error setting default CA certificate location: " << ERR_error_string(ssl_error, NULL) );
+ debugs(83, 1, "continuing anyway...");
}
return sslContext;
i = SSL_read(ssl, buf, len);
if (i > 0 && SSL_pending(ssl) > 0) {
- debug(83, 2) ("SSL FD %d is pending\n", fd);
+ debugs(83, 2, "SSL FD " << fd << " is pending");
fd_table[fd].flags.read_pending = 1;
} else
fd_table[fd].flags.read_pending = 0;
nid = OBJ_txt2nid((char *) attribute_name);
if (nid == 0) {
- debug(83, 1) ("WARNING: Unknown SSL attribute name '%s'\n", attribute_name);
+ debugs(83, 1, "WARNING: Unknown SSL attribute name '" << attribute_name << "'");
return NULL;
}
/*
- * $Id: stat.cc,v 1.404 2007/04/21 07:14:15 wessels Exp $
+ * $Id: stat.cc,v 1.405 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 18 Cache Manager Statistics
* AUTHOR: Harvest Derived
l = &CountHourHist[hours];
} else {
- debug(18, 1) ("statAvgDump: Invalid args, minutes=%d, hours=%d\n",
- minutes, hours);
+ debugs(18, 1, "statAvgDump: Invalid args, minutes=" << minutes << ", hours=" << hours);
return;
}
statInit(void)
{
int i;
- debug(18, 5) ("statInit: Initializing...\n");
+ debugs(18, 5, "statInit: Initializing...");
for (i = 0; i < N_COUNT_HIST; i++)
statCountersInit(&CountHist[i]);
int i = (int) statPctileSvc(0.5, 20, PCTILE_HTTP);
if (Config.warnings.high_rptm < i)
- debug(18, 0) ("WARNING: Median response time is %d milliseconds\n", i);
+ debugs(18, 0, "WARNING: Median response time is " << i << " milliseconds");
}
if (Config.warnings.high_pf) {
i /= (int) dt;
if (Config.warnings.high_pf < i)
- debug(18, 0) ("WARNING: Page faults occuring at %d/sec\n", i);
+ debugs(18, 0, "WARNING: Page faults occuring at " << i << "/sec");
}
}
#endif
if (Config.warnings.high_memory < i)
- debug(18, 0) ("WARNING: Memory usage at %lu MB\n", (unsigned long int)(i >> 20));
+ debugs(18, 0, "WARNING: Memory usage at " << ((unsigned long int)(i >> 20)) << " MB");
}
}
break;
default:
- debug(49, 5) ("statPctileSvc: unknown type.\n");
+ debugs(49, 5, "statPctileSvc: unknown type.");
x = 0;
}
/*
- * $Id: stmem.cc,v 1.89 2005/09/14 18:23:21 wessels Exp $
+ * $Id: stmem.cc,v 1.90 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 19 Store Memory Primitives
* AUTHOR: Harvest Derived
mem_hdr::unlink(mem_node *aNode)
{
if (aNode->write_pending) {
- debug(0,0)("cannot unlink mem_node %p while write_pending\n", aNode);
+ debugs(0, 0, "cannot unlink mem_node " << aNode << " while write_pending");
return false;
}
/*
- * $Id: store.cc,v 1.609 2007/04/21 07:14:15 wessels Exp $
+ * $Id: store.cc,v 1.610 2007/04/28 22:26:37 hno Exp $
*
* DEBUG: section 20 Storage Manager
* AUTHOR: Harvest Derived
if (EBIT_TEST(flags, ENTRY_ABORTED)) {
/* I don't think we should be adding clients to aborted entries */
- debug(20, 1) ("storeClientType: adding to ENTRY_ABORTED entry\n");
+ debugs(20, 1, "storeClientType: adding to ENTRY_ABORTED entry");
return STORE_MEM_CLIENT;
}
void
StoreEntry::hashInsert(const cache_key * someKey)
{
- debug(20, 3) ("StoreEntry::hashInsert: Inserting Entry %p key '%s'\n",
- this, storeKeyText(someKey));
+ debugs(20, 3, "StoreEntry::hashInsert: Inserting Entry " << this << " key '" << storeKeyText(someKey) << "'");
key = storeKeyDup(someKey);
hash_join(store_table, this);
}
if (mem_obj == NULL)
return;
- debug(20, 3) ("StoreEntry::purgeMem: Freeing memory-copy of %s\n",
- getMD5Text());
+ debugs(20, 3, "StoreEntry::purgeMem: Freeing memory-copy of " << getMD5Text());
destroyMemObject();
{
lock_count++;
debugs(20, 3, "StoreEntry::lock: key '" << getMD5Text() <<"' count=" <<
- lock_count << "\n");
+ lock_count );
lastref = squid_curtime;
Store::Root().reference(*this);
}
if (EBIT_TEST(flags, RELEASE_REQUEST))
return;
- debug(20, 3) ("StoreEntry::setReleaseFlag: '%s'\n", getMD5Text());
+ debugs(20, 3, "StoreEntry::setReleaseFlag: '" << getMD5Text() << "'");
EBIT_SET(flags, RELEASE_REQUEST);
}
StoreEntry::unlock()
{
lock_count--;
- debug(20, 3) ("StoreEntry::unlock: key '%s' count=%d\n",
- getMD5Text(), lock_count);
+ debugs(20, 3, "StoreEntry::unlock: key '" << getMD5Text() << "' count=" << lock_count);
if (lock_count)
return (int) lock_count;
Store::Root().dereference(*this);
if (EBIT_TEST(flags, KEY_PRIVATE))
- debug(20, 1) ("WARNING: %s:%d: found KEY_PRIVATE\n", __FILE__, __LINE__);
+ debugs(20, 1, "WARNING: " << __FILE__ << ":" << __LINE__ << ": found KEY_PRIVATE");
/* StoreEntry::purgeMem may free e */
purgeMem();
#if MORE_DEBUG_OUTPUT
if (EBIT_TEST(flags, RELEASE_REQUEST))
- debug(20, 1) ("assertion failed: RELEASE key %s, url %s\n",
- key, mem->url);
+ debugs(20, 1, "assertion failed: RELEASE key " << key << ", url " << mem->url);
#endif
newkey = storeKeyPublic(mem_obj->url, mem_obj->method);
if ((e2 = (StoreEntry *) hash_lookup(store_table, newkey))) {
- debug(20, 3) ("StoreEntry::setPublicKey: Making old '%s' private.\n", mem_obj->url);
+ debugs(20, 3, "StoreEntry::setPublicKey: Making old '" << mem_obj->url << "' private.");
e2->setPrivateKey();
e2->release();
{
StoreEntry *e = NULL;
MemObject *mem = NULL;
- debug(20, 3) ("storeCreateEntry: '%s'\n", url);
+ debugs(20, 3, "storeCreateEntry: '" << url << "'");
e = new StoreEntry(url, log_url);
e->lock_count = 1; /* Note lock here w/o calling storeLock() */
void
StoreEntry::expireNow()
{
- debug(20, 3) ("StoreEntry::expireNow: '%s'\n", getMD5Text());
+ debugs(20, 3, "StoreEntry::expireNow: '" << getMD5Text() << "'");
expires = squid_curtime;
}
#if CACHE_ALL_METHODS
if (mem_obj->method != METHOD_GET) {
- debug(20, 2) ("StoreEntry::checkCachable: NO: non-GET method\n");
+ debugs(20, 2, "StoreEntry::checkCachable: NO: non-GET method");
store_check_cachable_hist.no.non_get++;
} else
#endif
if (store_status == STORE_OK && EBIT_TEST(flags, ENTRY_BAD_LENGTH)) {
- debug(20, 2) ("StoreEntry::checkCachable: NO: wrong content-length\n");
+ debugs(20, 2, "StoreEntry::checkCachable: NO: wrong content-length");
store_check_cachable_hist.no.wrong_content_length++;
} else if (!EBIT_TEST(flags, ENTRY_CACHABLE)) {
- debug(20, 2) ("StoreEntry::checkCachable: NO: not cachable\n");
+ debugs(20, 2, "StoreEntry::checkCachable: NO: not cachable");
store_check_cachable_hist.no.not_entry_cachable++;
} else if (EBIT_TEST(flags, ENTRY_NEGCACHED)) {
- debug(20, 3) ("StoreEntry::checkCachable: NO: negative cached\n");
+ debugs(20, 3, "StoreEntry::checkCachable: NO: negative cached");
store_check_cachable_hist.no.negative_cached++;
return 0; /* avoid release call below */
} else if ((getReply()->content_length > 0 &&
static_cast<size_t>(getReply()->content_length)
> Config.Store.maxObjectSize) ||
static_cast<size_t>(mem_obj->endOffset()) > Config.Store.maxObjectSize) {
- debug(20, 2) ("StoreEntry::checkCachable: NO: too big\n");
+ debugs(20, 2, "StoreEntry::checkCachable: NO: too big");
store_check_cachable_hist.no.too_big++;
} else if (getReply()->content_length > (int) Config.Store.maxObjectSize) {
- debug(20, 2)
- ("StoreEntry::checkCachable: NO: too big\n");
+ debugs(20, 2, "StoreEntry::checkCachable: NO: too big");
store_check_cachable_hist.no.too_big++;
} else if (checkTooSmall()) {
- debug(20, 2)
- ("StoreEntry::checkCachable: NO: too small\n");
+ debugs(20, 2, "StoreEntry::checkCachable: NO: too small");
store_check_cachable_hist.no.too_small++;
} else if (EBIT_TEST(flags, KEY_PRIVATE)) {
- debug(20, 3)
- ("StoreEntry::checkCachable: NO: private key\n");
+ debugs(20, 3, "StoreEntry::checkCachable: NO: private key");
store_check_cachable_hist.no.private_key++;
} else if (swap_status != SWAPOUT_NONE) {
/*
*/
return 1;
} else if (storeTooManyDiskFilesOpen()) {
- debug(20, 2)
- ("StoreEntry::checkCachable: NO: too many disk files open\n");
+ debugs(20, 2, "StoreEntry::checkCachable: NO: too many disk files open");
store_check_cachable_hist.no.too_many_open_files++;
} else if (fdNFree() < RESERVED_FD) {
- debug(20, 2)
- ("StoreEntry::checkCachable: NO: too many FD's open\n");
+ debugs(20, 2, "StoreEntry::checkCachable: NO: too many FD's open");
store_check_cachable_hist.no.too_many_open_fds++;
} else {
store_check_cachable_hist.yes.Default++;
void
StoreEntry::complete()
{
- debug(20, 3) ("storeComplete: '%s'\n", getMD5Text());
+ debugs(20, 3, "storeComplete: '" << getMD5Text() << "'");
if (store_status != STORE_PENDING) {
/*
statCounter.aborted_requests++;
assert(store_status == STORE_PENDING);
assert(mem_obj != NULL);
- debug(20, 6) ("storeAbort: %s\n", getMD5Text());
+ debugs(20, 6, "storeAbort: " << getMD5Text());
lock()
}
walker->Done(walker);
- debug(20, 3) ("storeGetMemSpace stats:\n");
- debug(20, 3) (" %6d HOT objects\n", hot_obj_count);
- debug(20, 3) (" %6d were released\n", released);
+ debugs(20, 3, "storeGetMemSpace stats:");
+ debugs(20, 3, " " << std::setw(6) << hot_obj_count << " HOT objects");
+ debugs(20, 3, " " << std::setw(6) << released << " were released");
PROF_stop(storeGetMemSpace);
}
StoreEntry::release()
{
PROF_start(storeRelease);
- debug(20, 3) ("storeRelease: Releasing: '%s'\n", getMD5Text());
+ debugs(20, 3, "storeRelease: Releasing: '" << getMD5Text() << "'");
/* If, for any reason we can't discard this object because of an
* outstanding request, mark it for pending release */
if (locked()) {
expireNow();
- debug(20, 3) ("storeRelease: Only setting RELEASE_REQUEST bit\n");
+ debugs(20, 3, "storeRelease: Only setting RELEASE_REQUEST bit");
releaseRequest();
PROF_stop(storeRelease);
return;
if (e == NULL) {
/* done! */
- debug(20, 1) ("storeLateRelease: released %d objects\n", n);
+ debugs(20, 1, "storeLateRelease: released " << n << " objects");
return;
}
const HttpReply *reply;
assert(mem_obj != NULL);
reply = getReply();
- debug(20, 3) ("storeEntryValidLength: Checking '%s'\n", getMD5Text());
+ debugs(20, 3, "storeEntryValidLength: Checking '" << getMD5Text() << "'");
debugs(20, 5, "storeEntryValidLength: object_len = " <<
objectLen());
- debug(20, 5) ("storeEntryValidLength: hdr_sz = %d\n",
- reply->hdr_sz);
- debug(20, 5) ("storeEntryValidLength: content_length = %d\n",
- reply->content_length);
+ debugs(20, 5, "storeEntryValidLength: hdr_sz = " << reply->hdr_sz);
+ debugs(20, 5, "storeEntryValidLength: content_length = " << reply->content_length);
if (reply->content_length < 0) {
- debug(20, 5) ("storeEntryValidLength: Unspecified content length: %s\n",
- getMD5Text());
+ debugs(20, 5, "storeEntryValidLength: Unspecified content length: " << getMD5Text());
return 1;
}
if (reply->hdr_sz == 0) {
- debug(20, 5) ("storeEntryValidLength: Zero header size: %s\n",
- getMD5Text());
+ debugs(20, 5, "storeEntryValidLength: Zero header size: " << getMD5Text());
return 1;
}
if (mem_obj->method == METHOD_HEAD) {
- debug(20, 5) ("storeEntryValidLength: HEAD request: %s\n",
- getMD5Text());
+ debugs(20, 5, "storeEntryValidLength: HEAD request: " << getMD5Text());
return 1;
}
if (diff == 0)
return 1;
- debug(20, 3) ("storeEntryValidLength: %d bytes too %s; '%s'\n",
- diff < 0 ? -diff : diff,
- diff < 0 ? "big" : "small",
- getMD5Text());
+ debugs(20, 3, "storeEntryValidLength: " << (diff < 0 ? -diff : diff) << " bytes too " << (diff < 0 ? "big" : "small") <<"; '" << getMD5Text() << "'" );
return 0;
}
void
StoreEntry::dump(int l) const
{
- debug(20, l) ("StoreEntry->key: %s\n", getMD5Text());
- debug(20, l) ("StoreEntry->next: %p\n", next);
- debug(20, l) ("StoreEntry->mem_obj: %p\n", mem_obj);
- debug(20, l) ("StoreEntry->timestamp: %d\n", (int) timestamp);
- debug(20, l) ("StoreEntry->lastref: %d\n", (int) lastref);
- debug(20, l) ("StoreEntry->expires: %d\n", (int) expires);
- debug(20, l) ("StoreEntry->lastmod: %d\n", (int) lastmod);
- debug(20, l) ("StoreEntry->swap_file_sz: %d\n", (int) swap_file_sz);
- debug(20, l) ("StoreEntry->refcount: %d\n", refcount);
- debug(20, l) ("StoreEntry->flags: %s\n", storeEntryFlags(this));
- debug(20, l) ("StoreEntry->swap_dirn: %d\n", (int) swap_dirn);
- debug(20, l) ("StoreEntry->swap_filen: %d\n", (int) swap_filen);
- debug(20, l) ("StoreEntry->lock_count: %d\n", (int) lock_count);
- debug(20, l) ("StoreEntry->mem_status: %d\n", (int) mem_status);
- debug(20, l) ("StoreEntry->ping_status: %d\n", (int) ping_status);
- debug(20, l) ("StoreEntry->store_status: %d\n", (int) store_status);
- debug(20, l) ("StoreEntry->swap_status: %d\n", (int) swap_status);
+ debugs(20, l, "StoreEntry->key: " << getMD5Text());
+ debugs(20, l, "StoreEntry->next: " << next);
+ debugs(20, l, "StoreEntry->mem_obj: " << mem_obj);
+ debugs(20, l, "StoreEntry->timestamp: " << (int) timestamp);
+ debugs(20, l, "StoreEntry->lastref: " << (int) lastref);
+ debugs(20, l, "StoreEntry->expires: " << (int) expires);
+ debugs(20, l, "StoreEntry->lastmod: " << (int) lastmod);
+ debugs(20, l, "StoreEntry->swap_file_sz: " << (int) swap_file_sz);
+ debugs(20, l, "StoreEntry->refcount: " << refcount);
+ debugs(20, l, "StoreEntry->flags: " << storeEntryFlags(this));
+ debugs(20, l, "StoreEntry->swap_dirn: " << (int) swap_dirn);
+ debugs(20, l, "StoreEntry->swap_filen: " << (int) swap_filen);
+ debugs(20, l, "StoreEntry->lock_count: " << (int) lock_count);
+ debugs(20, l, "StoreEntry->mem_status: " << (int) mem_status);
+ debugs(20, l, "StoreEntry->ping_status: " << (int) ping_status);
+ debugs(20, l, "StoreEntry->store_status: " << (int) store_status);
+ debugs(20, l, "StoreEntry->swap_status: " << (int) swap_status);
}
/*
assert(mem_obj->inmem_lo == 0);
if (EBIT_TEST(flags, ENTRY_SPECIAL)) {
- debug(20, 4) ("StoreEntry::setMemStatus: not inserting special %s into policy\n",
- mem_obj->url);
+ debugs(20, 4, "StoreEntry::setMemStatus: not inserting special " << mem_obj->url << " into policy");
} else {
mem_policy->Add(mem_policy, this, &mem_obj->repl);
- debug(20, 4) ("StoreEntry::setMemStatus: inserted mem node %s\n",
- mem_obj->url);
+ debugs(20, 4, "StoreEntry::setMemStatus: inserted mem node " << mem_obj->url);
}
hot_obj_count++;
} else {
if (EBIT_TEST(flags, ENTRY_SPECIAL)) {
- debug(20, 4) ("StoreEntry::setMemStatus: special entry %s\n",
- mem_obj->url);
+ debugs(20, 4, "StoreEntry::setMemStatus: special entry " << mem_obj->url);
} else {
mem_policy->Remove(mem_policy, this, &mem_obj->repl);
- debug(20, 4) ("StoreEntry::setMemStatus: removed mem node %s\n",
- mem_obj->url);
+ debugs(20, 4, "StoreEntry::setMemStatus: removed mem node " << mem_obj->url);
}
hot_obj_count--;
StoreEntry::reset()
{
assert (mem_obj);
- debug(20, 3) ("StoreEntry::reset: %s\n", url());
+ debugs(20, 3, "StoreEntry::reset: " << url());
mem_obj->reset();
HttpReply *rep = (HttpReply *) getReply(); // bypass const
rep->reset();
return r->create(settings->args);
}
- debug(20, 1) ("ERROR: Unknown policy %s\n", settings->type);
- debug(20, 1) ("ERROR: Be sure to have set cache_replacement_policy\n");
- debug(20, 1) ("ERROR: and memory_replacement_policy in squid.conf!\n");
+ debugs(20, 1, "ERROR: Unknown policy " << settings->type);
+ debugs(20, 1, "ERROR: Be sure to have set cache_replacement_policy");
+ debugs(20, 1, "ERROR: and memory_replacement_policy in squid.conf!");
fatalf("ERROR: Unknown policy %s\n", settings->type);
return NULL; /* NOTREACHED */
}
void
StoreEntry::replaceHttpReply(HttpReply *rep)
{
- debug(20, 3) ("StoreEntry::replaceHttpReply: %s\n", url());
+ debugs(20, 3, "StoreEntry::replaceHttpReply: " << url());
Packer p;
if (!mem_obj) {
- debug (20,0)("Attempt to replace object with no in-memory representation\n");
+ debugs(20, 0, "Attempt to replace object with no in-memory representation");
return;
}
StoreEntry::swapoutPossible()
{
/* should we swap something out to disk? */
- debug(20, 7) ("storeSwapOut: %s\n", url());
- debug(20, 7) ("storeSwapOut: store_status = %s\n",
- storeStatusStr[store_status]);
+ debugs(20, 7, "storeSwapOut: " << url());
+ debugs(20, 7, "storeSwapOut: store_status = " << storeStatusStr[store_status]);
if (EBIT_TEST(flags, ENTRY_ABORTED)) {
assert(EBIT_TEST(flags, RELEASE_REQUEST));
}
if (EBIT_TEST(flags, ENTRY_SPECIAL)) {
- debug(20, 3) ("storeSwapOut: %s SPECIAL\n", url());
+ debugs(20, 3, "storeSwapOut: " << url() << " SPECIAL");
return false;
}
if (mod_time < 0)
mod_time = timestamp;
- debug(88, 3) ("modifiedSince: '%s'\n", url());
+ debugs(88, 3, "modifiedSince: '" << url() << "'");
- debug(88, 3) ("modifiedSince: mod_time = %ld\n", (long int) mod_time);
+ debugs(88, 3, "modifiedSince: mod_time = " << (long int) mod_time);
if (mod_time < 0)
return true;
object_length = contentLen();
if (mod_time > request->ims) {
- debug(88, 3) ("--> YES: entry newer than client\n");
+ debugs(88, 3, "--> YES: entry newer than client");
return true;
} else if (mod_time < request->ims) {
- debug(88, 3) ("--> NO: entry older than client\n");
+ debugs(88, 3, "--> NO: entry older than client");
return false;
} else if (request->imslen < 0) {
- debug(88, 3) ("--> NO: same LMT, no client length\n");
+ debugs(88, 3, "--> NO: same LMT, no client length");
return false;
} else if (request->imslen == object_length) {
- debug(88, 3) ("--> NO: same LMT, same length\n");
+ debugs(88, 3, "--> NO: same LMT, same length");
return false;
} else {
- debug(88, 3) ("--> YES: same LMT, different length\n");
+ debugs(88, 3, "--> YES: same LMT, different length");
return true;
}
}
/*
- * $Id: store_client.cc,v 1.155 2007/04/21 07:10:06 wessels Exp $
+ * $Id: store_client.cc,v 1.156 2007/04/28 22:26:38 hno Exp $
*
* DEBUG: section 90 Storage Manager Client-Side Interface
* AUTHOR: Duane Wessels
storeClientCopyEvent(void *data)
{
store_client *sc = (store_client *)data;
- debug(90, 3)("storeClientCopyEvent: Running\n");
+ debugs(90, 3, "storeClientCopyEvent: Running");
assert (sc->flags.copy_event_pending);
sc->flags.copy_event_pending = 0;
assert (callback_fn);
assert (data);
assert(!EBIT_TEST(entry->flags, ENTRY_ABORTED));
- debug(90, 3)("store_client::copy: %s, from %lu, for length %d, cb %p, cbdata %p\n",
- entry->getMD5Text(),
- (unsigned long) copyRequest.offset,
- (int) copyRequest.length,
- callback_fn,
- data);
+ debugs(90, 3, "store_client::copy: " << entry->getMD5Text() << ", from " <<
+ (unsigned long) copyRequest.offset << ", for length " <<
+ (int) copyRequest.length << ", cb " << callback_fn << ", cbdata " <<
+ data);
+
#if STORE_CLIENT_LIST_DEBUG
assert(this == storeClientListSearch(entry->mem_obj, data));
}
if (EBIT_TEST(e->flags, ENTRY_FWD_HDR_WAIT)) {
- debug(90, 5)("storeClientCopy2: returning because ENTRY_FWD_HDR_WAIT set\n");
+ debugs(90, 5, "storeClientCopy2: returning because ENTRY_FWD_HDR_WAIT set");
return;
}
if (sc->flags.store_copying) {
sc->flags.copy_event_pending = 1;
- debug(90, 3)("storeClientCopy2: Queueing storeClientCopyEvent()\n");
+ debugs(90, 3, "storeClientCopy2: Queueing storeClientCopyEvent()");
eventAdd("storeClientCopyEvent", storeClientCopyEvent, sc, 0.0, 0);
return;
}
- debug(90, 3)("storeClientCopy2: %s\n", e->getMD5Text());
+ debugs(90, 3, "storeClientCopy2: " << e->getMD5Text());
assert(sc->_callback.pending());
/*
* We used to check for ENTRY_ABORTED here. But there were some
flags.store_copying = 1;
MemObject *mem = entry->mem_obj;
- debug(33, 5)("store_client::doCopy: co: %lu, hi: %ld\n", (unsigned long) copyInto.offset, (long int) mem->endOffset());
+ debugs(33, 5, "store_client::doCopy: co: " <<
+ (unsigned long) copyInto.offset << ", hi: " <<
+ (long int) mem->endOffset());
if (storeClientNoMoreToSend(entry, this)) {
/* There is no more to send! */
/* Check that we actually have data */
if (anEntry->store_status == STORE_PENDING && copyInto.offset >= mem->endOffset()) {
- debug(90, 3)("store_client::doCopy: Waiting for more\n");
+ debugs(90, 3, "store_client::doCopy: Waiting for more");
flags.store_copying = 0;
return;
}
void
store_client::startSwapin()
{
- debug(90, 3)("store_client::doCopy: Need to open swap in file\n");
+ debugs(90, 3, "store_client::doCopy: Need to open swap in file");
/* gotta open the swapin file */
if (storeTooManyDiskFilesOpen()) {
return;
} else {
- debug (90, 1)("WARNING: Averted multiple fd operation (1)\n");
+ debugs(90, 1, "WARNING: Averted multiple fd operation (1)");
flags.store_copying = 0;
return;
}
assert(!flags.disk_io_pending);
- debug(90, 3)("store_client::doCopy: reading from STORE\n");
+ debugs(90, 3, "store_client::doCopy: reading from STORE");
fileRead();
{
/* What the client wants is in memory */
/* Old style */
- debug(90, 3)("store_client::doCopy: Copying normal from memory\n");
+ debugs(90, 3, "store_client::doCopy: Copying normal from memory");
size_t sz = entry->mem_obj->data_hdr.copy(copyInto);
callback(sz);
flags.store_copying = 0;
assert(sc->flags.disk_io_pending);
sc->flags.disk_io_pending = 0;
assert(sc->_callback.pending());
- debug(90, 3)("storeClientReadBody: len %d", (int) len);
+ debugs(90, 3, "storeClientReadBody: len " << (int) len << "");
if (sc->copyInto.offset == 0 && len > 0 && sc->entry->getReply()->sline.status == 0) {
/* Our structure ! */
HttpReply *rep = (HttpReply *) sc->entry->getReply(); // bypass const
if (!rep->parseCharBuf(sc->copyInto.data, headersEnd(sc->copyInto.data, len))) {
- debug (90,0)("Could not parse headers from on disk object\n");
+ debugs(90, 0, "Could not parse headers from on disk object");
}
}
void
store_client::unpackHeader(char const *buf, ssize_t len)
{
- debug(90, 3)("store_client::unpackHeader: len %d", (int) len);
+ debugs(90, 3, "store_client::unpackHeader: len " << (int) len << "");
if (len < 0) {
- debug(90, 3)("store_client::unpackHeader: %s", xstrerror());
+ debugs(90, 3, "store_client::unpackHeader: " << xstrerror() << "");
fail();
return;
}
if (!aBuilder.isBufferSane()) {
/* oops, bad disk file? */
- debug(90, 1) ("WARNING: swapfile header inconsistent with available data\n");
+ debugs(90, 1, "WARNING: swapfile header inconsistent with available data");
fail();
return;
}
tlv *tlv_list = aBuilder.createStoreMeta ();
if (tlv_list == NULL) {
- debug(90, 1) ("WARNING: failed to unpack meta data\n");
+ debugs(90, 1, "WARNING: failed to unpack meta data");
fail();
return;
}
*/
size_t copy_sz = XMIN(copyInto.length, body_sz)
;
- debug(90, 3) ("storeClientReadHeader: copying %d bytes of body\n",
- (int) copy_sz);
+ debugs(90, 3, "storeClientReadHeader: copying " << (int) copy_sz << " bytes of body");
xmemmove(copyInto.data, copyInto.data + mem->swap_hdr_sz, copy_sz);
if (copyInto.offset == 0 && len > 0 && entry->getReply()->sline.status == 0) {
HttpReply *rep = (HttpReply *) entry->getReply(); // bypass const
if (!rep->parseCharBuf(copyInto.data, headersEnd(copyInto.data, copy_sz))) {
- debug (90,0)("could not parse headers from on disk structure!\n");
+ debugs(90, 0, "could not parse headers from on disk structure!");
}
}
if (mem == NULL)
return 0;
- debug(90, 3) ("storeUnregister: called for '%s'\n", e->getMD5Text());
+ debugs(90, 3, "storeUnregister: called for '" << e->getMD5Text() << "'");
if (sc == NULL) {
- debug(90, 3) ("storeUnregister: No matching client for '%s'\n", e->getMD5Text());
+ debugs(90, 3, "storeUnregister: No matching client for '" << e->getMD5Text() << "'");
return 0;
}
if (mem->clientCount() == 0) {
- debug(90, 3) ("storeUnregister: Consistency failure - store client being unregistered is not in the mem object's list for '%s'\n", e->getMD5Text());
+ debugs(90, 3, "storeUnregister: Consistency failure - store client being unregistered is not in the mem object's list for '" << e->getMD5Text() << "'");
return 0;
}
if (sc->_callback.pending()) {
/* callback with ssize = -1 to indicate unexpected termination */
- debug(90, 3) ("storeUnregister: store_client for %s has a callback\n",
- mem->url);
+ debugs(90, 3, "storeUnregister: store_client for " << mem->url << " has a callback");
sc->fail();
}
PROF_start(InvokeHandlers);
- debug(90, 3) ("StoreEntry::invokeHandlers: %s\n", getMD5Text());
+ debugs(90, 3, "InvokeHandlers: " << getMD5Text() );
/* walk the entire list looking for valid callbacks */
for (node = mem_obj->clients.head; node; node = nx) {
sc = (store_client *)node->data;
nx = node->next;
- debug(90, 3) ("StoreEntry::invokeHandlers: checking client #%d\n", i++);
+ debugs(90, 3, "StoreEntry::InvokeHandlers: checking client #" << i++ );
if (!sc->_callback.pending())
continue;
{
MemObject *mem = e->mem_obj;
int npend = NULL == mem ? 0 : mem->nclients;
- debug(90, 3) ("storePendingNClients: returning %d\n", npend);
+ debugs(90, 3, "storePendingNClients: returning " << npend);
return npend;
}
{
MemObject * const mem = entry->mem_obj;
assert(mem);
- debug(90, 3) ("CheckQuickAbort2: entry=%p, mem=%p\n", entry, mem);
+ debugs(90, 3, "CheckQuickAbort2: entry=" << entry << ", mem=" << mem);
if (mem->request && !mem->request->flags.cachable) {
- debug(90, 3) ("CheckQuickAbort2: YES !mem->request->flags.cachable\n");
+ debugs(90, 3, "CheckQuickAbort2: YES !mem->request->flags.cachable");
return 1;
}
if (EBIT_TEST(entry->flags, KEY_PRIVATE)) {
- debug(90, 3) ("CheckQuickAbort2: YES KEY_PRIVATE\n");
+ debugs(90, 3, "CheckQuickAbort2: YES KEY_PRIVATE");
return 1;
}
size_t minlen = (size_t) Config.quickAbort.min << 10;
if (minlen < 0) {
- debug(90, 3) ("CheckQuickAbort2: NO disabled\n");
+ debugs(90, 3, "CheckQuickAbort2: NO disabled");
return 0;
}
if (curlen > expectlen) {
- debug(90, 3) ("CheckQuickAbort2: YES bad content length\n");
+ debugs(90, 3, "CheckQuickAbort2: YES bad content length");
return 1;
}
if ((expectlen - curlen) < minlen) {
- debug(90, 3) ("CheckQuickAbort2: NO only little more left\n");
+ debugs(90, 3, "CheckQuickAbort2: NO only little more left");
return 0;
}
if ((expectlen - curlen) > (Config.quickAbort.max << 10)) {
- debug(90, 3) ("CheckQuickAbort2: YES too much left to go\n");
+ debugs(90, 3, "CheckQuickAbort2: YES too much left to go");
return 1;
}
if (expectlen < 100) {
- debug(90, 3) ("CheckQuickAbort2: NO avoid FPE\n");
+ debugs(90, 3, "CheckQuickAbort2: NO avoid FPE");
return 0;
}
if ((curlen / (expectlen / 100)) > (size_t)Config.quickAbort.pct) {
- debug(90, 3) ("CheckQuickAbort2: NO past point of no return\n");
+ debugs(90, 3, "CheckQuickAbort2: NO past point of no return");
return 0;
}
- debug(90, 3) ("CheckQuickAbort2: YES default, returning 1\n");
+ debugs(90, 3, "CheckQuickAbort2: YES default, returning 1");
return 1;
}
/*
- * $Id: store_digest.cc,v 1.73 2007/04/21 07:14:15 wessels Exp $
+ * $Id: store_digest.cc,v 1.74 2007/04/28 22:26:38 hno Exp $
*
* DEBUG: section 71 Store Digest Manager
* AUTHOR: Alex Rousskov
if (!Config.onoff.digest_generation) {
store_digest = NULL;
- debug(71, 3) ("Local cache digest generation disabled\n");
+ debugs(71, 3, "Local cache digest generation disabled");
return;
}
store_digest = cacheDigestCreate(cap, Config.digest.bits_per_entry);
- debug(71, 1) ("Local cache digest enabled; rebuild/rewrite every %d/%d sec\n",
- (int) Config.digest.rebuild_period, (int) Config.digest.rewrite_period);
+ debugs(71, 1, "Local cache digest enabled; rebuild/rewrite every " <<
+ (int) Config.digest.rebuild_period << "/" <<
+ (int) Config.digest.rewrite_period << " sec");
+
memset(&sd_state, 0, sizeof(sd_state));
#else
store_digest = NULL;
- debug(71, 3) ("Local cache digest is 'off'\n");
+ debugs(71, 3, "Local cache digest is 'off'");
#endif
}
}
assert(entry && store_digest);
- debug(71, 6) ("storeDigestDel: checking entry, key: %s\n",
- entry->getMD5Text());
+ debugs(71, 6, "storeDigestDel: checking entry, key: " << entry->getMD5Text());
if (!EBIT_TEST(entry->flags, KEY_PRIVATE)) {
if (!cacheDigestTest(store_digest, (const cache_key *)entry->key)) {
sd_stats.del_lost_count++;
- debug(71, 6) ("storeDigestDel: lost entry, key: %s url: %s\n",
- entry->getMD5Text(), entry->url());
+ debugs(71, 6, "storeDigestDel: lost entry, key: " << entry->getMD5Text() << " url: " << entry->url() );
} else {
sd_stats.del_count++;
cacheDigestDel(store_digest, (const cache_key *)entry->key);
- debug(71, 6) ("storeDigestDel: deled entry, key: %s\n",
- entry->getMD5Text());
+ debugs(71, 6, "storeDigestDel: deled entry, key: " << entry->getMD5Text());
}
}
{
/* add some stats! XXX */
- debug(71, 6) ("storeDigestAddable: checking entry, key: %s\n",
- e->getMD5Text());
+ debugs(71, 6, "storeDigestAddable: checking entry, key: " << e->getMD5Text());
/* check various entry flags (mimics StoreEntry::checkCachable XXX) */
if (!EBIT_TEST(e->flags, ENTRY_CACHABLE)) {
- debug(71, 6) ("storeDigestAddable: NO: not cachable\n");
+ debugs(71, 6, "storeDigestAddable: NO: not cachable");
return 0;
}
if (EBIT_TEST(e->flags, KEY_PRIVATE)) {
- debug(71, 6) ("storeDigestAddable: NO: private key\n");
+ debugs(71, 6, "storeDigestAddable: NO: private key");
return 0;
}
if (EBIT_TEST(e->flags, ENTRY_NEGCACHED)) {
- debug(71, 6) ("storeDigestAddable: NO: negative cached\n");
+ debugs(71, 6, "storeDigestAddable: NO: negative cached");
return 0;
}
if (EBIT_TEST(e->flags, RELEASE_REQUEST)) {
- debug(71, 6) ("storeDigestAddable: NO: release requested\n");
+ debugs(71, 6, "storeDigestAddable: NO: release requested");
return 0;
}
if (e->store_status == STORE_OK && EBIT_TEST(e->flags, ENTRY_BAD_LENGTH)) {
- debug(71, 6) ("storeDigestAddable: NO: wrong content-length\n");
+ debugs(71, 6, "storeDigestAddable: NO: wrong content-length");
return 0;
}
/* do not digest huge objects */
if (e->swap_file_sz > Config.Store.maxObjectSize) {
- debug(71, 6) ("storeDigestAddable: NO: too big\n");
+ debugs(71, 6, "storeDigestAddable: NO: too big");
return 0;
}
/* still here? check staleness */
/* Note: We should use the time of the next rebuild, not (cur_time+period) */
if (refreshCheckDigest(e, Config.digest.rebuild_period)) {
- debug(71, 6) ("storeDigestAdd: entry expires within %d secs, ignoring\n",
- (int) Config.digest.rebuild_period);
+ debugs(71, 6, "storeDigestAdd: entry expires within " << (int) Config.digest.rebuild_period << " secs, ignoring");
return 0;
}
cacheDigestAdd(store_digest, (const cache_key *)entry->key);
- debug(71, 6) ("storeDigestAdd: added entry, key: %s\n",
- entry->getMD5Text());
+ debugs(71, 6, "storeDigestAdd: added entry, key: " << entry->getMD5Text());
} else {
sd_stats.rej_count++;
/* prevent overlapping if rebuild schedule is too tight */
if (sd_state.rebuild_lock) {
- debug(71, 1) ("storeDigestRebuildStart: overlap detected, consider increasing rebuild period\n");
+ debugs(71, 1, "storeDigestRebuildStart: overlap detected, consider increasing rebuild period");
return;
}
sd_state.rebuild_lock = 1;
- debug(71, 2) ("storeDigestRebuildStart: rebuild #%d\n", sd_state.rebuild_count + 1);
+ debugs(71, 2, "storeDigestRebuildStart: rebuild #" << sd_state.rebuild_count + 1);
if (sd_state.rewrite_lock) {
- debug(71, 2) ("storeDigestRebuildStart: waiting for Rewrite to finish.\n");
+ debugs(71, 2, "storeDigestRebuildStart: waiting for Rewrite to finish.");
return;
}
assert(sd_state.rebuild_lock);
sd_state.rebuild_lock = 0;
sd_state.rebuild_count++;
- debug(71, 2) ("storeDigestRebuildFinish: done.\n");
+ debugs(71, 2, "storeDigestRebuildFinish: done.");
eventAdd("storeDigestRebuildStart", storeDigestRebuildStart, NULL, (double)
Config.digest.rebuild_period, 1);
/* resume pending Rewrite if any */
(double) Config.digest.rebuild_chunk_percentage / 100.0);
assert(sd_state.rebuild_lock);
- debug(71, 3) ("storeDigestRebuildStep: buckets: %d entries to check: %d\n",
- store_hash_buckets, count);
+ debugs(71, 3, "storeDigestRebuildStep: buckets: " << store_hash_buckets << " entries to check: " << count);
while (count-- && !sd_state.theSearch->isDone() && sd_state.theSearch->next())
storeDigestAdd(sd_state.theSearch->currentItem());
/* prevent overlapping if rewrite schedule is too tight */
if (sd_state.rewrite_lock) {
- debug(71, 1) ("storeDigestRewrite: overlap detected, consider increasing rewrite period\n");
+ debugs(71, 1, "storeDigestRewrite: overlap detected, consider increasing rewrite period");
return;
}
- debug(71, 2) ("storeDigestRewrite: start rewrite #%d\n", sd_state.rewrite_count + 1);
+ debugs(71, 2, "storeDigestRewrite: start rewrite #" << sd_state.rewrite_count + 1);
/* make new store entry */
url = internalLocalUri("/squid-internal-periodic/", StoreDigestFileName);
flags.cachable = 1;
e = storeCreateEntry(url, url, flags, METHOD_GET);
assert(e);
sd_state.rewrite_lock = e;
- debug(71, 3) ("storeDigestRewrite: url: %s key: %s\n", url, e->getMD5Text());
+ debugs(71, 3, "storeDigestRewrite: url: " << url << " key: " << e->getMD5Text());
HttpRequest *req = HttpRequest::CreateFromUrl(url);
e->mem_obj->request = HTTPMSGLOCK(req);
/* wait for rebuild (if any) to finish */
if (sd_state.rebuild_lock) {
- debug(71, 2) ("storeDigestRewriteStart: waiting for rebuild to finish.\n");
+ debugs(71, 2, "storeDigestRewriteStart: waiting for rebuild to finish.");
return;
}
rep->setHeaders(version, HTTP_OK, "Cache Digest OK",
"application/cache-digest", store_digest->mask_size + sizeof(sd_state.cblock),
squid_curtime, squid_curtime + Config.digest.rewrite_period);
- debug(71, 3) ("storeDigestRewrite: entry expires on %ld (%+d)\n",
- (long int) rep->expires, (int) (rep->expires - squid_curtime));
+ debugs(71, 3, "storeDigestRewrite: entry expires on " << (long int) rep->expires <<
+ " (" << std::showpos << (int) (rep->expires - squid_curtime) << ")");
e->buffer();
e->replaceHttpReply(rep);
storeDigestCBlockSwapOut(e);
assert(e == sd_state.rewrite_lock);
e->complete();
e->timestampsSet();
- debug(71, 2) ("storeDigestRewriteFinish: digest expires at %ld (%+d)\n",
- (long int) e->expires, (int) (e->expires - squid_curtime));
+ debugs(71, 2, "storeDigestRewriteFinish: digest expires at " << (long int) e->expires <<
+ " (" << std::showpos << (int) (e->expires - squid_curtime) << ")");
/* is this the write order? @?@ */
e->mem_obj->unlinkRequest();
e->unlock();
const int lo_cap = 1 + store_swap_size / Config.Store.avgObjectSize;
const int e_count = StoreEntry::inUseCount();
int cap = e_count ? e_count : hi_cap;
- debug(71, 2) ("storeDigestCalcCap: have: %d, want %d entries; limits: [%d, %d]\n",
- e_count, cap, lo_cap, hi_cap);
+ debugs(71, 2, "storeDigestCalcCap: have: " << e_count << ", want " << cap <<
+ " entries; limits: [" << lo_cap << ", " << hi_cap << "]");
if (cap < lo_cap)
cap = lo_cap;
int diff;
assert(store_digest);
diff = abs(cap - store_digest->capacity);
- debug(71, 2) ("storeDigestResize: %d -> %d; change: %d (%d%%)\n",
- store_digest->capacity, cap, diff,
- xpercentInt(diff, store_digest->capacity));
+ debugs(71, 2, "storeDigestResize: " <<
+ store_digest->capacity << " -> " << cap << "; change: " <<
+ diff << " (" << xpercentInt(diff, store_digest->capacity) << "%)" );
/* avoid minor adjustments */
if (diff <= store_digest->capacity / 10) {
- debug(71, 2) ("storeDigestResize: small change, will not resize.\n");
+ debugs(71, 2, "storeDigestResize: small change, will not resize.");
return 0;
} else {
- debug(71, 2) ("storeDigestResize: big change, resizing.\n");
+ debugs(71, 2, "storeDigestResize: big change, resizing.");
cacheDigestChangeCap(store_digest, cap);
return 1;
}
/*
- * $Id: store_dir.cc,v 1.158 2007/04/17 05:40:18 wessels Exp $
+ * $Id: store_dir.cc,v 1.159 2007/04/28 22:26:38 hno Exp $
*
* DEBUG: section 47 Store Directory Routines
* AUTHOR: Duane Wessels
if (0 == strcasecmp(Config.store_dir_select_algorithm, "round-robin")) {
storeDirSelectSwapDir = storeDirSelectSwapDirRoundRobin;
- debug(47, 1) ("Using Round Robin store dir selection\n");
+ debugs(47, 1, "Using Round Robin store dir selection");
} else {
storeDirSelectSwapDir = storeDirSelectSwapDirLeastLoad;
- debug(47, 1) ("Using Least Load store dir selection\n");
+ debugs(47, 1, "Using Least Load store dir selection");
}
}
assert(op > SWAP_LOG_NOP && op < SWAP_LOG_MAX);
- debug(20, 3) ("storeDirSwapLog: %s %s %d %08X\n",
- swap_log_op_str[op],
- e->getMD5Text(),
- e->swap_dirn,
- e->swap_filen);
+ debugs(20, 3, "storeDirSwapLog: " <<
+ swap_log_op_str[op] << " " <<
+ e->getMD5Text() << " " <<
+ e->swap_dirn << " " <<
+ std::hex << std::uppercase << std::setfill('0') << std::setw(8) << e->swap_filen);
dynamic_cast<SwapDir *>(INDEXSD(e->swap_dirn))->logEntry(*e, op);
}
int notdone = 1;
if (StoreController::store_dirs_rebuilding) {
- debug(20, 1) ("Not currently OK to rewrite swap log.\n");
- debug(20, 1) ("storeDirWriteCleanLogs: Operation aborted.\n");
+ debugs(20, 1, "Not currently OK to rewrite swap log.");
+ debugs(20, 1, "storeDirWriteCleanLogs: Operation aborted.");
return 0;
}
- debug(20, 1) ("storeDirWriteCleanLogs: Starting...\n");
+ debugs(20, 1, "storeDirWriteCleanLogs: Starting...");
getCurrentTime();
start = current_time;
sd = dynamic_cast<SwapDir *>(INDEXSD(dirn));
if (sd->writeCleanStart() < 0) {
- debug(20, 1) ("log.clean.start() failed for dir #%d\n", sd->index);
+ debugs(20, 1, "log.clean.start() failed for dir #" << sd->index);
continue;
}
}
if ((++n & 0xFFFF) == 0) {
getCurrentTime();
- debug(20, 1) (" %7d entries written so far.\n", n);
+ debugs(20, 1, " " << std::setw(7) << n <<
+ " entries written so far.");
}
}
}
dt = tvSubDsec(start, current_time);
- debug(20, 1) (" Finished. Wrote %d entries.\n", n);
+ debugs(20, 1, " Finished. Wrote " << n << " entries.");
+ debugs(20, 1, " Took "<< std::setw(3)<< std::setprecision(2) << dt <<
+ " seconds ("<< std::setw(6) << ((double) n / (dt > 0.0 ? dt : 1.0)) << " entries/sec).");
- debug(20, 1) (" Took %3.1f seconds (%6.1f entries/sec).\n",
- dt, (double) n / (dt > 0.0 ? dt : 1.0));
return n;
}
struct statvfs sfs;
if (statvfs(path, &sfs)) {
- debug(50, 1) ("%s: %s\n", path, xstrerror());
+ debugs(50, 1, "" << path << ": " << xstrerror());
*blksize = 2048;
return 1;
}
struct statfs sfs;
if (statfs(path, &sfs)) {
- debug(50, 1) ("%s: %s\n", path, xstrerror());
+ debugs(50, 1, "" << path << ": " << xstrerror());
*blksize = 2048;
return 1;
}
struct statvfs sfs;
if (statvfs(path, &sfs)) {
- debug(50, 1) ("%s: %s\n", path, xstrerror());
+ debugs(50, 1, "" << path << ": " << xstrerror());
return 1;
}
struct statfs sfs;
if (statfs(path, &sfs)) {
- debug(50, 1) ("%s: %s\n", path, xstrerror());
+ debugs(50, 1, "" << path << ": " << xstrerror());
return 1;
}
(const cache_key *key)
{
PROF_start(storeGet);
- debug(20, 3) ("storeGet: looking up %s\n", storeKeyText(key));
+ debugs(20, 3, "storeGet: looking up " << storeKeyText(key));
StoreEntry *p = static_cast<StoreEntry *>(hash_lookup(store_table, key));
PROF_stop(storeGet);
return p;
dirn = storeDirSelectSwapDir(e);
if (dirn == -1) {
- debug(20, 2) ("storeCreate: no valid swapdirs for this object\n");
+ debugs(20, 2, "storeCreate: no valid swapdirs for this object");
store_io_stats.create.select_fail++;
return NULL;
}
- debug(20, 2) ("storeCreate: Selected dir '%d' for obj size '%ld'\n", dirn, (long int) objsize);
+ debugs(20, 2, "storeCreate: Selected dir '" << dirn << "' for obj size '" << (long int) objsize << "'");
SD = dynamic_cast<SwapDir *>(INDEXSD(dirn));
/* Now that we have a fs to use, call its storeCreate function */
/*
- * $Id: store_log.cc,v 1.31 2007/04/20 07:29:47 wessels Exp $
+ * $Id: store_log.cc,v 1.32 2007/04/28 22:26:38 hno Exp $
*
* DEBUG: section 20 Storage Manager Logging Functions
* AUTHOR: Duane Wessels
storeLogTagsCounts[tag]++;
if (mem != NULL) {
if (mem->log_url == NULL) {
- debug(20, 1) ("storeLog: NULL log_url for %s\n", mem->url);
+ debugs(20, 1, "storeLog: NULL log_url for " << mem->url);
mem->dump();
mem->log_url = xstrdup(mem->url);
}
storeLogOpen(void)
{
if (strcmp(Config.Log.store, "none") == 0) {
- debug(20, 1) ("Store logging disabled\n");
+ debugs(20, 1, "Store logging disabled");
return;
}
/*
- * $Id: store_rebuild.cc,v 1.88 2007/04/10 19:24:38 wessels Exp $
+ * $Id: store_rebuild.cc,v 1.89 2007/04/28 22:26:38 hno Exp $
*
* DEBUG: section 20 Store Rebuild Routines
* AUTHOR: Duane Wessels
dt = tvSubDsec(rebuild_start, current_time);
- debug(20, 1) ("Finished rebuilding storage from disk.\n");
-
- debug(20, 1) (" %7d Entries scanned\n", counts.scancount);
-
- debug(20, 1) (" %7d Invalid entries.\n", counts.invalid);
-
- debug(20, 1) (" %7d With invalid flags.\n", counts.badflags);
-
- debug(20, 1) (" %7d Objects loaded.\n", counts.objcount);
-
- debug(20, 1) (" %7d Objects expired.\n", counts.expcount);
-
- debug(20, 1) (" %7d Objects cancelled.\n", counts.cancelcount);
-
- debug(20, 1) (" %7d Duplicate URLs purged.\n", counts.dupcount);
-
- debug(20, 1) (" %7d Swapfile clashes avoided.\n", counts.clashcount);
-
- debug(20, 1) (" Took %3.1f seconds (%6.1f objects/sec).\n", dt,
- (double) counts.objcount / (dt > 0.0 ? dt : 1.0));
-
- debug(20, 1) ("Beginning Validation Procedure\n");
+ debugs(20, 1, "Finished rebuilding storage from disk.");
+ debugs(20, 1, " " << std::setw(7) << counts.scancount << " Entries scanned");
+ debugs(20, 1, " " << std::setw(7) << counts.invalid << " Invalid entries.");
+ debugs(20, 1, " " << std::setw(7) << counts.badflags << " With invalid flags.");
+ debugs(20, 1, " " << std::setw(7) << counts.objcount << " Objects loaded.");
+ debugs(20, 1, " " << std::setw(7) << counts.expcount << " Objects expired.");
+ debugs(20, 1, " " << std::setw(7) << counts.cancelcount << " Objects cancelled.");
+ debugs(20, 1, " " << std::setw(7) << counts.dupcount << " Duplicate URLs purged.");
+ debugs(20, 1, " " << std::setw(7) << counts.clashcount << " Swapfile clashes avoided.");
+ debugs(20, 1, " Took "<< std::setw(3)<< std::setprecision(2) << dt << " seconds ("<< std::setw(6) <<
+ ((double) counts.objcount / (dt > 0.0 ? dt : 1.0)) << " objects/sec).");
+ debugs(20, 1, "Beginning Validation Procedure");
eventAdd("storeCleanup", storeCleanup, NULL, 0.0, 1);
d += (double) RebuildProgress[sd_index].total;
}
- debug(20, 1) ("Store rebuilding is %4.1f%% complete\n", 100.0 * n / d);
+ debugs(20, 1, "Store rebuilding is "<< std::setw(4)<< std::setprecision(2) << 100.0 * n / d << "% complete");
last_report = squid_curtime;
}
/*
- * $Id: store_swapin.cc,v 1.39 2006/05/23 00:30:21 wessels Exp $
+ * $Id: store_swapin.cc,v 1.40 2007/04/28 22:26:38 hno Exp $
*
* DEBUG: section 20 Storage Manager Swapin Functions
* AUTHOR: Duane Wessels
return;
}
- debug(20, 3) ("storeSwapInStart: called for %d %08X %s \n",
- e->swap_dirn, e->swap_filen, e->getMD5Text());
+ debugs(20, 3, "storeSwapInStart: called for : " << e->swap_dirn << " " <<
+ std::hex << std::setw(8) << std::setfill('0') << std::uppercase <<
+ e->swap_filen << " " << e->getMD5Text());
if (e->swap_status != SWAPOUT_WRITING && e->swap_status != SWAPOUT_DONE) {
- debug(20, 1) ("storeSwapInStart: bad swap_status (%s)\n",
- swapStatusStr[e->swap_status]);
+ debugs(20, 1, "storeSwapInStart: bad swap_status (" << swapStatusStr[e->swap_status] << ")");
return;
}
if (e->swap_filen < 0) {
- debug(20, 1) ("storeSwapInStart: swap_filen < 0\n");
+ debugs(20, 1, "storeSwapInStart: swap_filen < 0");
return;
}
assert(e->mem_obj != NULL);
- debug(20, 3) ("storeSwapInStart: Opening fileno %08X\n",
- e->swap_filen);
+ debugs(20, 3, "storeSwapInStart: Opening fileno " << std::hex << std::setw(8) << std::setfill('0') << std::uppercase << e->swap_filen);
sc->swapin_sio = storeOpen(e, storeSwapInFileNotify, storeSwapInFileClosed, sc);
}
storeSwapInFileClosed(void *data, int errflag, StoreIOState::Pointer self)
{
store_client *sc = (store_client *)data;
- debug(20, 3) ("storeSwapInFileClosed: sio=%p, errflag=%d\n",
- sc->swapin_sio.getRaw(), errflag);
+ debugs(20, 3, "storeSwapInFileClosed: sio=" << sc->swapin_sio.getRaw() << ", errflag=" << errflag);
sc->swapin_sio = NULL;
if (sc->_callback.pending()) {
store_client *sc = (store_client *)data;
StoreEntry *e = sc->entry;
- debug(1, 3) ("storeSwapInFileNotify: changing %d/%d to %d/%d\n", e->swap_filen, e->swap_dirn, sc->swapin_sio->swap_filen, sc->swapin_sio->swap_dirn);
+ debugs(1, 3, "storeSwapInFileNotify: changing " << e->swap_filen << "/" <<
+ e->swap_dirn << " to " << sc->swapin_sio->swap_filen << "/" <<
+ sc->swapin_sio->swap_dirn);
e->swap_filen = sc->swapin_sio->swap_filen;
e->swap_dirn = sc->swapin_sio->swap_dirn;
/*
- * $Id: store_swapmeta.cc,v 1.24 2007/04/21 07:14:15 wessels Exp $
+ * $Id: store_swapmeta.cc,v 1.25 2007/04/28 22:26:38 hno Exp $
*
* DEBUG: section 20 Storage Manager Swapfile Metadata
* AUTHOR: Kostas Anagnostakis
assert(e->mem_obj != NULL);
assert(e->swap_status == SWAPOUT_WRITING);
url = e->url();
- debug(20, 3) ("storeSwapMetaBuild: %s\n", url);
+ debugs(20, 3, "storeSwapMetaBuild: " << url );
tlv *t = StoreMeta::Factory (STORE_META_KEY,MD5_DIGEST_CHARS, e->key);
if (!t) {
/*
- * $Id: store_swapout.cc,v 1.115 2007/04/21 07:14:15 wessels Exp $
+ * $Id: store_swapout.cc,v 1.116 2007/04/28 22:26:38 hno Exp $
*
* DEBUG: section 20 Storage Manager Swapout Functions
* AUTHOR: Duane Wessels
/* Build the swap metadata, so the filesystem will know how much
* metadata there is to store
*/
- debug(20, 5) ("storeSwapOutStart: Begin SwapOut '%s' to dirno %d, fileno %08X\n",
- e->url(), e->swap_dirn, e->swap_filen);
+ debugs(20, 5, "storeSwapOutStart: Begin SwapOut '" << e->url() << "' to dirno " <<
+ e->swap_dirn << ", fileno " << std::hex << std::setw(8) << std::setfill('0') <<
+ std::uppercase << e->swap_filen);
e->swap_status = SWAPOUT_WRITING;
/* If we start swapping out objects with OutOfBand Metadata,
* then this code needs changing
*/
ssize_t swap_buf_len = mem->swapout.memnode->nodeBuffer.length;
- debug(20, 3) ("storeSwapOut: swap_buf_len = %d\n", (int) swap_buf_len);
+ debugs(20, 3, "storeSwapOut: swap_buf_len = " << (int) swap_buf_len);
assert(swap_buf_len > 0);
- debug(20, 3) ("storeSwapOut: swapping out %ld bytes from %ld\n",
- (long int) swap_buf_len, (long int) mem->swapout.queue_offset);
+ debugs(20, 3, "storeSwapOut: swapping out " << (long int) swap_buf_len << " bytes from " << (long int) mem->swapout.queue_offset);
mem->swapout.queue_offset += swap_buf_len;
if (!swapoutPossible())
return;
- debug(20, 7) ("storeSwapOut: mem_obj->inmem_lo = %d\n",
- (int) mem_obj->inmem_lo);
-
- debug(20, 7) ("storeSwapOut: mem_obj->endOffset() = %d\n",
- (int) mem_obj->endOffset());
-
- debug(20, 7) ("storeSwapOut: swapout.queue_offset = %d\n",
- (int) mem_obj->swapout.queue_offset);
+ debugs(20, 7, "storeSwapOut: mem_obj->inmem_lo = " << (int) mem_obj->inmem_lo);
+ debugs(20, 7, "storeSwapOut: mem_obj->endOffset() = " << (int) mem_obj->endOffset());
+ debugs(20, 7, "storeSwapOut: swapout.queue_offset = " << (int) mem_obj->swapout.queue_offset);
if (mem_obj->swapout.sio != NULL)
- debug(20, 7) ("storeSwapOut: storeOffset() = %d\n",
- (int) mem_obj->swapout.sio->offset());
+ debugs(20, 7, "storeSwapOut: storeOffset() = " << (int) mem_obj->swapout.sio->offset() );
ssize_t swapout_maxsize = (ssize_t) (mem_obj->endOffset() - mem_obj->swapout.queue_offset);
off_t const lowest_offset = mem_obj->lowestMemReaderOffset();
- debug(20, 7) ("storeSwapOut: lowest_offset = %d\n",
- (int) lowest_offset);
+ debugs(20, 7, "storeSwapOut: lowest_offset = " << (int) lowest_offset);
/*
* Grab the swapout_size and check to see whether we're going to defer
* content-length, rather than wait to accumulate huge
* amounts of object data in memory.
*/
- debug(20, 5) ("storeSwapOut: Deferring starting swapping out\n");
+ debugs(20, 5, "storeSwapOut: Deferring starting swapping out");
return;
}
#if SIZEOF_OFF_T == 4
if (mem_obj->endOffset() > 0x7FFF0000) {
- debug(20, 0) ("WARNING: preventing off_t overflow for %s\n", url());
+ debugs(20, 0, "WARNING: preventing off_t overflow for " << url() );
abort();
return;
}
if (!swapOutAble())
return;
- debug(20, 7) ("storeSwapOut: swapout_size = %d\n",
- (int) swapout_maxsize);
+ debugs(20, 7, "storeSwapOut: swapout_size = " << (int) swapout_maxsize);
if (swapout_maxsize == 0) {
if (store_status == STORE_OK)
StoreEntry::swapOutFileClose()
{
assert(mem_obj != NULL);
- debug(20, 3) ("storeSwapOutFileClose: %s\n", getMD5Text());
- debug(20, 3) ("storeSwapOutFileClose: sio = %p\n", mem_obj->swapout.sio.getRaw());
+ debugs(20, 3, "storeSwapOutFileClose: " << getMD5Text());
+ debugs(20, 3, "storeSwapOutFileClose: sio = " << mem_obj->swapout.sio.getRaw());
if (mem_obj->swapout.sio == NULL)
return;
cbdataFree(c);
if (errflag) {
- debug(20, 1) ("storeSwapOutFileClosed: dirno %d, swapfile %08X, errflag=%d\n\t%s\n",
- e->swap_dirn, e->swap_filen, errflag, xstrerror());
+ debugs(20, 1, "storeSwapOutFileClosed: dirno " << e->swap_dirn << ", swapfile " <<
+ std::hex << std::setw(8) << std::setfill('0') << std::uppercase <<
+ e->swap_filen << ", errflag=" << errflag);
+ debugs(20, 1, "\t" << xstrerror());
if (errflag == DISK_NO_SPACE_LEFT) {
/* FIXME: this should be handle by the link from store IO to
e->releaseRequest();
} else {
/* swapping complete */
- debug(20, 3) ("storeSwapOutFileClosed: SwapOut complete: '%s' to %d, %08X\n",
- e->url(), e->swap_dirn, e->swap_filen);
+ debugs(20, 3, "storeSwapOutFileClosed: SwapOut complete: '" << e->url() << "' to " <<
+ e->swap_dirn << ", " << std::hex << std::setw(8) << std::setfill('0') <<
+ std::uppercase << e->swap_filen);
e->swap_file_sz = e->objectLen() + mem->swap_hdr_sz;
e->swap_status = SWAPOUT_DONE;
e->store()->updateSize(e->swap_file_sz, 1);
statCounter.swap.outs++;
}
- debug(20, 3) ("storeSwapOutFileClosed: %s:%d\n", __FILE__, __LINE__);
+ debugs(20, 3, "storeSwapOutFileClosed: " << __FILE__ << ":" << __LINE__);
mem->swapout.sio = NULL;
e->unlock();
}
/*
- * $Id: stub_MemObject.cc,v 1.5 2006/08/21 00:50:47 robertc Exp $
+ * $Id: stub_MemObject.cc,v 1.6 2007/04/28 22:26:52 hno Exp $
*
* DEBUG: section 84 Helper process maintenance
* AUTHOR: Robert Collins
MemObject::write(StoreIOBuffer writeBuffer, STMCB *callback, void *callbackData)
{
PROF_start(MemObject_write);
- debug(19, 6) ("memWrite: offset %lu len %ld\n", (unsigned long)writeBuffer.offset, (long)writeBuffer.length);
+ debugs(19, 6, "memWrite: offset " << (unsigned long)writeBuffer.offset << " len " << (long)writeBuffer.length);
/* the offset is into the content, not the headers */
writeBuffer.offset += (_reply ? _reply->hdr_sz : 0);
/*
- * $Id: tools.cc,v 1.273 2007/04/15 14:46:17 serassio Exp $
+ * $Id: tools.cc,v 1.274 2007/04/28 22:26:38 hno Exp $
*
* DEBUG: section 21 Misc Functions
* AUTHOR: Harvest Derived
#if !HAVE_SIGACTION
if (signal(sig, sigusr2_handle) == SIG_ERR) /* reinstall */
- debug(50, 0) ("signal: sig=%d func=%p: %s\n", sig, sigusr2_handle, xstrerror());
+ debugs(50, 0, "signal: sig=" << sig << " func=" << sigusr2_handle <<
+ ": " << xstrerror());
#endif
}
/* DNS lookup successful */
/* use the official name from DNS lookup */
xstrncpy(host, h->h_name, SQUIDHOSTNAMELEN);
- debug(50, 4) ("getMyHostname: resolved %s to '%s'\n",
- inet_ntoa(sa),
- host);
+ debugs(50, 4, "getMyHostname: resolved " << inet_ntoa(sa) << " to '" << host << "'");
+
present = 1;
if (strchr(host, '.'))
}
- debug(50, 1) ("WARNING: failed to resolve %s to a fully qualified hostname\n",
- inet_ntoa(sa));
+ debugs(50, 1, "WARNING: failed to resolve " << inet_ntoa(sa) << " to a fully qualified hostname");
}
/*
* Get the host name and store it in host to return
*/
if (gethostname(host, SQUIDHOSTNAMELEN) < 0) {
- debug(50, 1) ("WARNING: gethostname failed: %s\n", xstrerror());
+ debugs(50, 1, "WARNING: gethostname failed: " << xstrerror());
} else if ((h = gethostbyname(host)) == NULL) {
- debug(50, 1) ("WARNING: gethostbyname failed for %s\n", host);
+ debugs(50, 1, "WARNING: gethostbyname failed for " << host);
} else {
- debug(50, 6) ("getMyHostname: '%s' resolved into '%s'\n",
- host, h->h_name);
+ debugs(50, 6, "getMyHostname: '" << host << "' resolved into '" << h->h_name << "'");
/* DNS lookup successful */
/* use the official name from DNS lookup */
xstrncpy(host, h->h_name, SQUIDHOSTNAMELEN);
#endif
if (setgid(Config2.effectiveGroupID) < 0)
- debug(50, 0) ("ALERT: setgid: %s\n", xstrerror());
+ debugs(50, 0, "ALERT: setgid: " << xstrerror());
}
if (!Config.effectiveGroup) {
if (setgid(Config2.effectiveGroupID) < 0)
- debug(50, 0) ("ALERT: setgid: %s\n", xstrerror());
+ debugs(50, 0, "ALERT: setgid: " << xstrerror());
if (initgroups(Config.effectiveUser, Config2.effectiveGroupID) < 0) {
- debug(50, 0) ("ALERT: initgroups: unable to set groups for User %s "
- "and Group %u", Config.effectiveUser,
- (unsigned) Config2.effectiveGroupID);
+ debugs(50, 0, "ALERT: initgroups: unable to set groups for User " <<
+ Config.effectiveUser << " and Group " <<
+ (unsigned) Config2.effectiveGroupID << "");
}
}
#if HAVE_SETRESUID
if (setresuid(Config2.effectiveUserID, Config2.effectiveUserID, 0) < 0)
- debug(50, 0) ("ALERT: setresuid: %s\n", xstrerror());
+ debugs(50, 0, "ALERT: setresuid: " << xstrerror());
#elif HAVE_SETEUID
if (seteuid(Config2.effectiveUserID) < 0)
- debug(50, 0) ("ALERT: seteuid: %s\n", xstrerror());
+ debugs(50, 0, "ALERT: seteuid: " << xstrerror());
#else
if (setuid(Config2.effectiveUserID) < 0)
- debug(50, 0) ("ALERT: setuid: %s\n", xstrerror());
+ debugs(50, 0, "ALERT: setuid: " << xstrerror());
#endif
#if LINUX_TPROXY
#if HAVE_PRCTL && defined(PR_SET_DUMPABLE)
/* Set Linux DUMPABLE flag */
if (Config.coredump_dir && prctl(PR_SET_DUMPABLE, 1) != 0)
- debug(50, 2) ("ALERT: prctl: %s\n", xstrerror());
+ debugs(50, 2, "ALERT: prctl: " << xstrerror());
#endif
}
/* Set Linux DUMPABLE flag */
if (Config.coredump_dir && prctl(PR_SET_DUMPABLE, 1) != 0)
- debug(50, 2) ("ALERT: prctl: %s\n", xstrerror());
+ debugs(50, 2, "ALERT: prctl: " << xstrerror());
#endif
}
#if HAVE_SETRESUID
if (setresuid(uid, uid, uid) < 0)
- debug(50, 1) ("no_suid: setresuid: %s\n", xstrerror());
+ debugs(50, 1, "no_suid: setresuid: " << xstrerror());
#else
setuid(0);
if (setuid(uid) < 0)
- debug(50, 1) ("no_suid: setuid: %s\n", xstrerror());
+ debugs(50, 1, "no_suid: setuid: " << xstrerror());
#endif
#if HAVE_PRCTL && defined(PR_SET_DUMPABLE)
/* Set Linux DUMPABLE flag */
if (Config.coredump_dir && prctl(PR_SET_DUMPABLE, 1) != 0)
- debug(50, 2) ("ALERT: prctl: %s\n", xstrerror());
+ debugs(50, 2, "ALERT: prctl: " << xstrerror());
#endif
}
leave_suid();
if (fd < 0) {
- debug(50, 0) ("%s: %s\n", f, xstrerror());
+ debugs(50, 0, "" << f << ": " << xstrerror());
debug_trap("Could not write pid file");
return;
}
#if defined(RLIMIT_NOFILE)
if (getrlimit(RLIMIT_NOFILE, &rl) < 0) {
- debug(50, 0) ("setrlimit: RLIMIT_NOFILE: %s\n", xstrerror());
+ debugs(50, 0, "setrlimit: RLIMIT_NOFILE: " << xstrerror());
} else {
rl.rlim_cur = Squid_MaxFD;
#elif defined(RLIMIT_OFILE)
if (getrlimit(RLIMIT_OFILE, &rl) < 0) {
- debug(50, 0) ("setrlimit: RLIMIT_NOFILE: %s\n", xstrerror());
+ debugs(50, 0, "setrlimit: RLIMIT_NOFILE: " << xstrerror());
} else {
rl.rlim_cur = Squid_MaxFD;
#endif
#else /* HAVE_SETRLIMIT */
- debug(21, 1) ("setMaxFD: Cannot increase: setrlimit() not supported on this system\n");
+ debugs(21, 1, "setMaxFD: Cannot increase: setrlimit() not supported on this system");
#endif /* HAVE_SETRLIMIT */
#if HAVE_SETRLIMIT && defined(RLIMIT_DATA)
if (getrlimit(RLIMIT_DATA, &rl) < 0) {
- debug(50, 0) ("getrlimit: RLIMIT_DATA: %s\n", xstrerror());
+ debugs(50, 0, "getrlimit: RLIMIT_DATA: " << xstrerror());
} else if (rl.rlim_max > rl.rlim_cur) {
rl.rlim_cur = rl.rlim_max; /* set it to the max */
#endif /* RLIMIT_DATA */
#if HAVE_SETRLIMIT && defined(RLIMIT_VMEM)
if (getrlimit(RLIMIT_VMEM, &rl) < 0) {
- debug(50, 0) ("getrlimit: RLIMIT_VMEM: %s\n", xstrerror());
+ debugs(50, 0, "getrlimit: RLIMIT_VMEM: " << xstrerror());
} else if (rl.rlim_max > rl.rlim_cur) {
rl.rlim_cur = rl.rlim_max; /* set it to the max */
sigemptyset(&sa.sa_mask);
if (sigaction(sig, &sa, NULL) < 0)
- debug(50, 0) ("sigaction: sig=%d func=%p: %s\n", sig, func, xstrerror());
+ debugs(50, 0, "sigaction: sig=" << sig << " func=" << func << ": " << xstrerror());
#else
#ifdef _SQUID_MSWIN_
mb.init();
packerToMemInit(&p, &mb);
(*pm) (obj, &p);
- debug(section, level) ("%s%s", label, mb.buf);
+ debugs(section, level, "" << label << "" << mb.buf << "");
packerClean(&p);
mb.clean();
}
fp = fopen(Config.etcHostsPath, "r");
if (fp == NULL) {
- debug(1, 1) ("parseEtcHosts: %s: %s\n",
- Config.etcHostsPath, xstrerror());
+ debugs(1, 1, "parseEtcHosts: " << Config.etcHostsPath << ": " << xstrerror());
return;
}
addr = buf;
- debug(1, 5) ("etc_hosts: line is '%s'\n", buf);
+ debugs(1, 5, "etc_hosts: line is '" << buf << "'");
nt = strpbrk(lt, w_space);
*nt = '\0'; /* null-terminate the address */
- debug(1, 5) ("etc_hosts: address is '%s'\n", addr);
+ debugs(1, 5, "etc_hosts: address is '" << addr << "'");
lt = nt + 1;
char *host = NULL;
if (nt == lt) { /* multiple spaces */
- debug(1, 5) ("etc_hosts: multiple spaces, skipping\n");
+ debugs(1, 5, "etc_hosts: multiple spaces, skipping");
lt = nt + 1;
continue;
}
*nt = '\0';
- debug(1, 5) ("etc_hosts: got hostname '%s'\n", lt);
+ debugs(1, 5, "etc_hosts: got hostname '" << lt << "'");
if (Config.appendDomain && !strchr(lt, '.')) {
/* I know it's ugly, but it's only at reconfig */
if (need_linux_tproxy) {
if (prctl(PR_SET_KEEPCAPS, 1, 0, 0, 0)) {
- debug(1, 1) ("Error - tproxy support requires capability setting which has failed. Continuing without tproxy support\n");
+ debugs(1, 1, "Error - tproxy support requires capability setting which has failed. Continuing without tproxy support");
}
}
/*
- * $Id: tunnel.cc,v 1.166 2007/04/12 14:21:50 rousskov Exp $
+ * $Id: tunnel.cc,v 1.167 2007/04/28 22:26:38 hno Exp $
*
* DEBUG: section 26 Secure Sockets Layer Proxy
* AUTHOR: Duane Wessels
sslServerClosed(int fd, void *data)
{
SslStateData *sslState = (SslStateData *)data;
- debug(26, 3) ("sslServerClosed: FD %d\n", fd);
+ debugs(26, 3, "sslServerClosed: FD " << fd);
assert(fd == sslState->server.fd());
sslState->server.fd(-1);
sslClientClosed(int fd, void *data)
{
SslStateData *sslState = (SslStateData *)data;
- debug(26, 3) ("sslClientClosed: FD %d\n", fd);
+ debugs(26, 3, "sslClientClosed: FD " << fd);
assert(fd == sslState->client.fd());
sslState->client.fd(-1);
static void
sslStateFree(SslStateData * sslState)
{
- debug(26, 3) ("sslStateFree: sslState=%p\n", sslState);
+ debugs(26, 3, "sslStateFree: sslState=" << sslState);
assert(sslState != NULL);
assert(sslState->noConnections());
safe_free(sslState->url);
if (errcode == COMM_ERR_CLOSING)
return;
- debug(26, 3) ("sslReadServer: FD %d, read %d bytes\n", server.fd(), (int)len);
+ debugs(26, 3, "sslReadServer: FD " << server.fd() << ", read " << (int)len << " bytes");
if (len > 0) {
server.bytesIn(len);
if (xerrno == COMM_ERR_CLOSING)
return;
- debug(50, debugLevelForError(xerrno))
- ("sslReadServer: FD %d: read failure: %s\n", fd(), xstrerror());
+ debugs(50, debugLevelForError(xerrno), "sslReadServer: FD " << fd() <<
+ ": read failure: " << xstrerror());
if (!ignoreErrno(xerrno))
comm_close(fd());
if (errcode == COMM_ERR_CLOSING)
return;
- debug(26, 3) ("sslReadClient: FD %d, read %d bytes\n", client.fd(), (int) len);
+ debugs(26, 3, "sslReadClient: FD " << client.fd() << ", read " << (int) len << " bytes");
if (len > 0) {
client.bytesIn(len);
void
SslStateData::writeServerDone(char *buf, size_t len, comm_err_t flag, int xerrno)
{
- debug(26, 3) ("sslWriteServer: FD %d, %d bytes written\n", server.fd(), (int)len);
+ debugs(26, 3, "sslWriteServer: FD " << server.fd() << ", " << (int)len << " bytes written");
/* Error? */
if (len < 0 || flag != COMM_OK) {
void
SslStateData::writeClientDone(char *buf, size_t len, comm_err_t flag, int xerrno)
{
- debug(26, 3) ("sslWriteClient: FD %d, %d bytes written\n", client.fd(), (int)len);
+ debugs(26, 3, "sslWriteClient: FD " << client.fd() << ", " << (int)len << " bytes written");
/* Error? */
if (len < 0 || flag != COMM_OK) {
sslTimeout(int fd, void *data)
{
SslStateData *sslState = (SslStateData *)data;
- debug(26, 3) ("sslTimeout: FD %d\n", fd);
+ debugs(26, 3, "sslTimeout: FD " << fd);
/* Temporary lock to protect our own feets (comm_close -> sslClientClosed -> Free) */
cbdataInternalLock(sslState);
sslConnected(int fd, void *data)
{
SslStateData *sslState = (SslStateData *)data;
- debug(26, 3) ("sslConnected: FD %d sslState=%p\n", fd, sslState);
+ debugs(26, 3, "sslConnected: FD " << fd << " sslState=" << sslState);
*sslState->status_ptr = HTTP_OK;
comm_write(sslState->client.fd(), conn_established, strlen(conn_established),
sslConnectedWriteDone, sslState, NULL);
sslState->host);
if (status == COMM_ERR_DNS) {
- debug(26, 4) ("sslConnect: Unknown host: %s\n", sslState->host);
+ debugs(26, 4, "sslConnect: Unknown host: " << sslState->host);
err = errorCon(ERR_DNS_FAIL, HTTP_NOT_FOUND, request);
*sslState->status_ptr = HTTP_NOT_FOUND;
err->dnsserver_msg = xstrdup(dns_error_message);
}
}
- debug(26, 3) ("sslStart: '%s %s'\n",
- RequestMethodStr[request->method], url);
+ debugs(26, 3, "sslStart: '" << RequestMethodStr[request->method] << " " << url << "'");
statCounter.server.all.requests++;
statCounter.server.other.requests++;
/* Create socket. */
url);
if (sock == COMM_ERROR) {
- debug(26, 4) ("sslStart: Failed because we're out of sockets.\n");
+ debugs(26, 4, "sslStart: Failed because we're out of sockets.");
err = errorCon(ERR_SOCKET_FAILURE, HTTP_INTERNAL_SERVER_ERROR, request);
*status_ptr = HTTP_INTERNAL_SERVER_ERROR;
err->xerrno = errno;
HttpHeader hdr_out(hoRequest);
Packer p;
http_state_flags flags;
- debug(26, 3) ("sslProxyConnected: FD %d sslState=%p\n", fd, sslState);
+ debugs(26, 3, "sslProxyConnected: FD " << fd << " sslState=" << sslState);
memset(&flags, '\0', sizeof(flags));
flags.proxying = sslState->request->flags.proxying;
MemBuf mb;
/*
- * $Id: unlinkd.cc,v 1.61 2007/04/24 15:04:22 hno Exp $
+ * $Id: unlinkd.cc,v 1.62 2007/04/28 22:26:38 hno Exp $
*
* DEBUG: section 2 Unlink Daemon
* AUTHOR: Duane Wessels
x = write(unlinkd_wfd, buf, l);
if (x < 0) {
- debug(2, 1) ("unlinkdUnlink: write FD %d failed: %s\n",
- unlinkd_wfd, xstrerror());
+ debugs(2, 1, "unlinkdUnlink: write FD " << unlinkd_wfd << " failed: " << xstrerror());
safeunlink(path, 0);
return;
} else if (x != l) {
- debug(2, 1) ("unlinkdUnlink: FD %d only wrote %d of %d bytes\n",
- unlinkd_wfd, x, l);
+ debugs(2, 1, "unlinkdUnlink: FD " << unlinkd_wfd << " only wrote " << x << " of " << l << " bytes");
safeunlink(path, 0);
return;
}
if (FD_PIPE == fd_table[unlinkd_wfd].type)
commUnsetNonBlocking(unlinkd_wfd);
- debug(2, 1) ("Unlinkd pipe opened on FD %d\n", unlinkd_wfd);
+ debugs(2, 1, "Unlinkd pipe opened on FD " << unlinkd_wfd);
#ifdef _SQUID_MSWIN_
- debug(2, 4) ("Unlinkd handle: 0x%x, PID: %d\n", (unsigned)hIpc, pid);
+ debugs(2, 4, "Unlinkd handle: 0x" << hex << (unsigned)hIpc << dec << ", PID: " << pid);
#endif
/*
- * $Id: url.cc,v 1.156 2007/04/07 09:35:38 serassio Exp $
+ * $Id: url.cc,v 1.157 2007/04/28 22:26:38 hno Exp $
*
* DEBUG: section 23 URL Parsing
* AUTHOR: Duane Wessels
void
urlInitialize(void)
{
- debug(23, 5) ("urlInitialize: Initializing...\n");
+ debugs(23, 5, "urlInitialize: Initializing...");
/* this ensures that the number of protocol strings is the same as
* the enum slots allocated because the last enum is always 'TOTAL'.
*/
if ((l = strlen(url)) + Config.appendDomainLen > (MAX_URL - 1)) {
/* terminate so it doesn't overflow other buffers */
*(url + (MAX_URL >> 1)) = '\0';
- debug(23, 1) ("urlParse: URL too large (%d bytes)\n", l);
+ debugs(23, 1, "urlParse: URL too large (" << l << " bytes)");
return NULL;
}
}
if (Config.onoff.check_hostnames && strspn(host, Config.onoff.allow_underscore ? valid_hostname_chars_u : valid_hostname_chars) != strlen(host)) {
- debug(23, 1) ("urlParse: Illegal character in hostname '%s'\n", host);
+ debugs(23, 1, "urlParse: Illegal character in hostname '" << host << "'");
return NULL;
}
strncat(host, Config.appendDomain, SQUIDHOSTNAMELEN - strlen(host) - 1);
if (port < 1 || port > 65535) {
- debug(23, 3) ("urlParse: Invalid port '%d'\n", port);
+ debugs(23, 3, "urlParse: Invalid port '" << port << "'");
return NULL;
}
/* These ports are filtered in the default squid.conf, but
* maybe someone wants them hardcoded... */
if (port == 7 || port == 9 || port == 19) {
- debug(23, 0) ("urlParse: Deny access to port %d\n", port);
+ debugs(23, 0, "urlParse: Deny access to port " << port);
return NULL;
}
#endif
if (stringHasWhitespace(urlpath)) {
- debug(23, 2) ("urlParse: URI has whitespace: {%s}\n", url);
+ debugs(23, 2, "urlParse: URI has whitespace: {" << url << "}");
switch (Config.uri_whitespace) {
static HttpRequest *
urnParse(method_t method, char *urn)
{
- debug(50, 5) ("urnParse: %s\n", urn);
+ debugs(50, 5, "urnParse: " << urn);
return new HttpRequest(method, PROTO_URN, urn + 4);
}
/*
- * $Id: urn.cc,v 1.104 2007/04/21 07:14:15 wessels Exp $
+ * $Id: urn.cc,v 1.105 2007/04/28 22:26:38 hno Exp $
*
* DEBUG: section 52 URN Parsing
* AUTHOR: Kostas Anagnostakis
url_entry *min_u = NULL;
int i;
int urlcnt = 0;
- debug(52, 3) ("urnFindMinRtt\n");
+ debugs(52, 3, "urnFindMinRtt");
assert(urls != NULL);
for (i = 0; NULL != urls[i].url; i++)
urlcnt++;
- debug(53, 3) ("urnFindMinRtt: Counted %d URLs\n", i);
+ debugs(53, 3, "urnFindMinRtt: Counted " << i << " URLs");
if (1 == urlcnt) {
- debug(52, 3) ("urnFindMinRtt: Only one URL - return it!\n");
+ debugs(52, 3, "urnFindMinRtt: Only one URL - return it!");
return urls;
}
for (i = 0; i < urlcnt; i++) {
u = &urls[i];
- debug(52, 3) ("urnFindMinRtt: %s rtt=%d\n", u->host, u->rtt);
+ debugs(52, 3, "urnFindMinRtt: " << u->host << " rtt=" << u->rtt);
if (u->rtt == 0)
continue;
if (rtt_ret)
*rtt_ret = min_rtt;
- debug(52, 1) ("urnFindMinRtt: Returning '%s' RTT %d\n",
- min_u ? min_u->url : "NONE",
- min_rtt);
+ debugs(52, 1, "urnFindMinRtt: Returning '" <<
+ (min_u ? min_u->url : "NONE") << "' RTT " <<
+ min_rtt );
return min_u;
}
createUriResRequest (r->urlpath);
if (urlres_r == NULL) {
- debug(52, 3) ("urnStart: Bad uri-res URL %s\n", urlres);
+ debugs(52, 3, "urnStart: Bad uri-res URL " << urlres);
ErrorState *err = errorCon(ERR_URN_RESOLVE, HTTP_NOT_FOUND, r);
err->url = urlres;
urlres = NULL;
void
UrnState::start(HttpRequest * r, StoreEntry * e)
{
- debug(52, 3) ("urnStart: '%s'\n", e->url());
+ debugs(52, 3, "urnStart: '" << e->url() << "'" );
entry = e;
request = HTTPMSGLOCK(r);
char *buf = urnState->reqbuf;
StoreIOBuffer tempBuffer;
- debug(52, 3) ("urnHandleReply: Called with size=%u.\n", (unsigned int)result.length);
+ debugs(52, 3, "urnHandleReply: Called with size=" << (unsigned int)result.length << ".");
/* Can't be lower because of the goto's */
HttpVersion version(1, 0);
k = headersEnd(buf, urnState->reqofs);
if (0 == k) {
- debug(52, 1) ("urnHandleReply: didn't find end-of-headers for %s\n",
- e->url());
+ debugs(52, 1, "urnHandleReply: didn't find end-of-headers for " << e->url() );
goto error;
}
assert(urlres_e->getReply());
rep = new HttpReply;
rep->parseCharBuf(buf, k);
- debug(52, 3) ("reply exists, code=%d.\n", rep->sline.status);
+ debugs(52, 3, "reply exists, code=" << rep->sline.status << ".");
if (rep->sline.status != HTTP_OK) {
- debug(52, 3) ("urnHandleReply: failed.\n");
+ debugs(52, 3, "urnHandleReply: failed.");
err = errorCon(ERR_URN_RESOLVE, HTTP_NOT_FOUND, urnState->request);
err->url = xstrdup(e->url());
errorAppendEntry(e, err);
for (i = 0; NULL != urls[i].url; i++)
urlcnt++;
- debug(53, 3) ("urnFindMinRtt: Counted %d URLs\n", i);
+ debugs(53, 3, "urnFindMinRtt: Counted " << i << " URLs");
if (urls == NULL) { /* unkown URN error */
- debug(52, 3) ("urnTranslateDone: unknown URN %s\n", e->url());
+ debugs(52, 3, "urnTranslateDone: unknown URN " << e->url() );
err = errorCon(ERR_URN_RESOLVE, HTTP_NOT_FOUND, urnState->request);
err->url = xstrdup(e->url());
errorAppendEntry(e, err);
for (i = 0; i < urlcnt; i++) {
u = &urls[i];
- debug(52, 3) ("URL {%s}\n", u->url);
+ debugs(52, 3, "URL {" << u->url << "}");
mb->Printf(
"<TR><TD><A HREF=\"%s\">%s</A></TD>", u->url, u->url);
"text/html", mb->contentSize(), 0, squid_curtime);
if (urnState->flags.force_menu) {
- debug(51, 3) ("urnHandleReply: forcing menu\n");
+ debugs(51, 3, "urnHandleReply: forcing menu");
} else if (min_u) {
rep->header.putStr(HDR_LOCATION, min_u->url);
}
url_entry *old;
int n = 32;
int i = 0;
- debug(52, 3) ("urnParseReply\n");
+ debugs(52, 3, "urnParseReply");
list = (url_entry *)xcalloc(n + 1, sizeof(*list));
for (token = strtok(buf, crlf); token; token = strtok(NULL, crlf)) {
- debug(52, 3) ("urnParseReply: got '%s'\n", token);
+ debugs(52, 3, "urnParseReply: got '" << token << "'");
if (i == n) {
old = list;
rtt = netdbHostRtt(host);
if (0 == rtt) {
- debug(52, 3) ("urnParseReply: Pinging %s\n", host);
+ debugs(52, 3, "urnParseReply: Pinging " << host);
netdbPingSite(host);
}
i++;
}
- debug(52, 3) ("urnParseReply: Found %d URLs\n", i);
+ debugs(52, 3, "urnParseReply: Found " << i << " URLs");
return list;
}
/*
- * $Id: useragent.cc,v 1.30 2007/04/25 11:30:18 adrian Exp $
+ * $Id: useragent.cc,v 1.31 2007/04/28 22:26:38 hno Exp $
*
* DEBUG: section 40 User-Agent Logging
* AUTHOR: Joe Ramey <ramey@csc.ti.com>
assert(NULL == useragentlog);
if (!Config.Log.useragent || (0 == strcmp(Config.Log.useragent, "none"))) {
- debug(40, 1) ("User-Agent logging is disabled.\n");
+ debugs(40, 1, "User-Agent logging is disabled.");
return;
}
/*
- * $Id: wccp.cc,v 1.41 2006/08/07 02:28:22 robertc Exp $
+ * $Id: wccp.cc,v 1.42 2007/04/28 22:26:38 hno Exp $
*
* DEBUG: section 80 WCCP Support
* AUTHOR: Glenn Chisholm
void
wccpInit(void)
{
- debug(80, 5) ("wccpInit: Called\n");
+ debugs(80, 5, "wccpInit: Called");
memset(&wccp_here_i_am, '\0', sizeof(wccp_here_i_am));
wccp_here_i_am.type = htonl(WCCP_HERE_I_AM);
wccp_here_i_am.version = htonl(Config.Wccp.version);
struct sockaddr_in router, local;
socklen_t local_len, router_len;
- debug(80, 5) ("wccpConnectionOpen: Called\n");
+ debugs(80, 5, "wccpConnectionOpen: Called");
if (Config.Wccp.router.s_addr == any_addr.s_addr) {
- debug(1, 1) ("WCCP Disabled.\n");
+ debugs(1, 1, "WCCP Disabled.");
return;
}
NULL,
0);
- debug(1, 1) ("Accepting WCCP messages on port %d, FD %d.\n",
- (int) port, theWccpConnection);
+ debugs(1, 1, "Accepting WCCP messages on port " << (int) port << ", FD " << theWccpConnection << ".");
router_len = sizeof(router);
wccpConnectionClose(void)
{
if (theWccpConnection > -1) {
- debug(80, 1) ("FD %d Closing WCCP socket\n", theWccpConnection);
+ debugs(80, 1, "FD " << theWccpConnection << " Closing WCCP socket");
comm_close(theWccpConnection);
theWccpConnection = -1;
}
socklen_t from_len;
int len;
- debug(80, 6) ("wccpHandleUdp: Called.\n");
+ debugs(80, 6, "wccpHandleUdp: Called.");
commSetSelect(sock, COMM_SELECT_READ, wccpHandleUdp, NULL, 0);
(struct sockaddr *) &from,
&from_len);
- debug(80, 3) ("wccpHandleUdp: %d bytes WCCP pkt from %s: type=%u, version=%u, change=%u, id=%u, number=%u\n",
- len,
- inet_ntoa(from.sin_addr),
- (unsigned) ntohl(wccp_i_see_you.type),
- (unsigned) ntohl(wccp_i_see_you.version),
- (unsigned) ntohl(wccp_i_see_you.change),
- (unsigned) ntohl(wccp_i_see_you.id),
- (unsigned) ntohl(wccp_i_see_you.number));
+ debugs(80, 3, "wccpHandleUdp: " << len << " bytes WCCP pkt from " <<
+ inet_ntoa(from.sin_addr) << ": type=" <<
+ (unsigned) ntohl(wccp_i_see_you.type) << ", version=" <<
+ (unsigned) ntohl(wccp_i_see_you.version) << ", change=" <<
+ (unsigned) ntohl(wccp_i_see_you.change) << ", id=" <<
+ (unsigned) ntohl(wccp_i_see_you.id) << ", number=" <<
+ (unsigned) ntohl(wccp_i_see_you.number));
if (len < 0)
return;
return;
if (ntohl(wccp_i_see_you.number) > WCCP_ACTIVE_CACHES) {
- debug(80, 1) ("Ignoring WCCP_I_SEE_YOU from %s with number of caches set to %d\n",
- inet_ntoa(from.sin_addr), (int) ntohl(wccp_i_see_you.number));
+ debugs(80, 1, "Ignoring WCCP_I_SEE_YOU from " <<
+ inet_ntoa(from.sin_addr) << " with number of caches set to " <<
+ (int) ntohl(wccp_i_see_you.number));
+
return;
}
static void
wccpHereIam(void *voidnotused)
{
- debug(80, 6) ("wccpHereIam: Called\n");
+ debugs(80, 6, "wccpHereIam: Called");
wccp_here_i_am.id = last_id;
comm_udp_send(theWccpConnection,
int cache_len;
char *buf;
- debug(80, 6) ("wccpAssignBuckets: Called\n");
+ debugs(80, 6, "wccpAssignBuckets: Called");
number_caches = ntohl(wccp_i_see_you.number);
assert(number_caches > 0);
/*
- * $Id: wccp2.cc,v 1.14 2007/04/07 10:01:50 serassio Exp $
+ * $Id: wccp2.cc,v 1.15 2007/04/28 22:26:38 hno Exp $
*
* DEBUG: section 80 WCCP Support
* AUTHOR: Steven Wilton
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
*
*/
+
#include "squid.h"
#include "comm.h"
#include "event.h"
static void
wccp2InitServices(void)
{
- debug(80, 5) ("wccp2InitServices: called\n");
+ debugs(80, 5, "wccp2InitServices: called");
}
static void
wccp2_service_list_ptr = (wccp2_service_list_t *) xcalloc(1, sizeof(struct wccp2_service_list_t));
- debug(80, 5) ("wccp2_add_service_list: added service id %d\n", service_id);
+ debugs(80, 5, "wccp2_add_service_list: added service id " << service_id);
/* XXX check what needs to be wrapped in htons()! */
wccp2_service_list_ptr->info.service_type = htons(WCCP2_SERVICE_INFO);
struct wccp2_security_md5_t *ws;
- debug(80, 5) ("wccp2_update_md5_security: called\n");
+ debugs(80, 5, "wccp2_update_md5_security: called");
/* The password field, for the MD5 hash, needs to be 8 bytes and NUL padded. */
memset(pwd, 0, sizeof(pwd));
/* Its the security part */
if (ntohl(ws->security_option) != WCCP2_MD5_SECURITY) {
- debug(80, 5) ("wccp2_update_md5_security: this service ain't md5'ing, abort\n");
+ debugs(80, 5, "wccp2_update_md5_security: this service ain't md5'ing, abort");
return 0;
}
if (ntohl(ws->security_option) != srv->wccp2_security_type)
{
- debug(80, 1) ("wccp2_check_security: received packet has the wrong security option\n");
+ debugs(80, 1, "wccp2_check_security: received packet has the wrong security option");
return 0;
}
if (srv->wccp2_security_type != WCCP2_MD5_SECURITY)
{
- debug(80, 1) ("wccp2_check_security: invalid security option\n");
+ debugs(80, 1, "wccp2_check_security: invalid security option");
return 0;
}
struct wccp2_security_md5_t wccp2_security_md5;
- debug(80, 5) ("wccp2Init: Called\n");
+ debugs(80, 5, "wccp2Init: Called");
if (wccp2_connected == 1)
return;
struct wccp2_router_list_t *router_list_ptr;
- debug(80, 5) ("wccp2ConnectionOpen: Called\n");
+ debugs(80, 5, "wccp2ConnectionOpen: Called");
if (wccp2_numrouters == 0 || !wccp2_service_list_head) {
- debug(80, 2) ("WCCPv2 Disabled.\n");
+ debugs(80, 2, "WCCPv2 Disabled.");
return;
}
NULL,
0);
- debug(80, 1) ("Accepting WCCPv2 messages on port %d, FD %d.\n",
- (int) port, theWccp2Connection);
-
- debug(80, 1) ("Initialising all WCCPv2 lists\n");
+ debugs(80, 1, "Accepting WCCPv2 messages on port " << (int) port << ", FD " << theWccp2Connection << ".");
+ debugs(80, 1, "Initialising all WCCPv2 lists");
/* Initialise all routers on all services */
memset(&null, 0, sizeof(null));
}
if (theWccp2Connection > -1) {
- debug(80, 1) ("FD %d Closing WCCP socket\n", theWccp2Connection);
+ debugs(80, 1, "FD " << theWccp2Connection << " Closing WCCP socket");
comm_close(theWccp2Connection);
theWccp2Connection = -1;
}
char *ptr;
int num_caches;
- debug(80, 6) ("wccp2HandleUdp: Called.\n");
+ debugs(80, 6, "wccp2HandleUdp: Called.");
commSetSelect(sock, COMM_SELECT_READ, wccp2HandleUdp, NULL, 0);
if (ntohl(wccp2_i_see_you.type) != WCCP2_I_SEE_YOU)
return;
- debug(80, 3) ("Incoming WCCPv2 I_SEE_YOU length %d.\n", ntohs(wccp2_i_see_you.length));
+ debugs(80, 3, "Incoming WCCPv2 I_SEE_YOU length " << ntohs(wccp2_i_see_you.length) << ".");
/* Record the total data length */
data_length = ntohs(wccp2_i_see_you.length);
offset = 0;
if (data_length > len) {
- debug(80, 1) ("ERROR: Malformed WCCPv2 packet claiming it's bigger than received data\n");
+ debugs(80, 1, "ERROR: Malformed WCCPv2 packet claiming it's bigger than received data");
return;
}
case WCCP2_SECURITY_INFO:
if (security_info != NULL) {
- debug(80, 1) ("Duplicate security definition\n");
+ debugs(80, 1, "Duplicate security definition");
return;
}
case WCCP2_SERVICE_INFO:
if (service_info != NULL) {
- debug(80, 1) ("Duplicate service_info definition\n");
+ debugs(80, 1, "Duplicate service_info definition");
return;
}
case WCCP2_ROUTER_ID_INFO:
if (router_identity_info != NULL) {
- debug(80, 1) ("Duplicate router_identity_info definition\n");
+ debugs(80, 1, "Duplicate router_identity_info definition");
return;
}
case WCCP2_RTR_VIEW_INFO:
if (router_view_header != NULL) {
- debug(80, 1) ("Duplicate router_view definition\n");
+ debugs(80, 1, "Duplicate router_view definition");
return;
}
case WCCP2_CAPABILITY_INFO:
if (router_capability_header != NULL) {
- debug(80, 1) ("Duplicate router_capability definition\n");
+ debugs(80, 1, "Duplicate router_capability definition");
return;
}
break;
default:
- debug(80, 1) ("Unknown record type in WCCPv2 Packet (%d).\n",
- ntohs(header->type));
+ debugs(80, 1, "Unknown record type in WCCPv2 Packet (" << ntohs(header->type) << ").");
}
offset += sizeof(struct wccp2_item_header_t);
offset += ntohs(header->length);
if (offset > data_length) {
- debug(80, 1) ("Error: WCCPv2 packet tried to tell us there is data beyond the end of the packet\n");
+ debugs(80, 1, "Error: WCCPv2 packet tried to tell us there is data beyond the end of the packet");
return;
}
}
if ((security_info == NULL) || (service_info == NULL) || (router_identity_info == NULL) || (router_view_header == NULL)) {
- debug(80, 1) ("Incomplete WCCPv2 Packet\n");
+ debugs(80, 1, "Incomplete WCCPv2 Packet");
return;
}
- debug(80, 5) ("Complete packet received\n");
+ debugs(80, 5, "Complete packet received");
/* Check that the service in the packet is configured on this router */
service_list_ptr = wccp2_service_list_head;
}
if (service_list_ptr == NULL) {
- debug(80, 1) ("WCCPv2 Unknown service received from router (%d)\n", service_info->service_id);
+ debugs(80, 1, "WCCPv2 Unknown service received from router (" << service_info->service_id << ")");
return;
}
}
if (!wccp2_check_security(service_list_ptr, (char *) security_info, (char *) &wccp2_i_see_you, len)) {
- debug(80, 1) ("Received WCCPv2 Packet failed authentication\n");
+ debugs(80, 1, "Received WCCPv2 Packet failed authentication");
return;
}
}
if (router_list_ptr->next == NULL) {
- debug(80, 1) ("WCCPv2 Packet received from unknown router\n");
+ debugs(80, 1, "WCCPv2 Packet received from unknown router");
return;
}
/* TODO: check return/forwarding methods */
if (router_capability_header == NULL) {
if ((Config.Wccp2.return_method != WCCP2_PACKET_RETURN_METHOD_GRE) || (Config.Wccp2.forwarding_method != WCCP2_FORWARDING_METHOD_GRE)) {
- debug(80, 1) ("wccp2HandleUdp: fatal error - A WCCP router does not support the forwarding method specified, only GRE supported\n");
+ debugs(80, 1, "wccp2HandleUdp: fatal error - A WCCP router does not support the forwarding method specified, only GRE supported");
wccp2ConnectionClose();
return;
}
break;
default:
- debug(80, 1) ("Unknown capability type in WCCPv2 Packet (%d).\n",
- ntohs(router_capability_element->capability_type));
+ debugs(80, 1, "Unknown capability type in WCCPv2 Packet (" << ntohs(router_capability_element->capability_type) << ").");
}
router_capability_element = (struct wccp2_capability_element_t *) (((char *) router_capability_element) + sizeof(struct wccp2_capability_element_header_t) + ntohs(router_capability_element->capability_length));
}
}
- debug(80, 5) ("Cleaning out cache list\n");
+ debugs(80, 5, "Cleaning out cache list");
/* clean out the old cache list */
for (cache_list_ptr = &router_list_ptr->cache_list_head; cache_list_ptr; cache_list_ptr = cache_list_ptr_next) {
cache_list_ptr->next = NULL;
- debug(80, 5) ("checking cache list: (%x:%x)\n", cache_address.s_addr, router_list_ptr->local_ip.s_addr);
+ debugs (80, 5, "checking cache list: (" << std::hex << cache_address.s_addr << ":" << router_list_ptr->local_ip.s_addr << ")");
/* Check to see if it's the master, or us */
}
}
} else {
- debug(80, 5) ("Adding ourselves as the only cache\n");
+ debugs(80, 5, "Adding ourselves as the only cache");
/* Update the cache list */
cache_list_ptr->cache_ip = router_list_ptr->local_ip;
if ((found == 1) && (service_list_ptr->lowest_ip == 1)) {
if (ntohl(router_view_header->change_number) != router_list_ptr->member_change) {
- debug(80, 4) ("Change detected - queueing up new assignment\n");
+ debugs(80, 4, "Change detected - queueing up new assignment");
router_list_ptr->member_change = ntohl(router_view_header->change_number);
eventDelete(wccp2AssignBuckets, NULL);
eventAdd("wccp2AssignBuckets", wccp2AssignBuckets, NULL, 15.0, 1);
} else {
- debug(80, 5) ("Change not detected (%d = %d)\n", (int) ntohl(router_view_header->change_number), router_list_ptr->member_change);
+ debugs(80, 5, "Change not detected (" << (int) ntohl(router_view_header->change_number) << " = " << router_list_ptr->member_change << ")");
}
} else {
eventDelete(wccp2AssignBuckets, NULL);
- debug(80, 5) ("I am not the lowest ip cache - not assigning buckets\n");
+ debugs(80, 5, "I am not the lowest ip cache - not assigning buckets");
}
}
int router_len;
u_short port = WCCP_PORT;
- debug(80, 6) ("wccp2HereIam: Called\n");
+ debugs(80, 6, "wccp2HereIam: Called");
if (wccp2_connected == 0) {
- debug(80, 1) ("wccp2HereIam: wccp2 socket closed. Shutting down WCCP2\n");
+ debugs(80, 1, "wccp2HereIam: wccp2 socket closed. Shutting down WCCP2");
return;
}
service_list_ptr = wccp2_service_list_head;
while (service_list_ptr != NULL) {
- debug(80, 5) ("wccp2HereIam: sending to service id %d\n", service_list_ptr->info.service_id);
+ debugs(80, 5, "wccp2HereIam: sending to service id " << service_list_ptr->info.service_id);
for (router_list_ptr = &service_list_ptr->router_list_head; router_list_ptr->next != NULL; router_list_ptr = router_list_ptr->next) {
router.sin_addr = router_list_ptr->router_sendto_address;
wccp2_update_md5_security(service_list_ptr->wccp_password, (char *) service_list_ptr->security_info, service_list_ptr->wccp_packet, service_list_ptr->wccp_packet_size);
}
- debug(80, 3) ("Sending HereIam packet size %d\n", (int) service_list_ptr->wccp_packet_size);
+ debugs(80, 3, "Sending HereIam packet size " << (int) service_list_ptr->wccp_packet_size);
/* Send the packet */
if (wccp2_numrouters > 1) {
main_header->type = htonl(WCCP2_REDIRECT_ASSIGN);
main_header->version = htons(WCCP2_VERSION);
- debug(80, 2) ("Running wccp2AssignBuckets\n");
+ debugs(80, 2, "Running wccp2AssignBuckets");
service_list_ptr = wccp2_service_list_head;
while (service_list_ptr != NULL) {
char wccp_password[WCCP2_PASSWORD_LEN + 1];
if (wccp2_connected == 1) {
- debug(80, 1) ("WCCPv2: Somehow reparsing the configuration "
- "without having shut down WCCP! Try reloading squid again.\n");
+ debugs(80, 1, "WCCPv2: Somehow reparsing the configuration without having shut down WCCP! Try reloading squid again.");
return;
}
/* Snarf the type */
if ((t = strtok(NULL, w_space)) == NULL) {
- debug(80, 0) ("wccp2ParseServiceInfo: missing service info type (standard|dynamic)\n");
+ debugs(80, 0, "wccp2ParseServiceInfo: missing service info type (standard|dynamic)");
self_destruct();
}
} else if (strcmp(t, "dynamic") == 0) {
service = WCCP2_SERVICE_DYNAMIC;
} else {
- debug(80, 0) ("wccp2ParseServiceInfo: bad service info type (expected standard|dynamic, got %s)\n", t);
+ debugs(80, 0, "wccp2ParseServiceInfo: bad service info type (expected standard|dynamic, got " << t << ")");
self_destruct();
}
service_id = GetInteger();
if (service_id < 0 || service_id > 255) {
- debug(80, 0) ("wccp2ParseServiceInfo: service info id %d is out of range (0..255)\n", service_id);
+ debugs(80, 0, "wccp2ParseServiceInfo: service info id " << service_id << " is out of range (0..255)");
self_destruct();
}
srv = wccp2_service_list_head;
while (srv != NULL) {
- debug(80, 3) ("dump_wccp2_service: id %d, type %d\n", srv->info.service_id, srv->info.service);
+ debugs(80, 3, "dump_wccp2_service: id " << srv->info.service_id << ", type " << srv->info.service);
storeAppendPrintf(e, "%s %s %d", label,
(srv->info.service == WCCP2_SERVICE_DYNAMIC) ? "dynamic" : "standard",
srv->info.service_id);
int priority = -1;
if (wccp2_connected == 1) {
- debug(80, 1) ("WCCPv2: Somehow reparsing the configuration "
- "without having shut down WCCP! Try reloading squid again.\n");
+ debugs(80, 1, "WCCPv2: Somehow reparsing the configuration without having shut down WCCP! Try reloading squid again.");
return;
}
- debug(80, 5) ("parse_wccp2_service_info: called\n");
+ debugs(80, 5, "parse_wccp2_service_info: called");
memset(portlist, 0, sizeof(portlist));
/* First argument: id */
service_id = GetInteger();
if (service_id < 0 || service_id > 255) {
- debug(80, 1) ("parse_wccp2_service_info: invalid service id %d (must be between 0 .. 255)\n", service_id);
+ debugs(80, 1, "parse_wccp2_service_info: invalid service id " << service_id << " (must be between 0 .. 255)");
self_destruct();
}
srv = wccp2_service_list_head;
while (srv != NULL) {
- debug(80, 3) ("dump_wccp2_service_info: id %d (type %d)\n", srv->info.service_id, srv->info.service);
+ debugs(80, 3, "dump_wccp2_service_info: id " << srv->info.service_id << " (type " << srv->info.service << ")");
/* We don't need to spit out information for standard services */
if (srv->info.service == WCCP2_SERVICE_STANDARD) {
- debug(80, 3) ("dump_wccp2_service_info: id %d: standard service, not dumping info\n", srv->info.service_id);
+ debugs(80, 3, "dump_wccp2_service_info: id " << srv->info.service_id << ": standard service, not dumping info");
+
/* XXX eww */
srv = srv->next;
continue;
/*
- * $Id: whois.cc,v 1.40 2007/04/21 07:14:15 wessels Exp $
+ * $Id: whois.cc,v 1.41 2007/04/28 22:26:38 hno Exp $
*
* DEBUG: section 75 WHOIS protocol
* AUTHOR: Duane Wessels, Kostas Anagnostakis
whoisTimeout(int fd, void *data)
{
WhoisState *p = (WhoisState *)data;
- debug(75, 1) ("whoisTimeout: %s\n", p->entry->url());
+ debugs(75, 1, "whoisTimeout: " << p->entry->url() );
whoisClose(fd, p);
}
}
buf[len] = '\0';
- debug(75, 3) ("whoisReadReply: FD %d read %d bytes\n", fd, (int)len);
- debug(75, 5) ("{%s}\n", buf);
+ debugs(75, 3, "whoisReadReply: FD " << fd << " read " << (int)len << " bytes");
+ debugs(75, 5, "{" << buf << "}");
if (flag == COMM_OK && len > 0) {
if (!dataWritten)
do_next_read = 1;
} else if (flag != COMM_OK || len < 0) {
- debug(50, 2) ("whoisReadReply: FD %d: read failure: %s.\n",
- fd, xstrerror());
+ debugs(50, 2, "whoisReadReply: FD " << fd << ": read failure: " << xstrerror() << ".");
if (ignoreErrno(errno)) {
do_next_read = 1;
fwd->complete();
- debug(75, 3) ("whoisReadReply: Done: %s\n", entry->url());
+ debugs(75, 3, "whoisReadReply: Done: " << entry->url() );
comm_close(fd);
whoisClose(int fd, void *data)
{
WhoisState *p = (WhoisState *)data;
- debug(75, 3) ("whoisClose: FD %d\n", fd);
+ debugs(75, 3, "whoisClose: FD " << fd);
p->entry->unlock();
cbdataFree(p);
}