]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Author: Tsantilas Christos <chtsanti@users.sourceforge.net>
authorhno <>
Sun, 29 Apr 2007 04:26:37 +0000 (04:26 +0000)
committerhno <>
Sun, 29 Apr 2007 04:26:37 +0000 (04:26 +0000)
Convert debug statements to debugs

171 files changed:
src/ACLARP.cc
src/ACLChecklist.cc
src/ACLDestinationDomain.cc
src/ACLDestinationIP.cc
src/ACLDomainData.cc
src/ACLExtUser.cc
src/ACLHTTPHeaderData.cc
src/ACLHTTPStatus.cc
src/ACLIP.cc
src/ACLIdent.cc
src/ACLIntRange.cc
src/ACLMaxConnection.cc
src/ACLMaxUserIP.cc
src/ACLProxyAuth.cc
src/ACLRegexData.cc
src/ACLSourceDomain.cc
src/ACLStringData.cc
src/ACLTimeData.cc
src/ACLUserData.cc
src/AuthConfig.cc
src/AuthUser.cc
src/AuthUserRequest.cc
src/CacheDigest.cc
src/ConfigParser.cc
src/Debug.h
src/DelayConfig.cc
src/DelayId.cc
src/DelayTagged.cc
src/DelayUser.cc
src/DelayVector.cc
src/DiskIO/AIO/AIODiskFile.cc
src/DiskIO/AIO/aio_win32.cc
src/DiskIO/Blocking/BlockingFile.cc
src/DiskIO/DiskDaemon/DiskdFile.cc
src/DiskIO/DiskDaemon/DiskdIOStrategy.cc
src/DiskIO/DiskThreads/DiskThreadsDiskFile.cc
src/DiskIO/DiskThreads/DiskThreadsIOStrategy.cc
src/DiskIO/DiskThreads/aiops.cc
src/DiskIO/DiskThreads/aiops_win32.cc
src/DiskIO/DiskThreads/async_io.cc
src/ESI.cc
src/ESIAssign.cc
src/ESIContext.cc
src/ESICustomParser.cc
src/ESIExpression.cc
src/ESIInclude.cc
src/ESISegment.cc
src/ESISequence.cc
src/ESIVarState.cc
src/HttpHdrCc.cc
src/HttpHdrContRange.cc
src/HttpHdrRange.cc
src/HttpHdrSc.cc
src/HttpHeader.cc
src/HttpHeaderTools.cc
src/HttpMsg.cc
src/HttpRequest.cc
src/HttpRequestMethod.cc
src/HttpStatusLine.cc
src/ICAP/ICAPClientStream.cc
src/ICAP/ICAPConfig.cc
src/ICAP/ICAPModXact.cc
src/ICAP/ICAPServiceRep.cc
src/ICAP/ICAPXaction.cc
src/IPInterception.cc
src/LeakFinder.cc
src/MemObject.cc
src/Server.cc
src/StatHist.cc
src/StoreMeta.cc
src/StoreMetaMD5.cc
src/StoreMetaURL.cc
src/StoreMetaUnpacker.cc
src/SwapDir.cc
src/WinSvc.cc
src/access_log.cc
src/acl.cc
src/acl_noncore.cc
src/asn.cc
src/auth/basic/auth_basic.cc
src/auth/digest/auth_digest.cc
src/auth/negotiate/auth_negotiate.cc
src/auth/ntlm/auth_ntlm.cc
src/authenticate.cc
src/cache_cf.cc
src/cache_manager.cc
src/carp.cc
src/cbdata.cc
src/cf_gen.cc
src/clientStream.cc
src/client_db.cc
src/client_side.cc
src/client_side_reply.cc
src/client_side_request.cc
src/comm.cc
src/comm_epoll.cc
src/comm_kqueue.cc
src/comm_poll.cc
src/comm_select.cc
src/comm_select_win32.cc
src/debug.cc
src/delay_pools.cc
src/disk.cc
src/dns.cc
src/dns_internal.cc
src/errorpage.cc
src/external_acl.cc
src/fd.cc
src/filemap.cc
src/forward.cc
src/fqdncache.cc
src/fs/coss/store_dir_coss.cc
src/fs/coss/store_io_coss.cc
src/fs/ufs/store_dir_ufs.cc
src/fs/ufs/store_io_ufs.cc
src/fs/ufs/ufscommon.cc
src/ftp.cc
src/gopher.cc
src/helper.cc
src/htcp.cc
src/http.cc
src/icmp.cc
src/icp_v2.cc
src/icp_v3.cc
src/ident.cc
src/internal.cc
src/ipc.cc
src/ipc_win32.cc
src/ipcache.cc
src/logfile.cc
src/main.cc
src/mem.cc
src/mime.cc
src/multicast.cc
src/neighbors.cc
src/net_db.cc
src/pconn.cc
src/peer_digest.cc
src/peer_select.cc
src/pinger.cc
src/redirect.cc
src/referer.cc
src/refresh.cc
src/repl/heap/store_heap_replacement.cc
src/repl/heap/store_repl_heap.cc
src/send-announce.cc
src/snmp_agent.cc
src/snmp_core.cc
src/ssl_support.cc
src/stat.cc
src/stmem.cc
src/store.cc
src/store_client.cc
src/store_digest.cc
src/store_dir.cc
src/store_io.cc
src/store_log.cc
src/store_rebuild.cc
src/store_swapin.cc
src/store_swapmeta.cc
src/store_swapout.cc
src/tests/stub_MemObject.cc
src/tools.cc
src/tunnel.cc
src/unlinkd.cc
src/url.cc
src/urn.cc
src/useragent.cc
src/wccp.cc
src/wccp2.cc
src/whois.cc

index 7b2261da01ae706e39382e4e50af638c8c298fe6..1af39c43adcada44a842e8dbbf825b78ada87ea5 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $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
@@ -160,7 +160,7 @@ decode_eth(const char *asc, char *eth)
     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 */
     }
 
@@ -178,18 +178,17 @@ aclParseArpData(const char *t)
 {
     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;
     }
@@ -276,16 +275,19 @@ aclMatchArp(SplayNode<acl_arp_data *> **dataptr, struct IN_ADDR c)
             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);
     }
 
@@ -295,13 +297,12 @@ aclMatchArp(SplayNode<acl_arp_data *> **dataptr, struct IN_ADDR c)
     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;
     }
 
@@ -320,8 +321,7 @@ aclMatchArp(SplayNode<acl_arp_data *> **dataptr, struct IN_ADDR c)
         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;
@@ -350,8 +350,7 @@ aclMatchArp(SplayNode<acl_arp_data *> **dataptr, struct IN_ADDR c)
             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;
         }
@@ -360,13 +359,14 @@ aclMatchArp(SplayNode<acl_arp_data *> **dataptr, struct IN_ADDR c)
         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;
@@ -377,8 +377,7 @@ aclMatchArp(SplayNode<acl_arp_data *> **dataptr, struct IN_ADDR c)
 
         /* 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;
         }
 
@@ -423,16 +422,18 @@ aclMatchArp(SplayNode<acl_arp_data *> **dataptr, struct IN_ADDR c)
                 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);
     }
@@ -484,17 +485,17 @@ aclMatchArp(SplayNode<acl_arp_data *> **dataptr, struct IN_ADDR c)
     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;
     }
@@ -530,16 +531,18 @@ aclMatchArp(SplayNode<acl_arp_data *> **dataptr, struct IN_ADDR c)
             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);
 
@@ -561,19 +564,19 @@ aclMatchArp(SplayNode<acl_arp_data *> **dataptr, struct IN_ADDR c)
 
     /* 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;
     }
@@ -593,16 +596,18 @@ aclMatchArp(SplayNode<acl_arp_data *> **dataptr, struct IN_ADDR c)
             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);
 
@@ -614,7 +619,7 @@ aclMatchArp(SplayNode<acl_arp_data *> **dataptr, struct IN_ADDR c)
     /*
      * 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;
 }
index 3e6fa4428b4c7ffd3d01e4ea66bbf90ed292572a..d450c8e564f2d8b3ac1cc21024786aaf10ebaeff 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $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
@@ -54,7 +54,7 @@ ACLChecklist::authenticated()
         /* 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 */
@@ -66,7 +66,7 @@ ACLChecklist::authenticated()
     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:
@@ -75,12 +75,12 @@ ACLChecklist::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;
 
@@ -123,7 +123,7 @@ ACLChecklist::check()
 
         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;
         }
 
@@ -140,7 +140,7 @@ ACLChecklist::check()
              * 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 */
@@ -160,8 +160,9 @@ ACLChecklist::check()
     }
 
     /* 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);
 }
@@ -177,7 +178,8 @@ ACLChecklist::asyncInProgress(bool const newAsync)
 {
     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
@@ -197,13 +199,14 @@ ACLChecklist::markFinished()
 {
     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);
 }
@@ -227,7 +230,8 @@ ACLChecklist::checkCallback(allow_t answer)
 {
     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 */
 
@@ -265,15 +269,17 @@ ACLChecklist::matchAclList(const acl_list * head, bool const fast)
             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
@@ -292,7 +298,8 @@ ACLChecklist::matchAclList(const acl_list * head, bool const fast)
         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);
 }
@@ -358,7 +365,7 @@ ACLChecklist::~ACLChecklist()
 
     cbdataReferenceDone(accessList);
 
-    debug (28,4)("ACLChecklist::~ACLChecklist: destroyed %p\n", this);
+    debugs(28, 4, "ACLChecklist::~ACLChecklist: destroyed " << this);
 }
 
 
@@ -427,7 +434,7 @@ ACLChecklist::fastCheck()
 {
     PROF_start(aclCheckFast);
     currentAnswer(ACCESS_DENIED);
-    debug(28, 5) ("aclCheckFast: list: %p\n", accessList);
+    debugs(28, 5, "aclCheckFast: list: " << accessList);
 
     while (accessList) {
         preCheck();
@@ -451,7 +458,8 @@ ACLChecklist::fastCheck()
         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;
 }
index 8b90f7df8c8b9cc3dd4a9e969c9d0b26f11fadc1..ccce7500fff55060e79ed0613b328f5faa673f9f 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $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
@@ -92,8 +92,7 @@ ACLDestinationDomainStrategy::match (ACLData<MatchType> * &data, ACLChecklist *c
         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;
     }
index a5db7a20a2a4ae5d845efc920e29ac2491a4615c..e16a70ae2a9a0d447e5a9497ac01f45c8375b96b 100644 (file)
@@ -60,8 +60,7 @@ ACLDestinationIP::match(ACLChecklist *checklist)
         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 {
index f2be463379e73148af062174612ff49e1196a941..fb173eb20b3e9e0836d79893cca2135b6aa8ea6f 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $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
@@ -100,9 +100,9 @@ aclDomainCompare(T const &a, T const &b)
 
     /* 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;
@@ -114,12 +114,11 @@ ACLDomainData::match(char const *host)
     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;
 }
index 341f46b0b801f252a0bf3f57b55e52cede708410..818d2cae4bad44875aeda4fab5badd9855a1f500 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $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
@@ -70,7 +70,7 @@ ACLExtUser::typeString() const
 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();
 }
index 509681c84ca5022185690208c8b9acd32108d490..18bc4ec9f8f680dd2dcf31352d8c60a6d502848f 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $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
@@ -63,7 +63,7 @@ ACLHTTPHeaderData::match(HttpHeader* hdr)
     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());
 
index 6f67d4674c1a43067f1d5c149c248165d88d11f4..4040f80a8945f6ce1a980ce7a07e19c95af20ecf 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $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
@@ -75,11 +75,9 @@ int acl_httpstatus_data::compare(acl_httpstatus_data* const& a, acl_httpstatus_d
         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;
@@ -174,8 +172,7 @@ aclMatchHTTPStatus(SplayNode<acl_httpstatus_data*> **dataptr, http_status status
     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);
 }
 
index 0350e730a805ca0d7ab2e27190811a8a1f919ebe..8f3743e54e6682c2b651af4749af57d490a22ac1 100644 (file)
@@ -165,12 +165,12 @@ acl_ip_data::NetworkCompare(acl_ip_data * const & a, acl_ip_data * const &b)
         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;
@@ -220,7 +220,7 @@ acl_ip_data::FactoryParse(const char *t)
     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")) {
@@ -254,7 +254,7 @@ acl_ip_data::FactoryParse(const char *t)
         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();
         }
 
@@ -269,7 +269,7 @@ acl_ip_data::FactoryParse(const char *t)
             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();
@@ -279,11 +279,11 @@ acl_ip_data::FactoryParse(const char *t)
 
             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();
         }
 
@@ -292,7 +292,7 @@ acl_ip_data::FactoryParse(const char *t)
 
     /* 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;
@@ -300,7 +300,7 @@ acl_ip_data::FactoryParse(const char *t)
 
     /* 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;
@@ -308,7 +308,7 @@ acl_ip_data::FactoryParse(const char *t)
 
     /* 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;
@@ -316,7 +316,7 @@ acl_ip_data::FactoryParse(const char *t)
 
     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;
 
@@ -376,8 +376,7 @@ ACLIP::match(struct IN_ADDR &clientip)
     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;
 }
 
index 18a5e4583f43fca4e548aa61afe851115aefa844..e9c2ad1a3bcdc8e1a67984200691218d8f0c2bdf 100644 (file)
@@ -70,7 +70,7 @@ void
 ACLIdent::parse()
 {
     if (!data) {
-        debug(28, 3) ("aclParseUserList: current is null. Creating\n");
+        debugs(28, 3, "aclParseUserList: current is null. Creating");
         data = new ACLUserData;
     }
 
@@ -85,7 +85,7 @@ ACLIdent::match(ACLChecklist *checklist)
     } 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;
     }
@@ -126,12 +126,12 @@ void
 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();
     }
index 60efec9d37a5b2718ec7302d23a24281cd895b2a..d8b385d2d2171279315bd380782b0cfe2a18e792 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $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
@@ -69,7 +69,7 @@ ACLIntRange::parse()
             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();
         }
     }
index 3cc3041630a8a21d5532ae8a050eeee2c033fbab..a3f2a0b3ff6a9aa43b54b639e1649de6d8e3768c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $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
@@ -121,5 +121,5 @@ ACLMaxConnection::prepareForUse()
     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");
 }
index e02c1a97293b663875e3bd19f60995feac21c8b0..1cb109acad4dc30b397cebff62191d106557c3cf 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $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
@@ -82,7 +82,7 @@ void
 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;
     }
 
@@ -91,10 +91,10 @@ ACLMaxUserIP::parse()
     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();
     }
@@ -104,7 +104,7 @@ ACLMaxUserIP::parse()
 
     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;
 }
@@ -128,7 +128,7 @@ ACLMaxUserIP::match(auth_user_request_t * auth_user_request,
     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)
@@ -139,7 +139,7 @@ ACLMaxUserIP::match(auth_user_request_t * auth_user_request,
          */
         /* 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
     {
         /*
@@ -147,7 +147,7 @@ ACLMaxUserIP::match(auth_user_request_t * auth_user_request,
          * 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;
index efba6a53118b69a917202c8f8926a61fc08f1ec6..8a18842a63adb75fe1cbf63ee9165c8135a8e4a4 100644 (file)
@@ -104,12 +104,12 @@ bool
 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;
     }
 
@@ -136,8 +136,7 @@ void
 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 */
@@ -183,7 +182,7 @@ ProxyAuthNeeded::checkForAsync(ACLChecklist *checklist) const
      * 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();
index d738ebd7ae33b388c0b3e8eb8493654aa2edcde8..28d3021ce5fbb3de0b8bcd2b1c4d6881044b6e40 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $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
@@ -67,7 +67,7 @@ ACLRegexData::match(char const *word)
     if (word == NULL)
         return 0;
 
-    debug(28, 3) ("aclRegexData::match: checking '%s'\n", word);
+    debugs(28, 3, "aclRegexData::match: checking '" << word << "'");
 
     relist *first, *prev;
 
@@ -78,7 +78,7 @@ ACLRegexData::match(char const *word)
     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(&current->regex, word, 0, 0, 0) == 0) {
             if (prev != NULL) {
@@ -89,7 +89,7 @@ ACLRegexData::match(char const *word)
                 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;
         }
 
@@ -142,10 +142,8 @@ aclParseRegexList(relist **curlist)
         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;
         }
 
index ed71ac45177b6c24b42ec7d037c1e17f51cd0eef..bbc830a3fae0dfd6eab9fbfe403d598851134843 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $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
@@ -82,8 +82,7 @@ ACLSourceDomainStrategy::match (ACLData<MatchType> * &data, ACLChecklist *checkl
         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;
     }
index 27a079bf12dbaad5aa323790af8df21984aa1000..4fa85ae779dd2928d7ad34418b3d530a299ee70d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $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
@@ -73,12 +73,11 @@ ACLStringData::match(char const *toFind)
     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;
 }
index 1093bc3def14210f022b0601ba956913d08a6cfa..57c344463e3bdb35f8ad1a5b34d8323826035428 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $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
@@ -86,8 +86,9 @@ ACLTimeData::match(time_t when)
     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;
@@ -181,9 +182,9 @@ ACLTimeData::parse()
                     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;
                 }
             }
@@ -191,7 +192,7 @@ ACLTimeData::parse()
             /* 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)
@@ -214,7 +215,7 @@ ACLTimeData::parse()
             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)
index 4d1226d856b2c871bfc4c366288cc39ccb62b960..65f0012154fd6d27d8da8777dccd0df0534d4d73 100644 (file)
@@ -71,16 +71,14 @@ ACLUserData::match(char const *user)
 {
     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;
     }
 
@@ -90,8 +88,8 @@ ACLUserData::match(char const *user)
         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;
 
@@ -128,17 +126,17 @@ ACLUserData::dump()
 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)
@@ -148,14 +146,13 @@ ACLUserData::parse()
         }
     }
 
-    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);
index 361c1b14e2e5151acc7109d7fb171b45275d2ad5..74a0b2c3f28c0ffb6c2a7124e5d107a425d5e274 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -46,12 +46,12 @@ AuthUserRequest *
 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;
     }
 
index 05e333bcd5ba3c2e448f6fb2429cf0a5ee947301..058b95ec5b3fbf858a1479f458f70666a27b5c47 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -58,7 +58,7 @@ AuthUser::AuthUser (AuthConfig *aConfig) :
     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
@@ -76,7 +76,7 @@ AuthUser::absorb (AuthUser *from)
      * 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) {
@@ -97,13 +97,13 @@ AuthUser::~AuthUser()
 {
     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
@@ -115,7 +115,7 @@ AuthUser::~AuthUser()
     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;
@@ -159,7 +159,7 @@ AuthUser::CachedACLsReset()
     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)))) {
@@ -170,7 +170,7 @@ AuthUser::CachedACLsReset()
 
     }
 
-    debug(29, 3) ("AuthUser::CachedACLsReset: Finished.\n");
+    debugs(29, 3, "AuthUser::CachedACLsReset: Finished.");
 }
 
 void
@@ -184,8 +184,8 @@ AuthUser::cacheCleanup(void *datanotused)
     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)))) {
@@ -194,10 +194,14 @@ AuthUser::cacheCleanup(void *datanotused)
 
         /* 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))
@@ -209,7 +213,7 @@ AuthUser::cacheCleanup(void *datanotused)
         }
     }
 
-    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);
 }
 
@@ -311,7 +315,7 @@ AuthUser::addIp(struct IN_ADDR ipaddr)
 
     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);
 }
@@ -320,25 +324,25 @@ AuthUser::addIp(struct IN_ADDR ipaddr)
 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;
index 357d25d650073b4bc371627a3ef175b4b6e2eb8e..f908dbd63427e2d08410a7905f428e2cb4414198 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -82,7 +82,7 @@ void
 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);
 }
 
@@ -94,25 +94,25 @@ AuthUserRequest::start(RH * handler, void *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;
     }
 
@@ -121,7 +121,7 @@ authenticateValidateUser(auth_user_request_t * auth_user_request)
     /* 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;
 
@@ -143,13 +143,15 @@ AuthUserRequest::operator delete (void *address)
 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()) {
@@ -343,7 +345,7 @@ AuthUserRequest::authenticate(auth_user_request_t ** auth_user_request, http_hdr
             || (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) {
@@ -374,7 +376,11 @@ AuthUserRequest::authenticate(auth_user_request_t ** auth_user_request, http_hdr
             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.
          */
@@ -393,19 +399,21 @@ AuthUserRequest::authenticate(auth_user_request_t ** auth_user_request, http_hdr
 
     /* 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;
@@ -415,7 +423,7 @@ AuthUserRequest::authenticate(auth_user_request_t ** auth_user_request, http_hdr
         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))) {
@@ -462,8 +470,11 @@ AuthUserRequest::authenticate(auth_user_request_t ** auth_user_request, http_hdr
                 ;
             } 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;
@@ -622,7 +633,7 @@ AuthUserRequest::addReplyAuthHeader(HttpReply * rep, auth_user_request_t * auth_
         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)
@@ -642,7 +653,7 @@ AuthUserRequest::addReplyAuthHeader(HttpReply * rep, auth_user_request_t * auth_
                 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");
             }
         }
 
@@ -679,7 +690,7 @@ void
 
 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;
 }
@@ -687,17 +698,17 @@ AuthUserRequest::lock()
 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;
     }
index e3699db39bc8aaecdd95a17d4410b8354020d9cf..bbd43a775a5df2f5f5f0b0d83de97cdfb2f4e9fc 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -340,9 +340,9 @@ cacheDigestHashKey(const CacheDigest * cd, const cache_key * key)
     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
index 4fa83386d0783c4053c43dd9240bdfedad407d53..d1f2e3879cba4dc0a60b01479c1b885402b8a478 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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/
@@ -70,7 +70,7 @@ strtok_again:
             *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);
             }
 
index 9ef1448805036245b2544c4cc92195e5ab179e15..1753c41206dded1dd4c190f456ef6a09bbff3e87 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -39,6 +39,7 @@
 #include <iostream>
 #undef assert
 #include <sstream>
+#include <iomanip>
 #if defined assert
 #undef assert
 #endif
index 924bae499c06224c4514749a0bed1a819464cf3e..b5ebfa46cb2595598b8f3c2faa320a84953d76f7 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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>
@@ -64,7 +64,7 @@ DelayConfig::parsePoolClass()
     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;
     }
 
@@ -72,7 +72,7 @@ DelayConfig::parsePoolClass()
     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;
     }
 
@@ -88,14 +88,14 @@ DelayConfig::parsePoolRates()
     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;
     }
 
@@ -110,7 +110,7 @@ DelayConfig::parsePoolAccess(ConfigParser &parser)
     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;
     }
 
index 28fc96146e7d2431cebb2e848c33ee108315c6a3..a5f51ec07aa8dfbb9030bc5ae31818766e6ecdfe 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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>
@@ -57,7 +57,7 @@ DelayId::DelayId () : pool_ (0), compositeId(NULL), markedAsNoDelay(false)
 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 ()
@@ -99,7 +99,7 @@ DelayId::DelayClient(ClientHttpRequest * http)
     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();
     }
 
index 8b3bc8243fec35aa6ec78143ed2fc3ebcc2724cc..071feae159935876742c295b803600d6a655b38f 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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>
@@ -185,12 +185,12 @@ DelayTaggedBucket::operator delete (void *address)
 
 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
@@ -216,7 +216,7 @@ DelayTagged::Id::Id(DelayTagged::Pointer aDelayTagged, String &aTag) : theTagged
 
 DelayTagged::Id::~Id()
 {
-    debug (77,3) ("DelayTagged::Id::~Id\n");
+    debugs(77, 3, "DelayTagged::Id::~Id");
 }
 
 int
index 5b52613767814e55f3acee864c0ce67f9ec15c1c..4e6a101536347ea9dce8b00e336210c5155275f6 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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>
@@ -184,7 +184,7 @@ DelayUserBucket::operator delete (void *address)
 
 DelayUserBucket::DelayUserBucket(AuthUser *aUser) : authUser (aUser)
 {
-    debug (77,3) ("DelayUserBucket::DelayUserBucket\n");
+    debugs(77, 3, "DelayUserBucket::DelayUserBucket");
 
     authUser->lock()
 
@@ -194,7 +194,7 @@ DelayUserBucket::DelayUserBucket(AuthUser *aUser) : authUser (aUser)
 DelayUserBucket::~DelayUserBucket()
 {
     authUser->unlock();
-    debug (77,3) ("DelayUserBucket::~DelayUserBucket\n");
+    debugs(77, 3, "DelayUserBucket::~DelayUserBucket");
 }
 
 void
@@ -220,7 +220,7 @@ DelayUser::Id::Id(DelayUser::Pointer aDelayUser,AuthUser *aUser) : theUser(aDela
 
 DelayUser::Id::~Id()
 {
-    debug (77,3) ("DelayUser::Id::~Id\n");
+    debugs(77, 3, "DelayUser::Id::~Id");
 }
 
 int
index 311d256fd73d027f3839fa233cff540eb4822ec1..b9b5b61ea973ab878e860ce71c7d14d0ab16ab22 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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>
@@ -140,7 +140,7 @@ DelayVector::Id::operator delete (void *address)
 
 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()) {
@@ -151,7 +151,7 @@ DelayVector::Id::Id(DelayVector::Pointer aDelayVector, CompositeSelectionDetails
 
 DelayVector::Id::~Id()
 {
-    debug(77,3)("DelayVector::Id::~Id\n");
+    debugs(77, 3, "DelayVector::Id::~Id");
 }
 
 int
index b9de96d41a59e9c96224bb36b5a1e298565f9b3c..e04e112f96290bf5826c9eb3ec079c5a7d4112c2 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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/
  * ----------------------------------------------------------
@@ -68,7 +68,7 @@ AIODiskFile::AIODiskFile (char const *aPath, AIODiskIOStrategy *aStrategy) : fd(
     assert (aPath);
     path = aPath;
     strategy = aStrategy;
-    debug (79,3)("AIODiskFile::AIODiskFile: %s\n", aPath);
+    debugs(79, 3, "AIODiskFile::AIODiskFile: " << aPath);
 }
 
 AIODiskFile::~AIODiskFile()
@@ -94,12 +94,12 @@ AIODiskFile::open (int flags, mode_t mode, IORequestor::Pointer callback)
     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();
@@ -126,7 +126,7 @@ AIODiskFile::read(ReadRequest *request)
     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;
@@ -163,7 +163,7 @@ AIODiskFile::read(ReadRequest *request)
     /* 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);
     }
@@ -184,7 +184,7 @@ AIODiskFile::write(WriteRequest *request)
     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;
@@ -221,7 +221,7 @@ AIODiskFile::write(WriteRequest *request)
     /* 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);
     }
index 8cb3cb623b67da964cb01dea2eab38800b7ba570..f1f95d2a2fa8838122f74a9cba0c2cbf3d052533 100755 (executable)
@@ -1,6 +1,6 @@
 
 /*
- * $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>
@@ -46,7 +46,7 @@ VOID CALLBACK IoCompletionRoutine(DWORD dwErrorCode,
 
     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);
 }
 
@@ -102,7 +102,7 @@ int aio_read(struct aiocb *aiocbp)
     if (!IoOperationStatus)
     {
         errno = GetLastError();
-        debug(81,1) ("aio_read: GetLastError=%i\n", errno);
+        debugs(81,1, "aio_read: GetLastError=" << errno  );
         return -1;
     }
 
@@ -156,7 +156,7 @@ int aio_read64(struct aiocb64 *aiocbp)
     if (!IoOperationStatus)
     {
         errno = GetLastError();
-        debug(81,1) ("aio_read: GetLastError=%i\n", errno);
+        debugs(81, 1, "aio_read: GetLastError=" << errno  );
         return -1;
     }
 
@@ -218,7 +218,7 @@ int aio_write(struct aiocb *aiocbp)
     if (!IoOperationStatus)
     {
         errno = GetLastError();
-        debug(81,1) ("aio_write: GetLastError=%i\n", errno);
+        debugs(81, 1, "aio_write: GetLastError=" << errno  );
         return -1;
     }
 
@@ -272,7 +272,7 @@ int aio_write64(struct aiocb64 *aiocbp)
     if (!IoOperationStatus)
     {
         errno = GetLastError();
-        debug(81,1) ("aio_write: GetLastError=%i\n", errno);
+        debugs(81, 1, "aio_write: GetLastError=" << errno  );
         return -1;
     }
 
index 66d2ca483d02f298aad7f0461e611bd0d15954c6..68d0a5e2dacfd462c838575ea4695333a813b78f 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -60,7 +60,7 @@ BlockingFile::operator delete (void *address)
 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);
 }
 
@@ -78,12 +78,12 @@ BlockingFile::open (int flags, mode_t mode, IORequestor::Pointer callback)
     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();
@@ -110,7 +110,7 @@ void BlockingFile::doClose()
 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();
@@ -156,7 +156,7 @@ BlockingFile::ReadDone(int fd, const char *buf, int len, int errflag, void *my_d
 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,
@@ -179,13 +179,13 @@ BlockingFile::ioInProgress()const
 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;
@@ -212,14 +212,13 @@ void
 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;
index 27e847a8b5bbe516ed04b14f7b17976bebac8bbe..ffc69cdd1424405878e49c9878e0248c07392203 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -57,7 +57,7 @@ DiskdFile::operator new (size_t)
     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;
 }
 
@@ -65,7 +65,7 @@ void
 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);
 }
 
@@ -73,7 +73,7 @@ DiskdFile::DiskdFile (char const *aPath, DiskdIOStrategy *anIO) : errorOccured (
         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++;
 }
@@ -87,7 +87,7 @@ DiskdFile::~DiskdFile()
 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());
@@ -118,7 +118,7 @@ DiskdFile::open (int flags, mode_t aMode, IORequestor::Pointer callback)
 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());
@@ -139,7 +139,7 @@ DiskdFile::create (int flags, mode_t aMode, IORequestor::Pointer callback)
         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;
@@ -168,7 +168,7 @@ DiskdFile::read(ReadRequest *aRead)
         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;
@@ -180,7 +180,7 @@ DiskdFile::read(ReadRequest *aRead)
 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,
@@ -194,7 +194,7 @@ DiskdFile::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;
@@ -219,7 +219,7 @@ bool
 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;
     }
 
@@ -277,7 +277,7 @@ void
 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++;
@@ -294,7 +294,7 @@ void
 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++;
@@ -332,7 +332,7 @@ DiskdFile::write(WriteRequest *aRequest)
         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;
@@ -358,7 +358,7 @@ void
 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++;
@@ -379,7 +379,7 @@ void
 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 */
@@ -403,7 +403,7 @@ void
 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 */
index 2f620217b7155a02aa8175fe21b8962749fda79e..432d3425be16e42f7e4529db1451ef3459f911a2 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -67,7 +67,7 @@ DiskdIOStrategy::shedLoad()
      */
 
     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;
     }
@@ -108,7 +108,7 @@ DiskdIOStrategy::unlinkFile(char const *path)
 {
     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);
@@ -139,7 +139,7 @@ DiskdIOStrategy::unlinkFile(char const *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);
     }
@@ -164,14 +164,14 @@ DiskdIOStrategy::init()
     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");
     }
 
@@ -263,14 +263,14 @@ SharedMemory::init(int ikey, int magic2)
                 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");
     }
 
@@ -286,8 +286,7 @@ SharedMemory::init(int ikey, int magic2)
 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)
@@ -304,8 +303,7 @@ DiskdIOStrategy::handle(diomsg * M)
          * - 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;
     }
@@ -388,7 +386,7 @@ DiskdIOStrategy::SEND(diomsg *M, int mtype, int id, int size, int offset, off_t
     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);
 
@@ -398,7 +396,7 @@ DiskdIOStrategy::SEND(diomsg *M, int mtype, int id, int size, int offset, off_t
         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)
@@ -461,14 +459,13 @@ DiskdIOStrategy::optionQ1Parse(const char *name, const char *value, int reconfig
         * 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;
 }
@@ -494,14 +491,13 @@ DiskdIOStrategy::optionQ2Parse(const char *name, const char *value, int reconfig
 
     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;
 }
@@ -523,8 +519,7 @@ DiskdIOStrategy::sync()
 
     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;
         }
 
@@ -568,8 +563,7 @@ DiskdIOStrategy::callback()
         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;
         }
 
index 89487a687f11ef7fd1203a9b27ff902847c1f79d..e3a25cc113e12cc1b1dd5b6e3414ddc412b180be 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -71,7 +71,7 @@ DiskThreadsDiskFile::DiskThreadsDiskFile (char const *aPath, DiskThreadsIOStrate
         inProgressIOs (0)
 {
     assert (aPath);
-    debug (79,3)("UFSFile::UFSFile: %s\n", aPath);
+    debugs(79, 3, "UFSFile::UFSFile: " << aPath);
     path_ = xstrdup (aPath);
 }
 
@@ -90,7 +90,7 @@ DiskThreadsDiskFile::open (int flags, mode_t mode, IORequestor::Pointer callback
     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;
     }
@@ -139,7 +139,7 @@ DiskThreadsDiskFile::create (int flags, mode_t mode, IORequestor::Pointer callba
     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;
     }
@@ -178,15 +178,15 @@ DiskThreadsDiskFile::OpenDone(int fd, void *cbdata, const char *buf, int aio_ret
 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++;
@@ -198,7 +198,7 @@ DiskThreadsDiskFile::openDone(int unused, const char *unused2, int anFD, int err
     --inProgressIOs;
     t->ioCompletedNotification();
 
-    debug(79, 3) ("DiskThreadsDiskFile::openDone: exiting\n");
+    debugs(79, 3, "DiskThreadsDiskFile::openDone: exiting");
 }
 
 void DiskThreadsDiskFile::doClose()
@@ -223,7 +223,7 @@ 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();
@@ -239,14 +239,14 @@ DiskThreadsDiskFile::close ()
 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
@@ -291,13 +291,13 @@ DiskThreadsDiskFile::ReadDone(int fd, const char *buf, int len, int errflag, voi
 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;
@@ -354,8 +354,7 @@ DiskThreadsDiskFile::writeDone (int rvfd, int errflag, size_t len, WriteRequest:
 
 #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);
 
index d69cefec48f4c9658273884a58ebed0b22ecfb3c..39343f7fcc9ce2bda7f879a22bc98847e0976f47 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -177,13 +177,13 @@ DiskThreadsIOStrategy::sync()
         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) {}
@@ -236,7 +236,7 @@ DiskThreadsIOStrategy::load()
 
     loadav = ql * 1000 / MAGIC1;
 
-    debug(47, 9) ("DiskThreadsIOStrategy::load: load=%d\n", loadav);
+    debugs(47, 9, "DiskThreadsIOStrategy::load: load=" << loadav);
 
     return loadav;
 }
index 55d111b2a551a803f45065f70ff04e3ff4f646a3..fbe7a50ed3915d35ff6d97bf9304b5a13d404738 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $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>
@@ -493,8 +493,7 @@ static void
 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;
@@ -538,7 +537,7 @@ squidaio_queue_request(squidaio_request_t * request)
         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");
         }
     }
 
@@ -561,11 +560,13 @@ squidaio_queue_request(squidaio_request_t * request)
 
         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;
         }
@@ -575,10 +576,10 @@ squidaio_queue_request(squidaio_request_t * request)
 
     /* 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 */
 
@@ -653,8 +654,7 @@ squidaio_cancel(squidaio_result_t * resultp)
     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;
@@ -960,8 +960,7 @@ AIO_REPOLL:
         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)
@@ -973,7 +972,7 @@ AIO_REPOLL:
 
     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);
 
@@ -1013,23 +1012,23 @@ squidaio_debug(squidaio_request_t * 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:
index 6b70f009bd2d66c0d6e7e235bd6e2239f0e7a366..c26ed91ada2b3f41c38db5995433c8a80c0e29f8 100755 (executable)
@@ -1,5 +1,5 @@
 /*
- * $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>
@@ -572,8 +572,7 @@ static void
 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;
@@ -623,7 +622,7 @@ squidaio_queue_request(squidaio_request_t * request)
         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");
         }
     }
 
@@ -646,11 +645,13 @@ squidaio_queue_request(squidaio_request_t * request)
 
         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;
         }
@@ -660,10 +661,10 @@ squidaio_queue_request(squidaio_request_t * request)
 
     /* 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 */
 
@@ -738,8 +739,7 @@ squidaio_cancel(squidaio_result_t * resultp)
     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;
@@ -904,7 +904,7 @@ static void
 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);
     }
 
@@ -1073,8 +1073,7 @@ AIO_REPOLL:
         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)
@@ -1086,7 +1085,7 @@ AIO_REPOLL:
 
     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);
 
@@ -1126,23 +1125,23 @@ squidaio_debug(squidaio_request_t * 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:
index e504327838b45c69a94a6f0128053fb02646799f..debd24f1d2ae0b0efe5119ede9eeafeaf115eca2 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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>
@@ -113,7 +113,7 @@ aioCancel(int fd)
             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);
index 5eda8b8133d46d2c95374bfbbcd1689c4780062b..51fc9f3e92253818b41953b196e0b4fa930fea4c 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -325,13 +325,13 @@ ESIContext::appendOutboundData(ESISegment::Pointer theData)
     }
 
     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);
@@ -366,7 +366,7 @@ ESIContext::kick ()
     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;
@@ -381,19 +381,19 @@ ESIContext::kick ()
         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
              */
@@ -456,7 +456,7 @@ esiStreamRead (clientStreamNode *thisNode, ClientHttpRequest *http)
     }
 
     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 */
 
@@ -485,12 +485,12 @@ esiStreamRead (clientStreamNode *thisNode, ClientHttpRequest *http)
          * 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;
@@ -501,7 +501,7 @@ esiStreamRead (clientStreamNode *thisNode, ClientHttpRequest *http)
         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;
     }
@@ -546,7 +546,7 @@ esiStreamStatus (clientStreamNode *thisNode, ClientHttpRequest *http)
 
     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 */
     }
 
@@ -587,7 +587,8 @@ ESIContext::trimBlanks()
     /* 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;
     }
 
@@ -601,18 +602,18 @@ ESIContext::trimBlanks()
 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;
@@ -629,11 +630,11 @@ ESIContext::send ()
 
     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; */
@@ -670,7 +671,7 @@ ESIContext::send ()
     }
 
     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 */
@@ -777,7 +778,10 @@ esiProcessStream (clientStreamNode *thisNode, ClientHttpRequest *http, HttpReply
         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);
@@ -794,7 +798,7 @@ esiProcessStream (clientStreamNode *thisNode, ClientHttpRequest *http, HttpReply
 
         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;
         }
@@ -803,8 +807,10 @@ esiProcessStream (clientStreamNode *thisNode, ClientHttpRequest *http, HttpReply
             /* 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;
 
@@ -841,7 +847,7 @@ esiProcessStream (clientStreamNode *thisNode, ClientHttpRequest *http, HttpReply
     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;
     }
@@ -878,7 +884,7 @@ esiProcessStream (clientStreamNode *thisNode, ClientHttpRequest *http, HttpReply
         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()
@@ -886,7 +892,7 @@ 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 *
@@ -912,10 +918,10 @@ ESIContextNew (HttpReply *rep, clientStreamNode *thisNode, ClientHttpRequest *ht
         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;
 }
 
@@ -992,10 +998,10 @@ ESIContext::addStackElement (ESIElement::Pointer element)
     /* 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 */
@@ -1014,7 +1020,7 @@ ESIContext::start(const char *el, const char **attr, size_t attrCount)
     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 */
@@ -1045,7 +1051,7 @@ ESIContext::start(const char *el, const char **attr, size_t attrCount)
         *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;
 
@@ -1107,7 +1113,7 @@ ESIContext::start(const char *el, const char **attr, size_t attrCount)
 
     addStackElement(element);
 
-    debug (86,5)("esi stack depth %d\n",parserState.stackdepth);
+    debugs(86, 5, "esi stack depth " << parserState.stackdepth);
 
 }  /* End of start handler */
 
@@ -1180,7 +1186,7 @@ ESIContext::parserComment (const char *s)
         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 */
@@ -1188,27 +1194,27 @@ ESIContext::parserComment (const char *s)
         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;
         }
 
@@ -1224,13 +1230,13 @@ ESIContext::addLiteral (const char *s, int len)
 {
     /* 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;
     }
 }
@@ -1256,7 +1262,7 @@ ESIContext::parseOneBuffer()
         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);
 
@@ -1278,7 +1284,7 @@ void
 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;
     }
@@ -1330,7 +1336,7 @@ ESIContext::process ()
         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;
@@ -1360,19 +1366,19 @@ ESIContext::process ()
         {
 
         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.");
@@ -1389,7 +1395,7 @@ ESIContext::process ()
             /* 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;
         }
 
@@ -1397,7 +1403,7 @@ ESIContext::process ()
                 && (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;
         }
 
@@ -1423,7 +1429,7 @@ ESIContext::ParserState::popAll()
 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;
@@ -1452,7 +1458,7 @@ extern ErrorState *clientBuildError (err_type, http_status, char const *, struct
 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 */
@@ -1495,7 +1501,7 @@ ESIContext::fail ()
 /* esiComment */
 esiComment::~esiComment()
 {
-    debug (86,5)("esiComment::~esiComment %p\n", this);
+    debugs(86, 5, "esiComment::~esiComment " << this);
 }
 
 esiComment::esiComment()
@@ -1509,13 +1515,13 @@ void
 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;
 }
 
@@ -1529,7 +1535,7 @@ esiComment::makeUsable(esiTreeParentPtr, ESIVarState &) const
 /* esiLiteral */
 esiLiteral::~esiLiteral()
 {
-    debug (86, 5) ("esiLiteral::~esiLiteral: %p\n", this);
+    debugs(86, 5, "esiLiteral::~esiLiteral: " << this);
     ESISegmentFreeList (buffer);
     cbdataReferenceDone (varState);
 }
@@ -1574,7 +1580,7 @@ esiLiteral::esiLiteral(ESIContext *context, const char *s, int numberOfCharacter
 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;
@@ -1621,7 +1627,7 @@ esiLiteral::makeCacheable() const
 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;
@@ -1632,7 +1638,7 @@ void
 esiRemoveFree (void *data)
 {
     esiRemove *thisNode = (esiRemove *)data;
-    debug (86,5)("esiRemoveFree %p\n", thisNode);
+    debugs(86, 5, "esiRemoveFree " << thisNode);
 }
 
 void *
@@ -1668,7 +1674,7 @@ 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 */
@@ -1676,7 +1682,7 @@ bool
 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;
     }
 
@@ -1686,7 +1692,7 @@ esiRemove::addElement (ESIElement::Pointer element)
 ESIElement::Pointer
 esiRemove::makeCacheable() const
 {
-    debug (86,5)("esiRemove::makeCacheable: Returning NULL\n");
+    debugs(86, 5, "esiRemove::makeCacheable: Returning NULL");
     return NULL;
 }
 
@@ -1700,7 +1706,7 @@ esiRemove::makeUsable(esiTreeParentPtr, ESIVarState &) const
 /* 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)
@@ -1713,7 +1719,7 @@ esiTry::render (ESISegment::Pointer output)
     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);
@@ -1725,24 +1731,25 @@ esiTry::render (ESISegment::Pointer 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;
         }
 
@@ -1752,7 +1759,7 @@ esiTry::addElement(ESIElement::Pointer element)
 
     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;
         }
 
@@ -1760,7 +1767,7 @@ esiTry::addElement(ESIElement::Pointer element)
         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;
 }
 
@@ -1780,12 +1787,12 @@ esiTry::process (int dovars)
     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;
     }
 
@@ -1794,21 +1801,21 @@ esiTry::process (int dovars)
         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;
         }
@@ -1823,22 +1830,22 @@ esiTry::process (int dovars)
         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;
         }
@@ -1870,7 +1877,7 @@ esiTry::fail(ESIElement *source, char const *anError)
 {
     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;
@@ -1910,7 +1917,7 @@ esiTry::esiTry(esiTry const &old)
 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;
 
@@ -1926,7 +1933,7 @@ esiTry::makeCacheable() const
 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;
 
@@ -2017,7 +2024,7 @@ esiVar::operator delete (void *address)
 /* 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)
@@ -2029,7 +2036,7 @@ esiChoose::render(ESISegment::Pointer output)
     /* 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);
@@ -2044,19 +2051,19 @@ esiChoose::addElement(ESIElement::Pointer element)
 
     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;
         }
 
@@ -2116,7 +2123,9 @@ ElementList::setNULL (int start, int end)
         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;
     }
@@ -2273,7 +2282,7 @@ ElementList::ElementList () : elements(NULL), allocedcount(0), allocedsize(0), e
 
 ElementList::~ElementList()
 {
-    debug (86,5)("ElementList::~ElementList %p\n", this);
+    debugs(86, 5, "ElementList::~ElementList " << this);
     setNULL(0, elementcount);
 
     if (elements)
@@ -2329,7 +2338,7 @@ esiWhen::esiWhen (esiTreeParentPtr aParent, int attrcount, const char **attr,ESI
     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];
@@ -2337,7 +2346,7 @@ esiWhen::esiWhen (esiTreeParentPtr aParent, int attrcount, const char **attr,ESI
             /* 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");
         }
     }
 
index badf8fcfbb13d424fc090fbb86da7e8391434cb2..6374e63ac90b8edd2fdffba2ba22deb2866328a1 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -55,14 +55,14 @@ ESIAssign::ESIAssign (esiTreeParentPtr aParent, int attrcount, char const **attr
     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 {
@@ -121,7 +121,7 @@ ESIAssign::process (int dovars)
 
     value = NULL;
 
-    debug (86,5) ("ESIAssign: Processed %p\n",this);
+    debugs(86, 5, "ESIAssign: Processed " << this);
 
     return ESI_PROCESS_COMPLETE;
 }
index b26f99d9b0a0a88c8759b3c60763b39051188612..8bd35a5dfe7a54aae6528e42e250479a1a4612be 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -45,12 +45,18 @@ ESIContext::updateCachedAST()
     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();
@@ -67,10 +73,12 @@ ESIContext::hasCachedAST() const
     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;
     }
 }
index 1badccf3252fe9d09aa44a8585e7a24377276791..7990abb5dad01603ecec31b10b5d6a96649be16e 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -91,7 +91,7 @@ ESICustomParser::findTag(char const *buffer, size_t bufferLength)
     if (myOffset == bufferLength)
         return NULL;
 
-    debug (86,9)("ESICustomParser::findTag: found %d\n", *resulttype);
+    debugs(86, 9, "ESICustomParser::findTag: found " << *resulttype);
 
     lastTag = *resulttype;
 
@@ -101,7 +101,7 @@ ESICustomParser::findTag(char const *buffer, size_t bufferLength)
 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) {
@@ -283,7 +283,7 @@ ESICustomParser::parse(char const *dataToParse, size_t const lengthOfData, bool
     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";
index 63197cc7d8bc8b5c0f7a30990c8c18f6b264d027..1607a3eff41144787699e4b36dd8c5fa3a8f5b4d 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -181,7 +181,7 @@ membercompare (stackmember a, stackmember b)
             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) {
@@ -201,7 +201,7 @@ membercompare (stackmember a, stackmember b)
                 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) {
@@ -221,7 +221,7 @@ membercompare (stackmember a, stackmember b)
                 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;
         }
     }
@@ -259,7 +259,7 @@ int evalnegate
 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;
 }
@@ -267,7 +267,7 @@ int evalliteral
 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;
 }
@@ -418,7 +418,7 @@ int evallesseq
         /* Something wrong upstream */
         return 1;
 
-    /* debug (86,1) ("?= %d \n", srv.value.integral); */
+    /*  debugs(86, 1, "?= " << srv.value.integral << " "); */
     return 0;
 
 
@@ -467,7 +467,7 @@ int evallessthan
         /* Something wrong upstream */
         return 1;
 
-    /* debug (86,1) ("?= %d \n", srv.value.integral); */
+    /* debugs(86, 1, "?= " << srv.value.integral << " "); */
     return 0;
 
 
@@ -516,7 +516,7 @@ int evalmoreeq
         /* Something wrong upstream */
         return 1;
 
-    /* debug (86,1) ("?= %d \n", srv.value.integral); */
+    /* debugs(86, 1, "?= " << srv.value.integral << " "); */
     return 0;
 
 
@@ -565,7 +565,7 @@ int evalmorethan
         /* Something wrong upstream */
         return 1;
 
-    /* debug (86,1) ("?= %d \n", srv.value.integral); */
+    /* debugs(86, 1, "?= " << srv.value.integral << " "); */
     return 0;
 
 }
@@ -614,7 +614,7 @@ evalequals (stackmember * stack, int *depth, int whereAmI,
         /* Something wrong upstream */
         return 1;
 
-    /* debug (86,1) ("?= %d \n", srv.value.integral); */
+    /* debugs(86, 1, "?= " << srv.value.integral << " "); */
     return 0;
 }
 
@@ -661,14 +661,14 @@ int evalnotequals
         /* 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 */
@@ -725,7 +725,7 @@ getsymbol (const char *s, char const **endptr)
 
             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);
@@ -741,7 +741,7 @@ getsymbol (const char *s, char const **endptr)
 
             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);
@@ -754,13 +754,13 @@ getsymbol (const char *s, char const **endptr)
         }
     } 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;
@@ -768,13 +768,13 @@ getsymbol (const char *s, char const **endptr)
         }
     } 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;
@@ -793,52 +793,52 @@ getsymbol (const char *s, char const **endptr)
 
             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;
@@ -846,20 +846,20 @@ getsymbol (const char *s, char const **endptr)
         }
     } 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;
@@ -867,7 +867,7 @@ getsymbol (const char *s, char const **endptr)
         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;
@@ -875,7 +875,7 @@ getsymbol (const char *s, char const **endptr)
         rv.precedence = 1;
         rv.eval = evalexpr;
     } else {
-        debug (86,1) ("invalid expr '%s'\n", s);
+        debugs(86, 1, "invalid expr '" << s << "'");
         *endptr = origs;
     }
 
@@ -888,7 +888,7 @@ printliteral (stackmember s)
     switch (s.valuestored) {
 
     case ESI_LITERAL_INVALID:
-        debug (86,1) (" Invalid ");
+        debug(86, 1) ( " Invalid " );
         break;
 
     case ESI_LITERAL_FLOAT:
@@ -900,7 +900,7 @@ printliteral (stackmember s)
         break;
 
     case ESI_LITERAL_INT:
-        debug (86,1) ("%d", s.value.integral);
+        debug (86,1) ("%d", s.value.integral);        
         break;
 
     case ESI_LITERAL_BOOL:
@@ -1001,7 +1001,7 @@ addmember (stackmember * stack, int *stackdepth, stackmember * candidate)
                 /* cleanup candidate and stack */
                 dumpstack (stack, *stackdepth);
                 cleanmember (candidate);
-                debug (86,1) ("invalid expression\n");
+                debugs(86, 1, "invalid expression");
                 return 0;
             }
         } else {
@@ -1035,7 +1035,7 @@ ESIExpression::Evaluate (char const *s)
             s = end;
         } else {
             assert (s == end);
-            debug (86,1) ("failed parsing expression\n");
+            debugs(86, 1, "failed parsing expression");
             PROF_stop(esiExpressionEval);
             return 0;
         }
@@ -1049,7 +1049,7 @@ ESIExpression::Evaluate (char const *s)
         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;
         }
index a550df64284508b0cd4054e573ce4d1ae7b9e0f3..d2e31015fe36970d8ba4e5581c4a749f1b377bce 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -149,7 +149,7 @@ esiBufferRecipient (clientStreamNode *node, ClientHttpRequest *http, HttpReply *
     /* 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);
@@ -173,14 +173,14 @@ esiBufferRecipient (clientStreamNode *node, ClientHttpRequest *http, HttpReply *
     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);
@@ -206,7 +206,7 @@ esiBufferRecipient (clientStreamNode *node, ClientHttpRequest *http, HttpReply *
             /* 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;
@@ -227,7 +227,7 @@ ESIStreamContext::~ESIStreamContext()
 void
 ESIStreamContext::freeResources()
 {
-    debug (86,5)("Freeing stream context resources.\n");
+    debugs(86, 5, "Freeing stream context resources.");
     buffer = NULL;
     localbuffer = NULL;
     include = NULL;
@@ -262,7 +262,7 @@ ESIStreamContextNew (ESIIncludePtr include)
 /* ESIInclude */
 ESIInclude::~ESIInclude()
 {
-    debug (86,5)("ESIInclude::Free %p\n", this);
+    debugs(86, 5, "ESIInclude::Free " << this);
     ESISegmentFreeList (srccontent);
     ESISegmentFreeList (altcontent);
     cbdataReferenceDone (varState);
@@ -335,10 +335,11 @@ ESIInclude::Start (ESIStreamContext::Pointer stream, char const *url, ESIVarStat
     /* 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();
@@ -352,7 +353,8 @@ ESIInclude::ESIInclude (esiTreeParentPtr aParent, int attrcount, char const **at
     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);
@@ -363,7 +365,8 @@ ESIInclude::ESIInclude (esiTreeParentPtr aParent, int attrcount, char const **at
             /* 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);
@@ -373,7 +376,7 @@ ESIInclude::ESIInclude (esiTreeParentPtr aParent, int attrcount, char const **at
                 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
@@ -401,7 +404,7 @@ ESIInclude::start()
     } 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;
     }
@@ -415,7 +418,7 @@ ESIInclude::render(ESISegment::Pointer output)
 
     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));
 
@@ -446,7 +449,7 @@ ESIInclude::process (int dovars)
     /* 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)
@@ -486,24 +489,24 @@ ESIInclude::subRequestDone (ESIStreamContext::Pointer stream, bool success)
         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;
             }
@@ -511,10 +514,10 @@ ESIInclude::subRequestDone (ESIStreamContext::Pointer stream, bool success)
 
         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);
@@ -522,12 +525,12 @@ ESIInclude::subRequestDone (ESIStreamContext::Pointer stream, bool success)
 
             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;
             }
index c9eb54f1b01e1c9a3ca0899a5263eb763f2a9396..936d997f8f2fa93c3ee87ffac7436f0b0b4d330a 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -236,5 +236,5 @@ ESISegment::dumpOne() const
 {
     String temp;
     temp.limitInit(buf, len);
-    debug (86, 9) ("ESISegment::dumpOne: \"%s\"\n", temp.buf());
+    debugs(86, 9, "ESISegment::dumpOne: \"" << temp.buf() << "\"");
 }
index 72af794ca4dbddb076ced27302d24a57c404be3c..3f2222827b6d0faf0e8671eebfd5f2b2d1bed306 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $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
@@ -43,7 +43,7 @@ class esiExcept;
 
 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)
@@ -107,7 +107,7 @@ esiSequence::render(ESISegment::Pointer output)
 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;
 }
@@ -119,9 +119,9 @@ esiSequence::provideData (ESISegment::Pointer data, ESIElement *source)
     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,
@@ -158,15 +158,17 @@ esiSequence::addElement (ESIElement::Pointer element)
 
     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;
@@ -195,7 +197,7 @@ esiSequence::processStep(int dovars)
     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;
     }
 }
@@ -208,8 +210,7 @@ esiSequence::processOne(int dovars, size_t index)
     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 */
@@ -218,17 +219,17 @@ esiSequence::processOne(int dovars, size_t index)
         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;
 
@@ -242,10 +243,11 @@ esiSequence::processOne(int dovars, size_t index)
 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
@@ -259,7 +261,8 @@ esiSequence::process (int inheritedVarsFlag)
     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;
 
@@ -299,7 +302,7 @@ esiSequence::process (int inheritedVarsFlag)
     if (processedcount == elements.size())
         parent = NULL;
 
-    debug (86,5)("esiSequence::process: %p completed\n", this);
+    debugs(86, 5, "esiSequence::process: " << this << " completed");
 
     processing = false;
 
@@ -312,11 +315,11 @@ esiSequence::fail (ESIElement *source, char const *anError)
     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;
@@ -354,31 +357,31 @@ esiSequence::makeUsableElements(esiSequence const &old, ESIVarState &newVarState
 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;
     }
 
index 007719644922c5d203b7a67a65a12b9466acaa9b..c823721231aeb79b69dd6e2aa28d2cdf87426afb 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -139,7 +139,7 @@ ESIVarState::extractList()
     doIt();
     ESISegment::Pointer rv = output;
     output = NULL;
-    debug (86,6)("ESIVarStateExtractList: Extracted list\n");
+    debugs(86, 6, "ESIVarStateExtractList: Extracted list");
     return rv;
 }
 
@@ -155,7 +155,7 @@ ESIVarState::extractChar ()
 
     ESISegmentFreeList (output);
 
-    debug (86,6)("ESIVarStateExtractList: Extracted char\n");
+    debugs(86, 6, "ESIVarStateExtractList: Extracted char");
 
     return rv;
 }
@@ -271,10 +271,10 @@ ESIVariableQuery::ESIVariableQuery(char const *uri) : query (NULL), query_sz (0)
 
     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;
         }
     }
@@ -717,19 +717,19 @@ ESIVariableProcessor::doFunction()
                 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;
             }
@@ -741,11 +741,11 @@ ESIVariableProcessor::doFunction()
             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;
@@ -760,12 +760,12 @@ ESIVariableProcessor::doFunction()
 
             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;
             }
@@ -777,7 +777,7 @@ ESIVariableProcessor::doFunction()
             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;
             }
 
@@ -789,7 +789,7 @@ ESIVariableProcessor::doFunction()
             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);
index d9d718570b7072d9324da962e37a2df227808dc1..346a425eb0c91e11b29047476b54bea1cbc4e015 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -135,13 +135,13 @@ httpHdrCcParseInit(HttpHdrCc * cc, const String * str)
                 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++;
 
@@ -157,7 +157,7 @@ httpHdrCcParseInit(HttpHdrCc * cc, const String * str)
         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);
             }
@@ -167,7 +167,7 @@ httpHdrCcParseInit(HttpHdrCc * cc, const String * str)
         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);
             }
@@ -177,7 +177,7 @@ httpHdrCcParseInit(HttpHdrCc * cc, const String * str)
         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;
             }
 
index e72f11178629d8c0f9b632d1f982e7ee7eec1b3c..ea0647de143ed89091bed6f2b3420926ef6d43af 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -76,7 +76,7 @@ httpHdrRangeRespSpecParseInit(HttpHdrRangeSpec * spec, const char *field, int fl
 
     /* 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;
     }
 
@@ -101,8 +101,8 @@ httpHdrRangeRespSpecParseInit(HttpHdrRangeSpec * spec, const char *field, int fl
 
     /* 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;
     }
 
@@ -155,7 +155,7 @@ httpHdrContRangeParseInit(HttpHdrContRange * range, const char *str)
 {
     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))
@@ -179,9 +179,10 @@ httpHdrContRangeParseInit(HttpHdrContRange * range, const char *str)
     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;
 }
index 7c44a51844ddf55b49748bf1daf77a725a061983..817eab212de02ddff4d461998a3493df6c434f19 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -98,7 +98,7 @@ HttpHdrRangeSpec::parseInit(const char *field, int flen)
     } 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))
@@ -121,7 +121,7 @@ HttpHdrRangeSpec::parseInit(const char *field, int flen)
 
     /* 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;
     }
 
@@ -143,8 +143,9 @@ HttpHdrRangeSpec::packInto(Packer * packer) const
 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
@@ -252,7 +253,7 @@ HttpHdrRange::parseInit(const String * range_spec)
     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))
@@ -592,14 +593,12 @@ HttpHdrRangeIter::updateSpec()
 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;
 }
index f112785c4a73e7c09c480c39192d4240dbb2b50a..abf1f4c19dd2dfb74ba58fdbd875ec5358ba0e60 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -139,7 +139,7 @@ httpHdrScParseInit(HttpHdrSc * sc, const String * str)
                                   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;
         }
 
@@ -163,7 +163,7 @@ httpHdrScParseInit(HttpHdrSc * sc, const String * str)
 
         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++;
 
@@ -179,14 +179,14 @@ httpHdrScParseInit(HttpHdrSc * sc, const String * str)
         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 */
                 }
@@ -196,7 +196,7 @@ httpHdrScParseInit(HttpHdrSc * sc, const String * str)
         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);
             }
index b7e6a8508caad7e366e3814b7d485980d50faa22..0726d46b4cf08abe250c400edc284f1b1462915d 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -600,8 +600,9 @@ HttpHeader::parse(const char *header_start, const char *header_end)
         }
 
         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;
@@ -1363,7 +1364,7 @@ HttpHeaderEntry::HttpHeaderEntry(http_hdr_type anId, const char *aName, const ch
 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)
@@ -1402,8 +1403,8 @@ HttpHeaderEntry::parse(const char *field_start, const char *field_end)
     }
 
     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--;
@@ -1414,7 +1415,7 @@ HttpHeaderEntry::parse(const char *field_start, const char *field_end)
 
     /* 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);
@@ -1443,8 +1444,7 @@ HttpHeaderEntry::parse(const char *field_start, const char *field_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();
@@ -1459,7 +1459,7 @@ HttpHeaderEntry::parse(const char *field_start, const char *field_end)
 
     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());
 }
@@ -1501,8 +1501,7 @@ httpHeaderNoteParsedEntry(http_hdr_type id, String const &context, int error)
 
     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() << "'");
     }
 }
 
index 46c7fd991c3cff62fa90ed6f629cce0c0fe81429..b15563f9a05f4edf5e301869cf4cfff8d473379e 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -325,7 +325,7 @@ httpHeaderParseInt(const char *start, int *value)
     *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;
     }
 
@@ -358,7 +358,7 @@ httpHeaderParseQuotedString (const char *start, String *val)
 
     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;
         }
 
index 3cdd4baa8fb5a50586aa4b86aa94049c6717b563..98bbd73bf8a09674a95307498aca213c4a32f860 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -400,7 +400,7 @@ HttpParserInit(HttpParser *hdr, const char *buf, int bufsiz)
        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
@@ -466,7 +466,7 @@ HttpParserParseReqLine(HttpParser *hmsg)
        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) */
@@ -612,11 +612,12 @@ finish:
        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;
 }
 
index 94dbd814f23f64cee490d4e2693d4b929dd7858e..f8808524645be167ba1d59d80fc6c6bea67c3a85 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -155,7 +155,7 @@ HttpRequest::sanityCheckStartLine(MemBuf *buf, http_status *error)
      */
 
     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;
     }
 
@@ -184,7 +184,7 @@ HttpRequest::parseFirstLine(const char *start, const char *end)
         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 {
@@ -305,14 +305,14 @@ request_flags::resetTCP() const
 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;
 }
 
index 320aa9a054e871d71808c9f497825c22fa28d355..6a96122171f405edc2f6f48d453a2b6da012c572 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -144,7 +144,7 @@ HttpRequestMethod::AddExtension(const char *mstr)
 
     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;
         }
 
@@ -154,12 +154,12 @@ HttpRequestMethod::AddExtension(const char *mstr)
         /* 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
index 098cf0fc3799ca65bba12b9777b735a6dbde3765..ece16fe69c7379122ac46f944275d335355b64e1 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -69,7 +69,7 @@ void
 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));
@@ -99,7 +99,7 @@ httpStatusLineParse(HttpStatusLine * sline, const String &protoPrefix, const cha
         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, ' ')))
@@ -285,7 +285,7 @@ httpStatusString(http_status status)
 
     default:
         p = "Unknown";
-        debug(57, 3) ("Unknown HTTP status code: %d\n", status);
+        debugs(57, 3, "Unknown HTTP status code: " << status);
         break;
     }
 
index bbf1ff14381ea187a3c755bf5d75d47b8cb60dd1..940b831cdac691be9ff28cb19f0d617966852e90 100644 (file)
@@ -30,16 +30,16 @@ icapclientProcessStream(clientStreamNode *thisNode, clientHttpRequest *http, Htt
     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;
@@ -54,7 +54,7 @@ icapclientProcessStream(clientStreamNode *thisNode, clientHttpRequest *http, Htt
 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();
@@ -65,13 +65,13 @@ icapclientStreamRead(clientStreamNode *thisNode, clientHttpRequest *http)
 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);
@@ -82,7 +82,7 @@ icapclientStreamStatus(clientStreamNode *thisNode, clientHttpRequest *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;
 
index e4fd192bd0ea7111a77f3900cf667983e23b86c5..60a066ea70e5faa0624982afd04ffa4b3909c830 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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/
  * ----------------------------------------------------------
@@ -129,9 +129,7 @@ ICAPAccessCheck::ICAPAccessCheck(ICAP::Method aMethod,
 
     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()
@@ -147,7 +145,7 @@ 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) {
@@ -161,7 +159,7 @@ ICAPAccessCheck::check()
         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;
         }
     }
@@ -193,7 +191,7 @@ ICAPAccessCheck::checkCandidates()
      * 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();
 
@@ -205,12 +203,11 @@ ICAPAccessCheck::checkCandidates()
 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) {
@@ -232,7 +229,7 @@ ICAPAccessCheck::ICAPAccessCheckCallbackWrapper(int answer, void *data)
 void
 ICAPAccessCheck::ICAPAccessCheckCallbackEvent(void *data)
 {
-    debug(93,5)("ICAPAccessCheckCallbackEvent\n");
+    debugs(93, 5, "ICAPAccessCheckCallbackEvent");
     ICAPAccessCheck *ac = (ICAPAccessCheck*)data;
     ac->do_callback();
     delete ac;
@@ -241,10 +238,10 @@ ICAPAccessCheck::ICAPAccessCheckCallbackEvent(void *data)
 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;
index 343d26583486fbd6c1ae55069ff1ec87ba30c969..3bca3eba1d15686ba579fe6607e55106a6c78c16 100644 (file)
@@ -965,7 +965,7 @@ void ICAPModXact::swanSong()
     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);
     }
index a748ff9250422e4db0ce3076544d84056b4c3ef7..a84d3fcb670b02f3d29827f62d2c9fabc21b14fc 100644 (file)
@@ -84,15 +84,15 @@ ICAPServiceRep::configure(Pointer &aSelf)
     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;
     }
 
@@ -147,7 +147,7 @@ ICAPServiceRep::configure(Pointer &aSelf)
     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);
index 4c523f6bc2b683a79e9b4e94b7d36f17e242adda..aae334757e414940c8147bc96ff099bbf02502f3 100644 (file)
@@ -145,7 +145,7 @@ void ICAPXaction::openConnection()
 void
 ICAPXaction::reusedConnection(void *data)
 {
-    debug(93,5)("ICAPXaction::reusedConnection\n");
+    debugs(93, 5, "ICAPXaction::reusedConnection");
     ICAPXaction *x = (ICAPXaction*)data;
     x->noteCommConnected(COMM_OK);
 }
index 83c57f05676d3a01107f4b71fc904d305d8daa19..564d2aca94e751d22898d054952509f5c5834147 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -139,8 +139,7 @@ clientNatLookup(int fd, struct sockaddr_in me, struct sockaddr_in peer, struct s
     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;
         }
@@ -172,7 +171,7 @@ clientNatLookup(int fd, struct sockaddr_in me, struct sockaddr_in peer, struct s
     {
         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;
             }
 
@@ -206,14 +205,14 @@ clientNatLookup(int fd, struct sockaddr_in me, struct sockaddr_in peer, struct s
     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;
@@ -237,8 +236,7 @@ clientNatLookup(int fd, struct sockaddr_in me, struct sockaddr_in peer, struct s
     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;
         }
 
@@ -261,7 +259,7 @@ clientNatLookup(int fd, struct sockaddr_in me, struct sockaddr_in peer, struct s
     {
         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;
             }
 
@@ -289,7 +287,7 @@ int
 
 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;
 }
 
index f4bcb8b2133ce51d00dcb1147a66ea2c650689e1..4ccbcf566108392a72dca9851dd3ef09d3bc2c5e 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -56,7 +56,7 @@ LeakFinderPtr::LeakFinderPtr(void *p , const char *f, const int l) :
 
 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
@@ -131,15 +131,15 @@ LeakFinder::dump()
 
     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);
     }
 }
 
index 04fe0418f4ce818bed96c06771650050ffac8928..8c516c59620db2a984b8a9caa87590d7ddd04a63 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -138,7 +138,7 @@ void
 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);
@@ -159,26 +159,16 @@ MemObject::dump() const
     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 *
@@ -383,8 +373,7 @@ MemObject::isContiguous() 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;
 }
 
index 2a390adcf0dfd86dd26ed631d52a5632274c0e8c..e1b7f31ec819dae93d63d8c034bd54b6833df2d4 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $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
@@ -226,8 +226,7 @@ ServerStateData::sentRequestBodyWrapper(int fd, char *bufnotused, size_t size, c
 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;
@@ -247,7 +246,7 @@ ServerStateData::sentRequestBody(int fd, size_t size, comm_err_t errflag)
     }
 
     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;
@@ -300,13 +299,13 @@ ServerStateData::haveParsedReplyHeaders()
 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;
     }
 
index 09c894780ec72bf8dca578e89e17f0f09566657a..3e82bff123e4600382e7c8110ae8b7470818a800 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -107,25 +107,24 @@ statHistCopy(StatHist * Dest, const StatHist * Orig)
 {
     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));
 }
 
index 5cdb0cd9a15a5168fd4bd7faa4177ad56d3a4bbf..89286ac81e8797e9b22d543bdd5b2be3f054ee2e 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -48,7 +48,7 @@ StoreMeta::validType(char type)
     /* 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;
     }
 
@@ -57,7 +57,7 @@ StoreMeta::validType(char type)
             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;
     }
 
@@ -97,7 +97,7 @@ bool
 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;
     }
 
@@ -132,7 +132,7 @@ StoreMeta::Factory (char type, size_t len, void const *value)
         break;
 
     default:
-        debug (20,0)("Attempt to create unknown concrete StoreMeta\n");
+        debugs(20, 0, "Attempt to create unknown concrete StoreMeta");
         return NULL;
     }
 
@@ -184,7 +184,7 @@ StoreMeta::checkConsistency(StoreEntry *e) const
         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;
     }
 
index cda254811476298b624088882ac5e72d2ac4fcdd..3bc3a4d7fe019bb30ee6b98bc50255572fe3bb6b 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -54,13 +54,12 @@ StoreMetaMD5::checkConsistency(StoreEntry *e) const
 
     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;
     }
index 36f7421e46f6adab68c2f872903ffe5ad5b87600..d5af3b2790e750dc7b28fda878bb008f3dbf3bab 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -47,8 +47,8 @@ StoreMetaURL::checkConsistency(StoreEntry *e) const
         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;
     }
 
index 9456a6815383e26040eac237dac8dcfddbb45458..c6ce4552b340487484d1ff21ab7bcd477975572a 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -91,9 +91,8 @@ StoreMetaUnpacker::doOneEntry()
     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;
     }
 
index 0f2c8c07fe95af03aa9b0822f305b73e4d73879b..8fff7c4482ce3648bf9ef75d1b7943af739c1d05 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -195,8 +195,7 @@ SwapDir::parseOptions(int reconfiguring)
 
     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"));
         }
     }
 }
@@ -249,7 +248,7 @@ SwapDir::optionMaxSizeParse(char const *option, const char *value, int reconfigu
     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;
 
index bf94b3be8840a41384ad362d78ca6ab79167e222..1d2fab2e024f1b5286f1d798e258f4349dd49070 100755 (executable)
@@ -1,6 +1,6 @@
 
 /*
- * $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>
@@ -560,10 +560,10 @@ WIN32_svcHandler(DWORD Opcode)
 
         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:
@@ -571,7 +571,7 @@ WIN32_svcHandler(DWORD Opcode)
 
         if (!SetServiceStatus(svcHandle, &svcStatus)) {
             status = GetLastError();
-            debug(1, 1) ("SetServiceStatus error %ld\n", status);
+            debugs(1, 1, "SetServiceStatus error " << status);
         }
 
         break;
@@ -598,14 +598,14 @@ WIN32_svcHandler(DWORD Opcode)
 
         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;
index f315f5d4739fb9302cf90026dfcf11c87cbd76c9..8402234f3df3f258b140df6e344eddb662f71313 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -1098,7 +1098,7 @@ accessLogParseLogFormat(logformat_token ** fmt, char *def)
     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.
@@ -1126,10 +1126,10 @@ accessLogDumpLogFormat(StoreEntry * entry, const char *name, logformat * definit
     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) {
@@ -1573,8 +1573,7 @@ accessLogInit(void)
         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);
 
index 3391156784700b585b0edeec46a81437b81dd508..6118346ab5758c8165bca4ce513e384111ca490b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $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
@@ -57,13 +57,13 @@ ACL *
 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;
 }
@@ -98,13 +98,14 @@ ACL::ParseAclLine(ConfigParser &parser, ACL ** head)
     /* 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;
     }
@@ -114,31 +115,31 @@ ACL::ParseAclLine(ConfigParser &parser, ACL ** head)
     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;
     }
 
@@ -160,8 +161,7 @@ ACL::ParseAclLine(ConfigParser &parser, ACL ** head)
         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()) {
@@ -226,7 +226,7 @@ ACL::cacheMatchAcl(dlink_list * cache, ACLChecklist *checklist)
         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;
         }
 
@@ -237,7 +237,7 @@ ACL::cacheMatchAcl(dlink_list * cache, ACLChecklist *checklist)
     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;
 }
 
@@ -248,7 +248,7 @@ aclCacheMatchFlush(dlink_list * cache)
     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;
@@ -277,22 +277,18 @@ ACL::checklistMatches(ACLChecklist *checklist)
     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;
 }
 
@@ -301,15 +297,14 @@ ACLList::matches (ACLChecklist *checklist) const
 {
     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);
 }
 
@@ -320,7 +315,7 @@ ACLList::matches (ACLChecklist *checklist) const
 
 ACL::~ACL()
 {
-    debug(28, 3) ("ACL::~ACL: '%s'\n", cfgline);
+    debugs(28, 3, "ACL::~ACL: '" << cfgline << "'");
     safe_free(cfgline);
 }
 
@@ -331,25 +326,25 @@ acl_access::containsPURGE() const
     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;
 }
 
@@ -385,15 +380,15 @@ void *ACL::Prototype::Initialized;
 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;
 }
 
@@ -415,19 +410,19 @@ ACL::Prototype::registerMe ()
 
 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;
 }
@@ -436,7 +431,7 @@ void
 ACL::Initialize()
 {
     ACL *a = Config.aclList;
-    debug(53, 3) ("ACL::Initialize\n");
+    debugs(53, 3, "ACL::Initialize");
 
     while (a) {
         a->prepareForUse();
index e455b89881a2d8da87923d74c70a3eb35fa1a91d..9ae96cabd194cdbca7f568d60588b65484d680a9 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $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
@@ -52,28 +52,27 @@ aclGetDenyInfoPage(acl_deny_info_list ** head, const char *name, int redirect_al
 {
     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;
 }
 
@@ -81,7 +80,7 @@ aclGetDenyInfoPage(acl_deny_info_list ** head, const char *name, int redirect_al
 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;
@@ -89,11 +88,11 @@ aclIsProxyAuth(const char *name)
     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;
 }
 
@@ -120,9 +119,8 @@ aclParseDenyInfoLine(acl_deny_info_list ** head)
     /* 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;
     }
 
@@ -141,9 +139,8 @@ aclParseDenyInfoLine(acl_deny_info_list ** head)
     }
 
     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;
     }
@@ -165,9 +162,8 @@ aclParseAccessLine(ConfigParser &parser, acl_access ** head)
     /* 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;
     }
 
@@ -178,9 +174,8 @@ aclParseAccessLine(ConfigParser &parser, acl_access ** head)
     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;
     }
@@ -188,9 +183,8 @@ aclParseAccessLine(ConfigParser &parser, acl_access ** head)
     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;
     }
@@ -224,11 +218,11 @@ aclParseAclList(ConfigParser &parser, acl_list ** head)
             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;
@@ -251,7 +245,7 @@ aclDestroyAcls(ACL ** head)
 {
     ACL *next = NULL;
 
-    debug(28,8)("aclDestroyACLs: invoked\n");
+    debugs(28, 8, "aclDestroyACLs: invoked");
 
     for (ACL *a = *head; a; a = next) {
         next = a->next;
@@ -265,7 +259,7 @@ void
 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;
@@ -280,7 +274,7 @@ aclDestroyAccessList(acl_access ** list)
     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);
@@ -301,7 +295,7 @@ aclDestroyDenyInfoList(acl_deny_info_list ** list)
     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) {
index 59e5065c21cf3b6cdb9a4d4353bd66a529ff4c7d..fe1bb199935aa1cedcba574c335ea7f969f62bec 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -143,7 +143,7 @@ asnMatchIp(List<int> *data, struct IN_ADDR addr)
     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;
@@ -159,22 +159,22 @@ asnMatchIp(List<int> *data, struct IN_ADDR addr)
     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;
 }
 
@@ -237,7 +237,7 @@ asnCacheStart(int as)
     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);
@@ -277,8 +277,8 @@ asHandleReply(void *data, StoreIOBuffer result)
     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 */
 
@@ -288,16 +288,15 @@ asHandleReply(void *data, StoreIOBuffer result)
     }
 
     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;
     }
@@ -323,7 +322,7 @@ asHandleReply(void *data, StoreIOBuffer result)
         }
 
         *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;
@@ -351,10 +350,10 @@ asHandleReply(void *data, StoreIOBuffer result)
 
     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);
@@ -365,7 +364,7 @@ asHandleReply(void *data, StoreIOBuffer result)
                         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;
@@ -381,7 +380,7 @@ static void
 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);
@@ -411,7 +410,7 @@ asnAddNet(char *as_string, int as_number)
     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;
     }
 
@@ -438,7 +437,7 @@ asnAddNet(char *as_string, int as_number)
     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));
 
@@ -454,10 +453,9 @@ asnAddNet(char *as_string, int as_number)
         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)
 
@@ -482,7 +480,7 @@ asnAddNet(char *as_string, int as_number)
         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;
     }
 
@@ -503,7 +501,7 @@ destroyRadixNode(struct squid_radix_node *rn, void *w)
         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);
 
@@ -679,8 +677,7 @@ ACLDestinationASNStrategy::match (ACLData<MatchType> * &data, ACLChecklist *chec
     } 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);
index 155299c61a8f2e1feccf2b34a585f2e8daa99be7..303bc3092e397496723d0258770931be829a67ba 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $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
@@ -93,7 +93,7 @@ basicScheme::done()
     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
@@ -107,11 +107,11 @@ AuthBasicConfig::configured() const
 {
     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;
 }
 
@@ -134,7 +134,7 @@ BasicUser::authenticated() const
     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;
 }
@@ -167,13 +167,12 @@ AuthBasicUserRequest::authenticate(HttpRequest * request, ConnStateData::Pointer
 
     /* 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 */
@@ -215,7 +214,7 @@ void
 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);
     }
 }
@@ -246,7 +245,7 @@ authenticateBasicHandleReply(void *data, char *reply)
     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, ' ')))
@@ -340,7 +339,7 @@ AuthBasicConfig::parse(AuthConfig * scheme, int n_configured, char *param_str)
     } 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 << "'");
     }
 }
 
@@ -357,7 +356,7 @@ static auth_user_t *
 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) {
@@ -400,11 +399,10 @@ BasicUser::decodeCleartext()
      * 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;
     }
@@ -432,13 +430,11 @@ BasicUser::extractPassword()
     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.");
     }
@@ -477,7 +473,7 @@ BasicUser::makeLoggingInstance(AuthBasicUserRequest *auth_user_request)
 {
     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);
@@ -495,7 +491,7 @@ AuthUser *
 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());
@@ -517,10 +513,10 @@ BasicUser::makeCachedFrom()
 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;
@@ -528,7 +524,7 @@ BasicUser::updateCached(BasicUser *from)
     }
 
     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;
     }
 }
@@ -640,8 +636,7 @@ AuthBasicUserRequest::module_start(RH * handler, void *data)
     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);
index d5e8bbf58e59328eaafad54913cead4a13f31acc..898bfaa1c25a1d844907e08f78b5a41ca8f4cbb1 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -173,7 +173,7 @@ authenticateDigestNonceNew(void)
     /* 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;
 }
 
@@ -219,7 +219,7 @@ authenticateDigestNonceShutdown(void)
     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)))) {
@@ -235,7 +235,7 @@ authenticateDigestNonceShutdown(void)
     }
 
 #endif
-    debug(29, 2) ("authenticateDigestNonceShutdown: Nonce cache shutdown\n");
+    debugs(29, 2, "authenticateDigestNonceShutdown: Nonce cache shutdown");
 }
 
 static void
@@ -252,17 +252,16 @@ authenticateDigestNonceCacheCleanup(void *data)
      * 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;
@@ -272,7 +271,7 @@ authenticateDigestNonceCacheCleanup(void *data)
         }
     }
 
-    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);
@@ -283,7 +282,7 @@ authDigestNonceLink(digest_nonce_h * nonce)
 {
     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
@@ -306,10 +305,10 @@ authDigestNonceUnlink(digest_nonce_h * nonce)
     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);
@@ -332,14 +331,14 @@ authenticateDigestNonceFindNonce(const char *nonceb64)
     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;
 }
@@ -357,7 +356,7 @@ authDigestNonceIsValid(digest_nonce_h * nonce, char nc[9])
 
     /* 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;
     }
 
@@ -369,7 +368,7 @@ authDigestNonceIsValid(digest_nonce_h * nonce, char nc[9])
 
     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;
     }
@@ -393,19 +392,23 @@ authDigestNonceIsStale(digest_nonce_h * nonce)
 
     /* 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;
     }
@@ -422,12 +425,12 @@ authDigestNonceLastRequest(digest_nonce_h * nonce)
         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;
     }
 
@@ -458,7 +461,7 @@ authDigestUserFindUsername(const char *username)
 {
     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) &&
@@ -518,14 +521,14 @@ digestScheme::done()
 
     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) {
@@ -614,8 +617,7 @@ AuthDigestUserRequest::authenticate(HttpRequest * request, ConnStateData::Pointe
                        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) {
@@ -652,7 +654,11 @@ AuthDigestUserRequest::authenticate(HttpRequest * request, ConnStateData::Pointe
                 }
 
                 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;
                 }
             }
@@ -664,8 +670,7 @@ AuthDigestUserRequest::authenticate(HttpRequest * request, ConnStateData::Pointe
 
         /* 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");
@@ -676,8 +681,7 @@ AuthDigestUserRequest::authenticate(HttpRequest * request, ConnStateData::Pointe
     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 */
@@ -735,7 +739,7 @@ AuthDigestUserRequest::addHeader(HttpReply * rep, int accel)
 
     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));
     }
 }
@@ -763,7 +767,7 @@ AuthDigestUserRequest::addTrailer(HttpReply * rep, int accel)
     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));
     }
 }
@@ -790,7 +794,10 @@ AuthDigestConfig::fixHeader(auth_user_request_t *auth_user_request, HttpReply *r
     /* 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");
@@ -821,7 +828,7 @@ authenticateDigestHandleReply(void *data, char *reply)
     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, ' ')))
@@ -944,7 +951,7 @@ AuthDigestConfig::parse(AuthConfig * scheme, int n_configured, char *param_str)
     } 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 << "'");
     }
 }
 
@@ -1045,7 +1052,7 @@ authDigestLogUsername(char *username)
     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);
@@ -1072,7 +1079,7 @@ AuthDigestConfig::decode(char const *proxy_auth)
     digest_nonce_h *nonce;
     int ilen;
 
-    debug(29, 9) ("authenticateDigestDecodeAuth: beginning\n");
+    debugs(29, 9, "authenticateDigestDecodeAuth: beginning");
 
     AuthDigestUserRequest *digest_request = new AuthDigestUserRequest();
 
@@ -1102,7 +1109,7 @@ AuthDigestConfig::decode(char const *proxy_auth)
 
             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 */
 
@@ -1114,7 +1121,7 @@ AuthDigestConfig::decode(char const *proxy_auth)
 
             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 */
 
@@ -1127,7 +1134,7 @@ AuthDigestConfig::decode(char const *proxy_auth)
 
             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 */
 
@@ -1140,7 +1147,7 @@ AuthDigestConfig::decode(char const *proxy_auth)
 
             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 */
 
@@ -1152,7 +1159,7 @@ AuthDigestConfig::decode(char const *proxy_auth)
 
             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 */
 
@@ -1164,7 +1171,7 @@ AuthDigestConfig::decode(char const *proxy_auth)
 
             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 */
 
@@ -1173,7 +1180,7 @@ AuthDigestConfig::decode(char const *proxy_auth)
 
             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 */
 
@@ -1185,7 +1192,7 @@ AuthDigestConfig::decode(char const *proxy_auth)
 
             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 */
 
@@ -1197,7 +1204,7 @@ AuthDigestConfig::decode(char const *proxy_auth)
 
             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 << "'");
         }
     }
 
@@ -1218,7 +1225,7 @@ AuthDigestConfig::decode(char const *proxy_auth)
     /* 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);
     }
@@ -1228,7 +1235,7 @@ AuthDigestConfig::decode(char const *proxy_auth)
 
     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);
     }
@@ -1241,7 +1248,7 @@ AuthDigestConfig::decode(char const *proxy_auth)
 
     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);
     }
@@ -1252,21 +1259,21 @@ AuthDigestConfig::decode(char const *proxy_auth)
     /* 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);
     }
@@ -1274,7 +1281,7 @@ AuthDigestConfig::decode(char const *proxy_auth)
     /* 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);
     }
@@ -1284,7 +1291,7 @@ AuthDigestConfig::decode(char const *proxy_auth)
         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);
     }
@@ -1301,7 +1308,7 @@ AuthDigestConfig::decode(char const *proxy_auth)
 
     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;
@@ -1321,7 +1328,7 @@ AuthDigestConfig::decode(char const *proxy_auth)
          */
         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);
     }
@@ -1335,11 +1342,13 @@ AuthDigestConfig::decode(char const *proxy_auth)
 
     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;
 }
@@ -1353,8 +1362,7 @@ AuthDigestUserRequest::module_start(RH * handler, void *data)
     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);
index 2a80ff18a2259ee8dd89214705462d1b71589453..353b838494f159f7fe936d44678a9262cacbec5a 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -85,7 +85,7 @@ void
 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);
@@ -100,7 +100,7 @@ negotiateScheme::done()
 
     negotiateauthenticators = NULL;
 
-    debug(29, 2) ("negotiateScheme::done: Negotiate authentication Shutdown.\n");
+    debugs(29, 2, "negotiateScheme::done: Negotiate authentication Shutdown.");
 }
 
 /* free any allocated configuration details */
@@ -146,7 +146,7 @@ AuthNegotiateConfig::parse(AuthConfig * scheme, int n_configured, char *param_st
     } 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 << "'");
     }
 
     /*
@@ -213,11 +213,11 @@ bool
 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;
 }
 
@@ -236,7 +236,7 @@ AuthNegotiateUserRequest::module_direction()
         /* 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:
@@ -254,7 +254,7 @@ AuthNegotiateUserRequest::module_direction()
         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;
     }
 
@@ -296,7 +296,7 @@ AuthNegotiateConfig::fixHeader(auth_user_request_t *auth_user_request, HttpReply
 
     /* 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) {
@@ -323,11 +323,11 @@ AuthNegotiateConfig::fixHeader(auth_user_request_t *auth_user_request, HttpReply
              */
 
             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");
             }
 
@@ -336,13 +336,13 @@ AuthNegotiateConfig::fixHeader(auth_user_request_t *auth_user_request, HttpReply
         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);
@@ -350,7 +350,7 @@ AuthNegotiateConfig::fixHeader(auth_user_request_t *auth_user_request, HttpReply
 
 
         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");
         }
     }
@@ -358,7 +358,7 @@ AuthNegotiateConfig::fixHeader(auth_user_request_t *auth_user_request, HttpReply
 
 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
@@ -375,19 +375,19 @@ authenticateNegotiateHandleReply(void *data, void *lastserver, char *reply)
     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";
     }
 
@@ -433,7 +433,7 @@ authenticateNegotiateHandleReply(void *data, void *lastserver, char *reply)
 
         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) {
@@ -456,7 +456,7 @@ authenticateNegotiateHandleReply(void *data, void *lastserver, char *reply)
 
         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.) */
 
@@ -475,7 +475,7 @@ authenticateNegotiateHandleReply(void *data, void *lastserver, char *reply)
 
         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
@@ -487,7 +487,7 @@ authenticateNegotiateHandleReply(void *data, void *lastserver, char *reply)
         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);
@@ -496,7 +496,7 @@ authenticateNegotiateHandleReply(void *data, void *lastserver, char *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;
 }
 
@@ -524,10 +524,10 @@ AuthNegotiateUserRequest::module_start(RH * handler, void *data)
 
     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;
     }
@@ -559,7 +559,7 @@ authenticateNegotiateReleaseServer(auth_user_request_t * auth_user_request)
     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
@@ -574,10 +574,10 @@ AuthNegotiateUserRequest::onConnectionClose(ConnStateData *connection)
 {
     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;
     }
 
@@ -585,7 +585,7 @@ AuthNegotiateUserRequest::onConnectionClose(ConnStateData *connection)
         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
@@ -611,7 +611,7 @@ AuthNegotiateConfig::decode(char const *proxy_auth)
     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;
 }
 
@@ -619,11 +619,11 @@ int
 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;
 }
@@ -651,17 +651,17 @@ AuthNegotiateUserRequest::authenticate(HttpRequest * request, ConnStateData::Poi
 
     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;
     }
 
@@ -684,7 +684,7 @@ AuthNegotiateUserRequest::authenticate(HttpRequest * request, ConnStateData::Poi
 
     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);
@@ -700,7 +700,7 @@ AuthNegotiateUserRequest::authenticate(HttpRequest * request, ConnStateData::Poi
         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;
 
@@ -720,7 +720,7 @@ AuthNegotiateUserRequest::authenticate(HttpRequest * request, ConnStateData::Poi
 
     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 */
@@ -762,7 +762,7 @@ AuthNegotiateUserRequest::authenticate(HttpRequest * request, ConnStateData::Poi
 
     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;
 
@@ -788,7 +788,7 @@ AuthNegotiateUserRequest::~AuthNegotiateUserRequest()
     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;
     }
index 43188a2a49cdfeaf01fd3c4e41f53326ba6233f5..8685c86551174d4d762769887ab1f58bd413addf 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -85,7 +85,7 @@ void
 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);
@@ -100,7 +100,7 @@ ntlmScheme::done()
 
     ntlmauthenticators = NULL;
 
-    debug(29, 2) ("ntlmScheme::done: NTLM authentication Shutdown.\n");
+    debugs(29, 2, "ntlmScheme::done: NTLM authentication Shutdown.");
 }
 
 /* free any allocated configuration details */
@@ -146,7 +146,7 @@ AuthNTLMConfig::parse(AuthConfig * scheme, int n_configured, char *param_str)
     } 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 << "'");
     }
 
     /*
@@ -214,11 +214,11 @@ bool
 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;
 }
 
@@ -237,7 +237,7 @@ AuthNTLMUserRequest::module_direction()
         /* 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:
@@ -255,7 +255,7 @@ AuthNTLMUserRequest::module_direction()
         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;
     }
 
@@ -272,7 +272,7 @@ AuthNTLMConfig::fixHeader(auth_user_request_t *auth_user_request, HttpReply *rep
 
     /* 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) {
@@ -302,13 +302,13 @@ AuthNTLMConfig::fixHeader(auth_user_request_t *auth_user_request, HttpReply *rep
         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);
@@ -316,7 +316,7 @@ AuthNTLMConfig::fixHeader(auth_user_request_t *auth_user_request, HttpReply *rep
 
 
         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");
         }
     }
@@ -324,7 +324,7 @@ AuthNTLMConfig::fixHeader(auth_user_request_t *auth_user_request, HttpReply *rep
 
 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
@@ -341,19 +341,19 @@ authenticateNTLMHandleReply(void *data, void *lastserver, char *reply)
     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";
     }
 
@@ -387,7 +387,7 @@ authenticateNTLMHandleReply(void *data, void *lastserver, char *reply)
         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 */
@@ -398,7 +398,7 @@ authenticateNTLMHandleReply(void *data, void *lastserver, char *reply)
         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);
@@ -406,7 +406,7 @@ authenticateNTLMHandleReply(void *data, void *lastserver, char *reply)
         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
@@ -418,7 +418,7 @@ authenticateNTLMHandleReply(void *data, void *lastserver, char *reply)
         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);
@@ -427,7 +427,7 @@ authenticateNTLMHandleReply(void *data, void *lastserver, char *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;
 }
 
@@ -455,10 +455,10 @@ AuthNTLMUserRequest::module_start(RH * handler, void *data)
 
     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;
     }
@@ -490,7 +490,7 @@ authenticateNTLMReleaseServer(auth_user_request_t * auth_user_request)
     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
@@ -505,10 +505,10 @@ AuthNTLMUserRequest::onConnectionClose(ConnStateData *connection)
 {
     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;
     }
 
@@ -516,7 +516,7 @@ AuthNTLMUserRequest::onConnectionClose(ConnStateData *connection)
         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
@@ -542,7 +542,7 @@ AuthNTLMConfig::decode(char const *proxy_auth)
     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;
 }
 
@@ -550,11 +550,11 @@ int
 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;
 }
@@ -582,17 +582,17 @@ AuthNTLMUserRequest::authenticate(HttpRequest * request, ConnStateData::Pointer
 
     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;
     }
 
@@ -615,7 +615,7 @@ AuthNTLMUserRequest::authenticate(HttpRequest * request, ConnStateData::Pointer
 
     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);
@@ -631,7 +631,7 @@ AuthNTLMUserRequest::authenticate(HttpRequest * request, ConnStateData::Pointer
         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;
 
@@ -651,7 +651,7 @@ AuthNTLMUserRequest::authenticate(HttpRequest * request, ConnStateData::Pointer
 
     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 */
@@ -693,7 +693,7 @@ AuthNTLMUserRequest::authenticate(HttpRequest * request, ConnStateData::Pointer
 
     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;
 
@@ -719,7 +719,7 @@ AuthNTLMUserRequest::~AuthNTLMUserRequest()
     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;
     }
index 8343eb0a2cc789a4bacc0f9c2c1c99f5ba640f15..741ed3f0d8045a0118cbbf69f314b69df3d53fc2 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -58,7 +58,7 @@ authenticateActiveSchemeCount(void)
         if ((*i)->configured())
             ++rv;
 
-    debug(29, 9) ("authenticateActiveSchemeCount: %d active.\n", rv);
+    debugs(29, 9, "authenticateActiveSchemeCount: " << rv << " active.");
 
     return rv;
 }
@@ -68,7 +68,7 @@ authenticateSchemeCount(void)
 {
     int rv = AuthScheme::Schemes().size();
 
-    debug(29, 9) ("authenticateSchemeCount: %d active.\n", rv);
+    debugs(29, 9, "authenticateSchemeCount: " << rv << " active.");
 
     return rv;
 }
@@ -101,7 +101,7 @@ authenticateRegisterWithCacheManager(authConfig * config, CacheManager & manager
 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) {
@@ -137,12 +137,12 @@ authenticateUserCacheRestart(void)
 {
     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());
     }
 
 }
@@ -156,7 +156,7 @@ AuthUserHashPointer::removeFromCache(void *usernamehash_p)
     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();
 
index ba00d94fb634ef881d6e139d9d7c251aa157e6af..a68ec06f93cd3b9f77cd38cf5bd48e7585e370f4 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -294,18 +294,16 @@ parseConfigFile(const char *file_name, CacheManager & manager)
         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++;
         }
 
@@ -364,7 +362,7 @@ configDoConfigure(void)
         (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;
@@ -428,7 +426,7 @@ configDoConfigure(void)
         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;
     }
 
@@ -459,7 +457,7 @@ configDoConfigure(void)
             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;
         }
@@ -469,7 +467,7 @@ configDoConfigure(void)
             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;
         }
@@ -479,7 +477,7 @@ configDoConfigure(void)
             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;
         }
@@ -489,7 +487,7 @@ configDoConfigure(void)
             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;
         }
@@ -499,7 +497,7 @@ configDoConfigure(void)
             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;
         }
@@ -509,7 +507,7 @@ configDoConfigure(void)
             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;
         }
@@ -519,7 +517,7 @@ configDoConfigure(void)
             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;
         }
@@ -529,7 +527,7 @@ configDoConfigure(void)
             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;
         }
@@ -541,7 +539,7 @@ configDoConfigure(void)
 #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
 
@@ -603,7 +601,7 @@ configDoConfigure(void)
     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);
 
@@ -613,7 +611,7 @@ configDoConfigure(void)
 
         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);
             }
         }
@@ -624,7 +622,10 @@ configDoConfigure(void)
         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);
         }
     }
@@ -655,8 +656,9 @@ parseTimeLine(time_t * tptr, const char *units)
     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();
 
@@ -693,7 +695,7 @@ parseTimeUnits(const char *unit)
     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;
 }
@@ -724,8 +726,9 @@ parseBytesLine(size_t * bptr, const char *units)
     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();
 
@@ -750,7 +753,7 @@ parseBytesUnits(const char *unit)
     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;
 }
@@ -766,7 +769,7 @@ dump_acl(StoreEntry * entry, const char *name, ACL * ae)
     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,
@@ -774,7 +777,7 @@ dump_acl(StoreEntry * entry, const char *name, ACL * ae)
         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;
         }
@@ -1121,9 +1124,8 @@ parse_http_header_access(header_mangler header[])
     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;
     }
 
@@ -1135,9 +1137,8 @@ parse_http_header_access(header_mangler header[])
     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;
     }
 
@@ -1189,9 +1190,8 @@ parse_http_header_replace(header_mangler header[])
     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;
     }
 
@@ -1203,10 +1203,9 @@ parse_http_header_replace(header_mangler header[])
     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;
     }
 
@@ -1285,7 +1284,7 @@ parse_authparam(authConfig * config)
         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;
         }
 
@@ -1367,7 +1366,8 @@ parse_cachedir(_SquidConfig::_cacheSwap * swap)
             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;
             }
 
@@ -1627,7 +1627,7 @@ parse_peer(peer ** head)
         } 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();
         }
     }
@@ -1731,8 +1731,7 @@ parse_cachemgrpasswd(cachemgr_passwd ** head)
                 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");
             }
         }
     }
@@ -1809,8 +1808,7 @@ parse_peer_access(void)
         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;
     }
 
@@ -1832,8 +1830,7 @@ parse_hostdomain(void)
         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;
         }
 
@@ -1873,8 +1870,7 @@ parse_hostdomaintype(void)
         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;
         }
 
@@ -2097,17 +2093,14 @@ parse_refreshpattern(refresh_t ** head)
 #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;
     }
 
@@ -2506,7 +2499,7 @@ parseNeighborType(const char *s)
     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;
 }
@@ -3000,7 +2993,7 @@ parse_logformat(logformat ** logformat_definitions)
     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));
 
@@ -3034,7 +3027,7 @@ parse_access_log(customlog ** logs)
     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);
 
@@ -3042,7 +3035,7 @@ parse_access_log(customlog ** logs)
     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;
@@ -3060,7 +3053,7 @@ parse_access_log(customlog ** logs)
     } 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();
     }
 
index 6ea7807eaf1e1e2c7549e6ca8a32dccdcac1c811..d50d3ebad4a2a12f034c6552df488bcb71200c2f 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -149,13 +149,13 @@ cachemgrParseUrl(const char *url)
 #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;
         }
     }
@@ -184,7 +184,7 @@ cachemgrParseHeaders(cachemgrStateData * mgr, const HttpRequest * request)
         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;
     }
 
@@ -200,7 +200,7 @@ cachemgrParseHeaders(cachemgrStateData * mgr, const HttpRequest * request)
     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 << "'");
 }
 
 /*
@@ -244,7 +244,7 @@ cachemgrStart(int fd, HttpRequest * request, StoreEntry * entry)
     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);
@@ -261,8 +261,7 @@ cachemgrStart(int fd, HttpRequest * request, StoreEntry * entry)
     ;
     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);
@@ -277,13 +276,15 @@ cachemgrStart(int fd, HttpRequest * request, StoreEntry * entry)
         /* 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);
 
@@ -307,9 +308,10 @@ cachemgrStart(int fd, HttpRequest * request, StoreEntry * entry)
         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);
@@ -342,7 +344,7 @@ cachemgrStart(int fd, HttpRequest * request, StoreEntry * entry)
 static void
 cachemgrShutdown(StoreEntry * entryunused)
 {
-    debug(16, 0) ("Shutdown by command.\n");
+    debugs(16, 0, "Shutdown by command.");
     shut_down(0);
 }
 
@@ -350,8 +352,8 @@ static void
 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");
 }
index d41ac55e8007d751549863a80c124d29a71c4b9b..56e95e1b08ce0ed5d762ccde94a22fe8bcb4e0fd 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -177,7 +177,7 @@ carpSelectParent(HttpRequest * request)
     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;
@@ -189,8 +189,8 @@ carpSelectParent(HttpRequest * request)
         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;
@@ -199,7 +199,7 @@ carpSelectParent(HttpRequest * request)
     }
 
     if (p)
-        debug(39, 2) ("carpSelectParent: selected %s\n", p->host);
+        debugs(39, 2, "carpSelectParent: selected " << p->host);
 
     return p;
 }
index 037597892390f0fa39aeeb5bab562e3a6f372c40..d745534d228bcff4b3c205c45fbae81c220b947e 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -310,7 +310,7 @@ cbdataInternalAlloc(cbdata_type type)
     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;
@@ -331,10 +331,10 @@ cbdataInternalFree(void *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__);
@@ -346,13 +346,12 @@ cbdataInternalFree(void *p)
 #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);
@@ -400,13 +399,13 @@ cbdataInternalLock(const void *p)
 
 #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
 
@@ -437,13 +436,13 @@ cbdataInternalUnlock(const void *p)
 
 #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
 
@@ -460,7 +459,7 @@ cbdataInternalUnlock(const void *p)
 
     cbdataCount--;
 
-    debug(45, 9) ("cbdataUnlock: Freeing %p\n", p);
+    debugs(45, 9, "cbdataUnlock: Freeing " << p);
 
 #if CBDATA_DEBUG
 
@@ -497,7 +496,7 @@ cbdataReferenceValid(const void *p)
     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);
index b188af5af3935e8ec9a6c1345d17c500c88d38d8..2f28f7e56178c1bb971f0dd1e2758e45cf78ab26 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -598,7 +598,7 @@ gen_parse(Entry * head, FILE * fp)
             "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"
            );
index 21fd010c4dbf0f4c3e4427e19c2e5fb93a1c2bcc..1fa32bc0ade3c065d11a3e1e06bce0506e137ba4 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -156,9 +156,8 @@ clientStreamInsertHead(dlink_list * list, CSR * func, CSCB * callback,
     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;
@@ -177,9 +176,8 @@ clientStreamCallback(clientStreamNode * thisObject, ClientHttpRequest * http,
     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);
 }
 
@@ -195,8 +193,8 @@ clientStreamRead(clientStreamNode * thisObject, ClientHttpRequest * http,
     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);
 }
@@ -210,7 +208,7 @@ clientStreamDetach(clientStreamNode * thisObject, ClientHttpRequest * 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;
@@ -231,8 +229,7 @@ clientStreamDetach(clientStreamNode * thisObject, ClientHttpRequest * http)
      */
 
     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);
@@ -252,8 +249,7 @@ clientStreamAbort(clientStreamNode * thisObject, ClientHttpRequest * 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);
@@ -287,7 +283,7 @@ clientStreamFree(void *foo)
 {
     clientStreamNode *thisObject = (clientStreamNode *)foo;
 
-    debug(87, 3) ("Freeing clientStreamNode %p\n", thisObject);
+    debugs(87, 3, "Freeing clientStreamNode " << thisObject);
 
     thisObject->removeFromStream();
     thisObject->data = NULL;
index 25e879870cf0300bc613f667a61accc84d836af5..180bf6b3bd07268a0449c83afb05bff6d184dc41 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -208,12 +208,13 @@ clientdbCutoffDenied(struct IN_ADDR addr)
     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;
 
@@ -369,7 +370,7 @@ clientdbGC(void *unused)
             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");
     }
 }
 
@@ -426,15 +427,15 @@ snmp_meshCtblFn(variable_list * Var, snint * ErrP)
     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;
     }
@@ -505,7 +506,7 @@ snmp_meshCtblFn(variable_list * Var, snint * ErrP)
 
     default:
         *ErrP = SNMP_ERR_NOSUCHNAME;
-        debug(49, 5) ("snmp_meshCtblFn: illegal column.\n");
+        debugs(49, 5, "snmp_meshCtblFn: illegal column.");
         break;
     }
 
index ad614e863242b3f015b9f28c2240b3639b13a300..dabb2b9c07e6986b3bcbb8ce5dce6212ca84a148 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -198,7 +198,7 @@ ConnStateData::readSomeData()
 
     reading(true);
 
-    debug(33, 4) ("clientReadSomeData: FD %d: reading request...\n", fd);
+    debugs(33, 4, "clientReadSomeData: FD " << fd << ": reading request...");
 
     makeSpaceAvailable();
 
@@ -479,7 +479,7 @@ ClientHttpRequest::logRequest()
     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;
@@ -489,7 +489,7 @@ ClientHttpRequest::logRequest()
             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();
@@ -599,15 +599,14 @@ connStateFree(int fd, void *data)
 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);
     }
 }
@@ -621,7 +620,7 @@ ConnStateData::isOpen() const
 ConnStateData::~ConnStateData()
 {
     assert(this != NULL);
-    debug(33, 3) ("ConnStateData::~ConnStateData: FD %d\n", fd);
+    debugs(33, 3, "ConnStateData::~ConnStateData: FD " << fd);
 
     if (isOpen())
         close();
@@ -651,10 +650,10 @@ clientSetKeepaliveFlag(ClientHttpRequest * http)
     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... */
@@ -729,7 +728,7 @@ ConnStateData::getCurrentContext() const
 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;
@@ -832,7 +831,7 @@ static void
 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 */
@@ -845,7 +844,8 @@ clientPackRangeHdr(const HttpReply * rep, const HttpHdrRangeSpec * spec, String
     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());
 
@@ -906,7 +906,7 @@ ClientSocketContext::packRange(StoreIOBuffer const &source, MemBuf * mb)
             /*
              * 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);
 
@@ -927,7 +927,7 @@ ClientSocketContext::packRange(StoreIOBuffer const &source, MemBuf * mb)
         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 */
@@ -983,8 +983,7 @@ ClientHttpRequest::mRangeCLen()
         /* 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;
     }
 
@@ -1015,15 +1014,14 @@ clientIfRangeMatch(ClientHttpRequest * http, HttpReply * rep)
     /* 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 */
         }
 
@@ -1103,7 +1101,7 @@ ClientSocketContext::buildRangeHeader(HttpReply * rep)
          * 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 {
@@ -1119,8 +1117,7 @@ ClientSocketContext::buildRangeHeader(HttpReply * rep)
         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);
@@ -1174,7 +1171,7 @@ ClientSocketContext::buildRangeHeader(HttpReply * rep)
 
         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();
@@ -1306,7 +1303,8 @@ clientWriteBodyComplete(int fd, char *buf, size_t size, comm_err_t errflag, int
 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().
@@ -1320,8 +1318,8 @@ ConnStateData::readNextRequest()
 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) {
@@ -1344,7 +1342,7 @@ ClientSocketContext::keepaliveNextRequest()
     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();
 
     /*
@@ -1357,7 +1355,7 @@ ClientSocketContext::keepaliveNextRequest()
      */
 
     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");
     }
 
     /*
@@ -1368,7 +1366,7 @@ ClientSocketContext::keepaliveNextRequest()
      * 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;
     }
@@ -1384,10 +1382,10 @@ ClientSocketContext::keepaliveNextRequest()
      */
 
     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();
     }
 }
@@ -1413,7 +1411,8 @@ ClientSocketContext::canPackMoreRanges() const
     /* 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;
@@ -1424,7 +1423,7 @@ ClientSocketContext::canPackMoreRanges() const
     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;
 }
 
@@ -1433,7 +1432,7 @@ ClientSocketContext::getNextRangeOffset() const
 {
     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 */
@@ -1442,10 +1441,17 @@ ClientSocketContext::getNextRangeOffset() const
             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 */
@@ -1466,7 +1472,8 @@ ClientSocketContext::getNextRangeOffset() const
 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 */
@@ -1492,7 +1499,8 @@ ClientSocketContext::socketState()
             /* 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;
@@ -1611,7 +1619,7 @@ ClientSocketContext::writeComplete(int fd, char *bufnotused, size_t size, comm_e
         break;
 
     case STREAM_COMPLETE:
-        debug(33, 5) ("clientWriteComplete: FD %d Keeping Alive\n", fd);
+        debugs(33, 5, "clientWriteComplete: FD " << fd << " Keeping Alive");
         keepaliveNextRequest();
         return;
 
@@ -1744,14 +1752,14 @@ prepareAcceleratedURL(ConnStateData::Pointer & conn, ClientHttpRequest *http, ch
         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;
@@ -1760,7 +1768,7 @@ prepareAcceleratedURL(ConnStateData::Pointer & conn, ClientHttpRequest *http, ch
                  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;
@@ -1769,7 +1777,7 @@ prepareAcceleratedURL(ConnStateData::Pointer & conn, ClientHttpRequest *http, ch
                  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 << "'");
     }
 }
 
@@ -1791,7 +1799,7 @@ prepareTransparentURL(ConnStateData::Pointer & conn, ClientHttpRequest *http, ch
         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;
@@ -1800,7 +1808,7 @@ prepareTransparentURL(ConnStateData::Pointer & conn, ClientHttpRequest *http, ch
                  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 << "'");
     }
 }
 
@@ -1832,7 +1840,7 @@ parseHttpRequest(ConnStateData::Pointer & conn, HttpParser *hp, method_t * metho
     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;
     }
 
@@ -1846,11 +1854,11 @@ parseHttpRequest(ConnStateData::Pointer & conn, HttpParser *hp, method_t * metho
     /* 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);
     }
 
@@ -1868,7 +1876,7 @@ parseHttpRequest(ConnStateData::Pointer & conn, HttpParser *hp, method_t * metho
 
     /* 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");
     }
 
@@ -1877,7 +1885,8 @@ parseHttpRequest(ConnStateData::Pointer & conn, HttpParser *hp, method_t * metho
 
     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");
     }
@@ -1900,20 +1909,21 @@ parseHttpRequest(ConnStateData::Pointer & conn, HttpParser *hp, method_t * metho
     /* 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);
@@ -1929,8 +1939,7 @@ parseHttpRequest(ConnStateData::Pointer & conn, HttpParser *hp, method_t * metho
                      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
 
@@ -1959,7 +1968,7 @@ parseHttpRequest(ConnStateData::Pointer & conn, HttpParser *hp, method_t * metho
     }
 
     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;
@@ -1978,8 +1987,7 @@ ConnStateData::makeSpaceAvailable()
 {
     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);
     }
 }
 
@@ -2014,17 +2022,16 @@ int
 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) << ")");
         }
     }
 
@@ -2037,11 +2044,11 @@ connFinishedWithConn(ConnStateData::Pointer & conn, int size)
     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;
         }
     }
@@ -2077,10 +2084,8 @@ connCancelIncompleteRequests(ConnStateData::Pointer & conn)
     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,
@@ -2111,7 +2116,7 @@ clientAfterReadingRequests(int fd, ConnStateData::Pointer &conn, int do_next_rea
     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;
         }
@@ -2133,7 +2138,7 @@ clientProcessRequest(ConnStateData::Pointer &conn, HttpParser *hp, ClientSocketC
 
     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,
@@ -2146,7 +2151,7 @@ clientProcessRequest(ConnStateData::Pointer &conn, HttpParser *hp, ClientSocketC
 
     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(
@@ -2163,7 +2168,7 @@ clientProcessRequest(ConnStateData::Pointer &conn, HttpParser *hp, ClientSocketC
     /* 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(
@@ -2301,10 +2306,10 @@ connOkToAddRequest(ConnStateData::Pointer &conn)
     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;
@@ -2343,7 +2348,7 @@ clientParseRequest(ConnStateData::Pointer conn, bool &do_next_read)
     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);
@@ -2384,7 +2389,7 @@ clientParseRequest(ConnStateData::Pointer conn, bool &do_next_read)
 
         /* 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);
 
@@ -2393,7 +2398,7 @@ clientParseRequest(ConnStateData::Pointer conn, bool &do_next_read)
             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;
             }
@@ -2448,7 +2453,7 @@ clientReadRequest(int fd, char *buf, size_t size, comm_err_t flag, int xerrno,
             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);
@@ -2489,7 +2494,7 @@ clientReadRequest(int fd, char *buf, size_t size, comm_err_t flag, int xerrno,
          */
 
         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);
         }
 
@@ -2565,7 +2570,7 @@ requestTimeout(int fd, void *data)
 {
 #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,
@@ -2626,7 +2631,7 @@ requestTimeout(int fd, void *data)
     * 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);
 
@@ -2637,10 +2642,9 @@ static void
 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);
 }
 
@@ -2696,7 +2700,7 @@ connStateCreate(struct sockaddr_in *peer, struct sockaddr_in *me, int fd, http_p
         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;
         }
 
@@ -2727,12 +2731,11 @@ httpAccept(int sock, int newfd, ConnectionDetail *details,
         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);
@@ -2796,7 +2799,7 @@ clientNegotiateSSL(int fd, void *data)
         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 {
@@ -2805,8 +2808,8 @@ clientNegotiateSSL(int fd, void *data)
                 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);
 
@@ -2814,13 +2817,14 @@ clientNegotiateSSL(int fd, void *data)
             }
 
         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;
         }
@@ -2829,7 +2833,8 @@ clientNegotiateSSL(int fd, void *data)
     }
 
     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
@@ -2852,30 +2857,37 @@ clientNegotiateSSL(int fd, void *data)
 
 #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();
@@ -2904,15 +2916,13 @@ httpsAccept(int sock, int newfd, ConnectionDetail *details,
 
     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;
     }
@@ -2922,7 +2932,7 @@ httpsAccept(int sock, int newfd, ConnectionDetail *details,
     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);
@@ -2969,8 +2979,8 @@ clientHttpConnectionsOpen(void)
 
     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;
         }
 
@@ -2988,11 +2998,12 @@ clientHttpConnectionsOpen(void)
 
         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;
     }
@@ -3007,14 +3018,15 @@ clientHttpsConnectionsOpen(void)
 
     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();
@@ -3031,8 +3043,9 @@ clientHttpsConnectionsOpen(void)
 
         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;
     }
@@ -3060,7 +3073,8 @@ clientHttpConnectionsClose(void)
 
     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;
         }
@@ -3083,10 +3097,8 @@ varyEvaluateMatch(StoreEntry * entry, HttpRequest * request)
     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;
         }
@@ -3127,8 +3139,8 @@ varyEvaluateMatch(StoreEntry * entry, HttpRequest * request)
             /* 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;
         }
     }
index b0d52abc204e1131e3b003a460b78a8e4316d157..501a89832f47394239ab209aa763130e2dc738b5 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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)
@@ -169,7 +169,7 @@ void
 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;
@@ -185,7 +185,7 @@ void
 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;
@@ -234,7 +234,7 @@ clientReplyContext::processExpired()
 {
     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
@@ -265,8 +265,7 @@ clientReplyContext::processExpired()
 #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);
 
@@ -280,7 +279,7 @@ clientReplyContext::processExpired()
     /* 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 */
@@ -340,9 +339,7 @@ clientReplyContext::handleIMSReply(StoreIOBuffer result)
     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;
@@ -357,7 +354,7 @@ clientReplyContext::handleIMSReply(StoreIOBuffer result)
 
     // 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();
     }
@@ -367,14 +364,14 @@ clientReplyContext::handleIMSReply(StoreIOBuffer result)
         // 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();
         }
@@ -398,11 +395,12 @@ clientReplyContext::handleIMSReply(StoreIOBuffer result)
 
             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();
             }
         }
@@ -411,7 +409,7 @@ clientReplyContext::handleIMSReply(StoreIOBuffer result)
         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();
         }
 
@@ -419,7 +417,8 @@ clientReplyContext::handleIMSReply(StoreIOBuffer result)
         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();
         }
     }
@@ -452,14 +451,14 @@ clientReplyContext::cacheHit(StoreIOBuffer result)
 
     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();
@@ -492,7 +491,7 @@ clientReplyContext::cacheHit(StoreIOBuffer result)
                    && 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 */
@@ -520,7 +519,7 @@ clientReplyContext::cacheHit(StoreIOBuffer result)
 
     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:
@@ -532,13 +531,13 @@ clientReplyContext::cacheHit(StoreIOBuffer result)
         /* 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;
     }
@@ -558,7 +557,7 @@ clientReplyContext::cacheHit(StoreIOBuffer result)
         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
          */
@@ -605,8 +604,8 @@ clientReplyContext::cacheHit(StoreIOBuffer result)
          */
 
         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)) {
@@ -658,8 +657,7 @@ clientReplyContext::processMiss()
     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.
@@ -667,9 +665,8 @@ clientReplyContext::processMiss()
 
     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);
         }
 
@@ -736,8 +733,8 @@ void
 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);
@@ -832,8 +829,8 @@ clientReplyContext::purgeFoundObject(StoreEntry *entry)
 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;
@@ -870,7 +867,7 @@ clientReplyContext::purgeDoPurgeGet(StoreEntry *newEntry)
 
     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;
     }
@@ -883,7 +880,7 @@ void
 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;
     }
@@ -895,8 +892,7 @@ clientReplyContext::purgeDoPurgeHead(StoreEntry *newEntry)
         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;
         }
@@ -904,8 +900,7 @@ clientReplyContext::purgeDoPurgeHead(StoreEntry *newEntry)
         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;
         }
@@ -1048,25 +1043,20 @@ clientHttpRequestStatus(int fd, ClientHttpRequest const *http)
 #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;
     }
 
@@ -1109,36 +1099,36 @@ clientReplyContext::replyStatus()
         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;
     }
 
@@ -1303,19 +1293,17 @@ clientReplyContext::buildReplyHeader()
 #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;
     }
 
@@ -1456,14 +1444,14 @@ clientReplyContext::identifyFoundObject(StoreEntry *newEntry)
 
     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;
@@ -1478,7 +1466,7 @@ clientReplyContext::identifyFoundObject(StoreEntry *newEntry)
     }
 
     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();
@@ -1487,21 +1475,21 @@ clientReplyContext::identifyFoundObject(StoreEntry *newEntry)
 
     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();
 }
@@ -1652,7 +1640,7 @@ clientReplyContext::sendStreamError(StoreIOBuffer const &result)
     /* 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;
@@ -1666,7 +1654,7 @@ clientReplyContext::pushStreamData(StoreIOBuffer const &result, char *source)
     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;
     }
 
@@ -1691,7 +1679,7 @@ clientReplyContext::next() const
 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 
@@ -1703,7 +1691,7 @@ clientReplyContext::waitForMoreData ()
 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;
@@ -1733,7 +1721,7 @@ clientReplyContext::buildMaxBodySize(HttpReply * reply)
     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);
             }
 
@@ -1778,10 +1766,11 @@ clientReplyContext::ProcessReplyAccessResult (int rv, void *voidMe)
 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)) {
@@ -1818,16 +1807,16 @@ clientReplyContext::processReplyAccessResult(bool accessAllowed)
 
     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);
     }
@@ -1836,7 +1825,7 @@ clientReplyContext::processReplyAccessResult(bool accessAllowed)
 
 #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,
@@ -1936,11 +1925,10 @@ clientReplyContext::sendMoreData (StoreIOBuffer result)
 
     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;
@@ -2002,7 +1990,7 @@ clientReplyContext::sendMoreData (StoreIOBuffer result)
          * 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;
         /*
@@ -2016,7 +2004,7 @@ clientReplyContext::sendMoreData (StoreIOBuffer result)
         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 */
index 47cd0c2805bb8768ee49f6d0d95f7a616534f5ae..2d93cd31177ea9d07d26e9df24012afa555dda6c 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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)
@@ -223,10 +223,11 @@ checkFailureRatio(err_type etype, hier_code hcode)
     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;
 
@@ -235,7 +236,7 @@ checkFailureRatio(err_type etype, hier_code hcode)
 
 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,
@@ -309,7 +310,7 @@ clientBeginRequest(method_t method, char const *url, CSCB * streamcallback,
     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;
     }
 
@@ -408,10 +409,12 @@ ClientRequestContext::clientAccessCheckDone(int answer)
     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)
@@ -422,13 +425,11 @@ ClientRequestContext::clientAccessCheckDone(int answer)
     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
@@ -545,7 +546,7 @@ clientRedirectAccessCheckDone(int answer, void *data)
 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);
@@ -763,14 +764,13 @@ clientInterpretRequestHeaders(ClientHttpRequest * 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
@@ -789,8 +789,7 @@ ClientRequestContext::clientRedirectDone(char *result)
 {
     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;
 
@@ -807,7 +806,7 @@ ClientRequestContext::clientRedirectDone(char *result)
                 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);
@@ -891,8 +890,7 @@ ClientRequestContext::checkNoCacheDone(int answer)
 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;
@@ -908,8 +906,8 @@ ClientHttpRequest::httpStart()
 {
     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 */
@@ -1078,11 +1076,11 @@ ClientHttpRequest::startIcap(ICAPServiceRep::Pointer service)
 {
     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;
     }
 
@@ -1213,7 +1211,7 @@ ClientHttpRequest::handleIcapFailure()
     // 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;
index f7830fcd583d2aed31f3c34133f0c13e81e24ccc..02014d8a1c87b38d42a7e5e683e71f8d16f60912 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -139,7 +139,7 @@ commio_set_callback(int fd, iocb_type type, comm_io_callback_t *ccb, IOCB *cb, v
 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;
@@ -158,7 +158,7 @@ commio_complete_callback(int fd, comm_io_callback_t *ccb, comm_err_t code, int x
 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);
 
@@ -187,7 +187,7 @@ commio_call_callback(comm_io_callback_t *ccb)
        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! */
@@ -503,7 +503,7 @@ comm_calliocallback(void)
      */
     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;
@@ -518,7 +518,7 @@ comm_calliocallback(void)
 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);
 }
 
@@ -540,11 +540,10 @@ commHandleRead(int fd, void *data)
     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;
@@ -574,7 +573,7 @@ comm_read(int fd, char *buf, int size, IOCB *handler, void *handler_data)
     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 */
@@ -761,7 +760,7 @@ comm_local_port(int fd)
     /* 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;
     }
 
@@ -771,12 +770,12 @@ comm_local_port(int fd)
     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;
 }
 
@@ -796,11 +795,9 @@ commBind(int s, struct IN_ADDR in_addr, u_short 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;
 }
@@ -852,10 +849,10 @@ comm_openex(int sock_type,
          * 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);
@@ -868,20 +865,20 @@ comm_openex(int sock_type,
 #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);
 
@@ -969,7 +966,7 @@ void
 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);
@@ -985,11 +982,11 @@ commConnectDnsHandle(const ipcache_addrs * ia, void *data)
     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);
@@ -1013,7 +1010,8 @@ commConnectDnsHandle(const ipcache_addrs * ia, void *data)
 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>();
@@ -1029,7 +1027,7 @@ static void
 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;
@@ -1067,7 +1065,7 @@ ConnectStateData::commResetFD()
     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();
@@ -1084,7 +1082,7 @@ ConnectStateData::commResetFD()
 #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();
@@ -1103,14 +1101,14 @@ ConnectStateData::commResetFD()
      */
 
     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
@@ -1171,7 +1169,7 @@ ConnectStateData::connect()
     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;
 
@@ -1198,7 +1196,7 @@ ConnectStateData::connect()
 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];
@@ -1243,7 +1241,7 @@ comm_connect_addr(int sock, const struct sockaddr_in *address)
         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_)
@@ -1297,11 +1295,10 @@ comm_connect_addr(int sock, const struct sockaddr_in *address)
 
     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;
@@ -1322,15 +1319,15 @@ comm_old_accept(int fd, ConnectionDetail &details)
 
         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;
         }
     }
@@ -1358,14 +1355,14 @@ void
 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);
@@ -1383,7 +1380,7 @@ commLingerClose(int fd, void *unused)
     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);
 }
@@ -1391,7 +1388,7 @@ commLingerClose(int fd, void *unused)
 static void
 commLingerTimeout(int fd, void *unused)
 {
-    debug(5, 3) ("commLingerTimeout: FD %d\n", fd);
+    debugs(5, 3, "commLingerTimeout: FD " << fd);
     comm_close(fd);
 }
 
@@ -1433,7 +1430,7 @@ comm_reset_close(int 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);
 }
@@ -1486,7 +1483,7 @@ _comm_close(int fd, char const *file, int line)
     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];
@@ -1604,11 +1601,9 @@ comm_udp_sendto(int 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;
 }
@@ -1618,8 +1613,8 @@ comm_add_close_handler(int fd, PF * handler, void *data)
 {
     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);
@@ -1640,8 +1635,8 @@ comm_remove_close_handler(int fd, PF * handler, void *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)
@@ -1669,7 +1664,7 @@ commSetNoLinger(int fd)
     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;
 }
@@ -1680,15 +1675,14 @@ commSetReuseAddr(int fd)
     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
@@ -1708,7 +1702,7 @@ commSetNonBlocking(int fd)
 #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;
         }
 
@@ -1720,12 +1714,12 @@ commSetNonBlocking(int fd)
 #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;
         }
 
@@ -1752,13 +1746,13 @@ commUnsetNonBlocking(int fd)
     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;
     }
 
@@ -1773,12 +1767,12 @@ commSetCloseOnExec(int fd) {
     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;
 
@@ -1791,7 +1785,7 @@ commSetTcpNoDelay(int fd) {
     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;
 }
@@ -1836,12 +1830,12 @@ commHandleWrite(int fd, void *data) {
     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++;
 
@@ -1850,27 +1844,24 @@ commHandleWrite(int fd, void *data) {
         /* 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 {
@@ -1903,8 +1894,7 @@ comm_write(int fd, const char *buf, int size, IOCB * handler, void *handler_data
 {
     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
@@ -1978,13 +1968,12 @@ commCloseAllSockets(void) {
             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);
         }
     }
@@ -2016,15 +2005,15 @@ checkTimeouts(void) {
         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);
         }
     }
@@ -2042,9 +2031,7 @@ comm_listen(int sock) {
     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;
     }
 
@@ -2066,7 +2053,7 @@ fdc_t::acceptOne(int fd) {
     // 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())
@@ -2089,7 +2076,7 @@ fdc_t::acceptOne(int fd) {
     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;
@@ -2105,7 +2092,7 @@ fdc_t::acceptOne(int fd) {
         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);
@@ -2152,7 +2139,7 @@ comm_accept_try(int fd, void *data) {
  */
 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! */
@@ -2233,7 +2220,7 @@ AcceptLimiter::deferring() const {
 
 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;
@@ -2286,7 +2273,7 @@ AbortChecker::AbortCheckReader(int fd, char *, size_t size, comm_err_t flag, int
      */
 
     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);
     }
 }
@@ -2298,7 +2285,7 @@ AbortChecker::monitor(int 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
@@ -2308,7 +2295,7 @@ AbortChecker::stopMonitoring (int fd) {
     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"
@@ -2396,7 +2383,7 @@ template cbdata_type List<DeferredRead>
 
 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);
 }
@@ -2460,7 +2447,7 @@ DeferredReadManager::kickARead(DeferredRead const &aRead) {
     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);
 }
index 1663030f4c15d075b1ebe1f58b947632228cba35..eb12a432463009ce945398b065327a96438fcab8 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
  *
@@ -133,8 +133,9 @@ commSetSelect(int fd, unsigned int type, PF * handler,
 
     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 */
@@ -189,8 +190,8 @@ commSetSelect(int fd, unsigned int type, PF * handler,
         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());
         }
     }
 
@@ -274,21 +275,22 @@ comm_select(int msec)
     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);
@@ -297,7 +299,7 @@ comm_select(int msec)
 
         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);
@@ -305,7 +307,7 @@ comm_select(int msec)
                 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);
             }
index b44e0f1caed4f17b4f8b80113a87d522945ff693..d4f36d66da054160f10286539c245afb2e12184d 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
  *
@@ -296,7 +296,7 @@ comm_select(int msec)
 
         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;
         }
     }
index 4da3b2e8c4ee19cb5c490ac6cdd1c76f69e09127..62e8ea85f94a837a670632d36d21b0e66d1363be 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
  *
@@ -129,7 +129,7 @@ commSetSelect(int fd, unsigned int type, PF * handler, void *client_data,
     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;
@@ -264,8 +264,7 @@ comm_check_incoming_poll_handlers(int nfds, int *fds)
                 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)) {
@@ -273,8 +272,7 @@ comm_check_incoming_poll_handlers(int nfds, int *fds)
                 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");
         }
     }
 
@@ -457,7 +455,7 @@ comm_select(int msec)
             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);
 
@@ -468,7 +466,7 @@ comm_select(int msec)
 
         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)
@@ -511,7 +509,7 @@ comm_select(int msec)
             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;
@@ -542,7 +540,7 @@ comm_select(int msec)
             }
 
             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);
@@ -564,21 +562,19 @@ comm_select(int msec)
 
             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);
                 }
 
@@ -607,7 +603,7 @@ comm_select(int msec)
 
         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;
@@ -633,7 +629,7 @@ comm_select(int msec)
         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;
 }
index 5cb1a9ab2af6a85eb417119e28eb9aa625df8cc2..dac549407f899c5bfaab3be18464fc0d3cf97512 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
  *
@@ -138,7 +138,7 @@ commSetSelect(int fd, unsigned int type, PF * handler, void *client_data,
     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;
@@ -271,8 +271,7 @@ comm_check_incoming_select_handlers(int nfds, int *fds)
                 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");
             }
         }
 
@@ -282,8 +281,7 @@ comm_check_incoming_select_handlers(int nfds, int *fds)
                 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");
             }
         }
     }
@@ -488,8 +486,7 @@ comm_select(int msec)
             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);
 
@@ -503,8 +500,7 @@ comm_select(int msec)
 
         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);
 
@@ -536,7 +532,7 @@ comm_select(int msec)
 
 #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));
 
@@ -558,7 +554,7 @@ comm_select(int msec)
                 }
 
                 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;
@@ -608,7 +604,7 @@ comm_select(int msec)
 
 #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));
 
@@ -630,7 +626,7 @@ comm_select(int msec)
                 }
 
                 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;
@@ -663,7 +659,7 @@ comm_select(int msec)
 
         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;
@@ -691,7 +687,7 @@ comm_select(int msec)
     } 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;
 }
@@ -768,7 +764,7 @@ examine_select(fd_set * readfds, fd_set * writefds)
     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);
@@ -787,29 +783,23 @@ examine_select(fd_set * readfds, fd_set * writefds)
         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);
         }
 
index 17052d0740d7a9bd0dc8c77ec86c0f3af8393cc6..441429ae940693f91242fb6591574a0fd2849174 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
  *
@@ -138,7 +138,7 @@ commSetSelect(int fd, unsigned int type, PF * handler, void *client_data,
     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;
@@ -274,8 +274,7 @@ comm_check_incoming_select_handlers(int nfds, int *fds)
                 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");
             }
         }
 
@@ -285,8 +284,7 @@ comm_check_incoming_select_handlers(int nfds, int *fds)
                 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");
             }
         }
     }
@@ -488,8 +486,7 @@ comm_select(int msec)
             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);
 
@@ -503,8 +500,7 @@ comm_select(int msec)
 
         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);
 
@@ -540,7 +536,7 @@ comm_select(int msec)
 
 #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));
 
@@ -562,7 +558,7 @@ comm_select(int msec)
             }
 
             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;
@@ -633,7 +629,7 @@ comm_select(int msec)
 
 #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));
 
@@ -655,7 +651,7 @@ comm_select(int msec)
             }
 
             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;
@@ -689,7 +685,7 @@ comm_select(int msec)
 
         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;
@@ -717,7 +713,7 @@ comm_select(int msec)
     } 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;
 }
@@ -794,7 +790,7 @@ examine_select(fd_set * readfds, fd_set * writefds)
     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);
@@ -813,29 +809,23 @@ examine_select(fd_set * readfds, fd_set * writefds)
         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);
         }
 
index a26079ba0121d7af4f725a361c247034c40b37fd..464bc5ad92b5fbd430c9bceb7fa1d68852ae72f6 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -563,7 +563,7 @@ debugLogTime(void) {
 
 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();
@@ -603,7 +603,7 @@ xassert(const char *msg, const char *file, int line) {
  *      // 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);
  *      ...
  * }
  * 
@@ -671,7 +671,7 @@ ctx_enter(const char *descr) {
         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;
     }
 
index 7a8cbaca0880442897d977c29148388daedad002..8e7f7e731c975a14939fce5cc6c30aa58d40bf4c 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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>
@@ -662,7 +662,7 @@ void
 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();
     }
 
index 2cc358a42a8c0482ad4d42efa6e58b45410556cf..32a27b431ffb67adb2078d8056e0c482c5a71f25 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -75,11 +75,10 @@ file_open(const char *path, int mode)
     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);
     }
@@ -118,7 +117,7 @@ file_close(int fd)
 
         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);
 
@@ -144,8 +143,7 @@ file_close(int fd)
 
     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);
 
@@ -235,7 +233,7 @@ diskHandleWrite(int fd, void *notused)
 
     PROF_start(diskHandleWrite);
 
-    debug(6, 3) ("diskHandleWrite: FD %d\n", fd);
+    debugs(6, 3, "diskHandleWrite: FD " << fd);
 
     F->flags.write_daemon = 0;
 
@@ -243,8 +241,7 @@ diskHandleWrite(int fd, void *notused)
 
     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;
 
@@ -255,7 +252,7 @@ diskHandleWrite(int fd, void *notused)
                           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++;
 
@@ -264,8 +261,8 @@ diskHandleWrite(int fd, void *notused)
     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
@@ -309,8 +306,10 @@ diskHandleWrite(int fd, void *notused)
         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);
 
@@ -445,8 +444,7 @@ diskHandleRead(int fd, void *data)
     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;
@@ -469,7 +467,7 @@ diskHandleRead(int fd, void *data)
             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) {
@@ -515,7 +513,7 @@ safeunlink(const char *s, int quiet)
     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());
 }
 
 /*
@@ -526,7 +524,7 @@ safeunlink(const char *s, int quiet)
 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
@@ -537,8 +535,7 @@ xrename(const char *from, const char *to)
     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;
 }
index b1a18b074e43546887c4fe580363724db690ec89..0df6d429d1b4d102fe5a5686e0ac70efe3af95ad 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -125,7 +125,7 @@ dnsSubmit(const char *lookup, HLPCB * callback, void *data)
         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");
 
@@ -144,7 +144,7 @@ variable_list *
 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;
 
index 65c1f76f330d995200e133c41f238b244c39984f..4d01c272a29bf485a1b389c5e0337408ece113e7 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -191,13 +191,13 @@ idnsAddNameserver(const char *buf)
     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);
     }
 
@@ -223,8 +223,7 @@ idnsAddNameserver(const char *buf)
     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++;
 }
 
@@ -251,8 +250,7 @@ idnsAddPathComponent(const char *buf)
 
     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++;
 }
 
@@ -279,7 +277,7 @@ idnsParseNameservers(void)
     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);
     }
 }
@@ -294,7 +292,7 @@ idnsParseResolvConf(void)
     fp = fopen(_PATH_RESCONF, "r");
 
     if (fp == NULL) {
-        debug(78, 1) ("%s: %s\n", _PATH_RESCONF, xstrerror());
+        debugs(78, 1, "" << _PATH_RESCONF << ": " << xstrerror());
         return;
     }
 
@@ -314,7 +312,7 @@ idnsParseResolvConf(void)
             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) {
@@ -324,7 +322,7 @@ idnsParseResolvConf(void)
                 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);
             }
@@ -341,7 +339,7 @@ idnsParseResolvConf(void)
                     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);
                 }
             }
         }
@@ -759,7 +757,7 @@ idnsSendQuery(idns_query * q)
     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;
     }
 
@@ -788,8 +786,7 @@ try_again:
     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;
@@ -849,7 +846,7 @@ idnsQueryID(void)
         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;
         }
     }
@@ -899,22 +896,22 @@ idnsGrokReply(const char *buf, size_t sz)
                              &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;
     }
@@ -937,7 +934,7 @@ idnsGrokReply(const char *buf, size_t sz)
     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;
@@ -963,8 +960,7 @@ idnsGrokReply(const char *buf, size_t sz)
             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++;
@@ -1022,8 +1018,7 @@ idnsRead(int fd, void *data)
             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;
         }
@@ -1031,10 +1026,7 @@ idnsRead(int fd, void *data)
         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) {
@@ -1043,8 +1035,7 @@ idnsRead(int fd, void *data)
             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;
             }
 
@@ -1076,8 +1067,7 @@ idnsCheckQueue(void *unused)
         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;
 
@@ -1086,9 +1076,9 @@ idnsCheckQueue(void *unused)
         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);
@@ -1122,10 +1112,9 @@ idnsReadVC(int fd, char *buf, size_t len, comm_err_t flag, int xerrno, void *dat
         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();
@@ -1213,9 +1202,8 @@ idnsInit(void)
          */
         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);
@@ -1344,8 +1332,7 @@ idnsALookup(const char *name, IDNSCB * callback, void *data)
         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,
@@ -1358,8 +1345,8 @@ idnsALookup(const char *name, IDNSCB * callback, void *data)
         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;
 
@@ -1399,8 +1386,8 @@ idnsPTRLookup(const struct IN_ADDR addr, IDNSCB * callback, void *data)
        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;
 
@@ -1422,7 +1409,7 @@ snmp_netIdnsFn(variable_list * Var, snint * ErrP)
 {
     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;
 
index f8a619d2a5b66242fac32bc53a900b6ae9af5b07..276e45ae02a5cc70c0c3b3bad2104c861cfc2d2c 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -226,7 +226,7 @@ errorTryLoadText(const char *page_name, const char *dir)
     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;
     }
 
@@ -237,8 +237,7 @@ errorTryLoadText(const char *page_name, const char *dir)
     }
 
     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);
@@ -376,7 +375,7 @@ errorAppendEntry(StoreEntry * entry, ErrorState * err)
 
     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();
         }
     }
@@ -424,7 +423,7 @@ void
 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
@@ -457,15 +456,15 @@ static void
 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");
         }
     }
 
@@ -847,7 +846,7 @@ errorConvert(char token, ErrorState * err)
 
     assert(p);
 
-    debug(4, 3) ("errorConvert: %%%c --> '%s'\n", token, p);
+    debugs(4, 3, "errorConvert: %%" << token << " --> '" << p << "'" );
 
     if (do_quote)
         p = html_quote(p);
index 9fd8083599feccf6b5ad7160e66167a59596b30e..9b319bbd617b3b003bc95a832685b96159a9a8db 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -587,12 +587,12 @@ ACLExternal::valid () const
 {
     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;
         }
     }
@@ -620,7 +620,7 @@ aclMatchExternal(external_acl_data *acl, ACLChecklist * ch)
     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) {
@@ -642,7 +642,7 @@ aclMatchExternal(external_acl_data *acl, ACLChecklist * ch)
             /* 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;
             }
         }
@@ -660,25 +660,27 @@ aclMatchExternal(external_acl_data *acl, ACLChecklist * ch)
         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 */
                 }
             }
@@ -689,7 +691,7 @@ aclMatchExternal(external_acl_data *acl, ACLChecklist * ch)
     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())
@@ -959,10 +961,10 @@ static external_acl_entry *
 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);
 
@@ -1052,7 +1054,7 @@ externalAclHandleReply(void *data, char *reply)
     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);
@@ -1133,8 +1135,8 @@ ACLExternal::ExternalAclLookup(ACLChecklist * ch, ACLExternal * me, EAH * callba
         /* 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;
         }
@@ -1143,12 +1145,14 @@ ACLExternal::ExternalAclLookup(ACLChecklist * ch, ACLExternal * me, EAH * callba
     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))
@@ -1166,8 +1170,7 @@ ACLExternal::ExternalAclLookup(ACLChecklist * ch, ACLExternal * me, EAH * callba
 
     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 {
@@ -1179,8 +1182,8 @@ ACLExternal::ExternalAclLookup(ACLChecklist * ch, ACLExternal * me, EAH * callba
     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;
     }
 
@@ -1204,7 +1207,7 @@ ACLExternal::ExternalAclLookup(ACLChecklist * ch, ACLExternal * me, EAH * callba
         /* 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;
@@ -1215,7 +1218,7 @@ ACLExternal::ExternalAclLookup(ACLChecklist * ch, ACLExternal * me, EAH * callba
 
         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);
 
@@ -1226,22 +1229,24 @@ ACLExternal::ExternalAclLookup(ACLChecklist * ch, ACLExternal * me, EAH * callba
 
     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
index 1b0c419a06e8a293f1a7c41ff8e21f1bd63a3bbe..466a3ac0cc82ce822ac62acb2616b00503151695 100644 (file)
--- a/src/fd.cc
+++ b/src/fd.cc
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -97,7 +97,7 @@ fd_close(int fd)
         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;
@@ -176,12 +176,12 @@ fd_open(int fd, unsigned int type, const char *desc)
     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;
@@ -268,11 +268,11 @@ fdDumpOpen(void)
         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);
     }
 }
 
@@ -322,11 +322,10 @@ fdAdjustReserved(void)
 
     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;
 }
index df354469736ac46b3ba701c44538efb1d9d1cf46..d8c621ca7ace7c1cc94c0386c73a9a04ddfbbf17 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -61,9 +61,8 @@ file_map_create(void)
     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;
@@ -77,9 +76,9 @@ file_map_grow(fileMap * 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 */
@@ -156,7 +155,7 @@ file_map_allocate(fileMap * fm, int suggestion)
         }
     }
 
-    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);
 }
index a31de87e5d1c1e6e05f6aef6a138cd6f9f75b994..f85de0e47e4a5542f18ea78d1d3f460487261703 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -185,7 +185,7 @@ FwdState::~FwdState()
     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);
     }
 
@@ -234,7 +234,7 @@ FwdState::fwdStart(int client_fd, StoreEntry *entry, HttpRequest *request)
         }
     }
 
-    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
@@ -286,10 +286,7 @@ FwdState::fwdStart(int client_fd, StoreEntry *entry, HttpRequest *request)
 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);
@@ -306,7 +303,7 @@ FwdState::fail(ErrorState * errorState)
 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);
@@ -324,8 +321,7 @@ FwdState::complete()
 {
     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();
@@ -334,9 +330,7 @@ FwdState::complete()
     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);
@@ -345,8 +339,7 @@ FwdState::complete()
 
         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();
 
@@ -500,15 +493,13 @@ FwdState::checkRetriable()
 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 */
@@ -566,7 +557,9 @@ FwdState::negotiateSSL(int fd)
             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
 
@@ -617,8 +610,7 @@ FwdState::initiateSSL()
     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);
@@ -676,8 +668,7 @@ FwdState::connectDone(int aServerFD, comm_err_t status, int xerrno)
         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);
 
@@ -698,7 +689,7 @@ FwdState::connectDone(int aServerFD, comm_err_t status, int xerrno)
 
         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);
@@ -721,7 +712,7 @@ FwdState::connectTimeout(int fd)
 {
     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])
@@ -765,7 +756,7 @@ FwdState::connectStart()
     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;
@@ -795,7 +786,7 @@ FwdState::connectStart()
 
     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++;
 
@@ -825,8 +816,7 @@ FwdState::connectStart()
 
     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,
@@ -837,7 +827,7 @@ FwdState::connectStart()
                      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);
@@ -882,19 +872,20 @@ FwdState::connectStart()
             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;
                 }
             }
@@ -910,7 +901,7 @@ FwdState::connectStart()
 void
 FwdState::startComplete(FwdServer * theServers)
 {
-    debug(17, 3) ("fwdStartComplete: %s\n", entry->url());
+    debugs(17, 3, "fwdStartComplete: " << entry->url()  );
 
     if (theServers != NULL) {
         servers = theServers;
@@ -923,7 +914,7 @@ FwdState::startComplete(FwdServer * 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);
@@ -934,10 +925,7 @@ void
 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
@@ -1002,8 +990,7 @@ FwdState::dispatch()
         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);
             /*
@@ -1044,10 +1031,10 @@ FwdState::reforward()
     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;
     }
 
@@ -1067,12 +1054,12 @@ FwdState::reforward()
     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);
 }
 
index 617ddff14a268a081992f7028b9caefd1d1ef479..cdb63fa8e6a967492eed122e97c1236d6394570d 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -120,8 +120,7 @@ fqdncacheRelease(fqdncache_entry * f)
     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);
 
@@ -187,7 +186,7 @@ fqdncache_purgelru(void *notused)
         removed++;
     }
 
-    debug(35, 9) ("fqdncache_purgelru: removed %d entries\n", removed);
+    debugs(35, 9, "fqdncache_purgelru: removed " << removed << " entries");
 }
 
 static void
@@ -279,17 +278,17 @@ fqdncacheParse(fqdncache_entry *f, const char *inbuf)
     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;
     }
@@ -302,7 +301,7 @@ fqdncacheParse(fqdncache_entry *f, const char *inbuf)
     }
 
     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;
     }
@@ -310,7 +309,7 @@ fqdncacheParse(fqdncache_entry *f, const char *inbuf)
     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;
     }
@@ -320,7 +319,7 @@ fqdncacheParse(fqdncache_entry *f, const char *inbuf)
     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;
     }
@@ -352,18 +351,18 @@ fqdncacheParse(fqdncache_entry *f, rfc1035_rr * answers, int nr, const char *err
     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++) {
@@ -372,12 +371,12 @@ fqdncacheParse(fqdncache_entry *f, rfc1035_rr * answers, int nr, const char *err
 
         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;
             }
 
@@ -393,7 +392,7 @@ fqdncacheParse(fqdncache_entry *f, rfc1035_rr * answers, int nr, const char *err
     }
 
     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;
     }
 
@@ -448,12 +447,12 @@ fqdncache_nbgethostbyaddr(struct IN_ADDR addr, FQDNH * handler, void *handlerDat
     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;
@@ -473,7 +472,7 @@ fqdncache_nbgethostbyaddr(struct IN_ADDR addr, FQDNH * handler, void *handlerDat
     } 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++;
@@ -489,7 +488,7 @@ fqdncache_nbgethostbyaddr(struct IN_ADDR addr, FQDNH * handler, void *handlerDat
         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;
@@ -514,7 +513,7 @@ fqdncache_init(void)
     if (fqdn_table)
         return;
 
-    debug(35, 3) ("Initializing FQDN Cache...\n");
+    debugs(35, 3, "Initializing FQDN Cache...");
 
     memset(&FqdncacheStats, '\0', sizeof(FqdncacheStats));
 
@@ -731,7 +730,7 @@ fqdncacheAddEntryFromHosts(char *addr, wordlist * hostnames)
         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);
@@ -766,7 +765,7 @@ variable_list *
 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;
 
index 5a8453aa7cfccb766ee70e93e3833b179ac91e95..be33a07bd4e91e369cfad171231dca68ba34e843 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -140,11 +140,11 @@ CossSwapDir::openLog()
     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
@@ -155,8 +155,7 @@ CossSwapDir::closeLog()
 
     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;
 }
@@ -165,7 +164,7 @@ void
 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.");
     }
 }
@@ -188,8 +187,7 @@ CossSwapDir::readCompleted(const char *buf, int len, int errflag, RefCount<ReadR
     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) {
@@ -197,9 +195,9 @@ CossSwapDir::readCompleted(const char *buf, int len, int errflag, RefCount<ReadR
 
         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;
@@ -232,12 +230,12 @@ CossSwapDir::writeCompleted(int errflag, size_t len, RefCount<WriteRequest> writ
     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++;
@@ -406,8 +404,7 @@ storeCossRebuildFromSwapLog(void *data)
 
     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);
@@ -422,10 +419,10 @@ storeCossRebuildFromSwapLog(void *data)
         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;
@@ -461,8 +458,7 @@ storeCossRebuildFromSwapLog(void *data)
 
             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++;
 
@@ -528,7 +524,10 @@ storeCossAddDiskRestore(CossSwapDir * SD, const cache_key * key,
                         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();
@@ -574,8 +573,7 @@ storeCossDirRebuild(CossSwapDir * sd)
      * 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++;
 
@@ -618,14 +616,14 @@ storeCossDirCloseTmpSwapLog(CossSwapDir * sd)
     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 *
@@ -642,7 +640,7 @@ storeCossDirOpenTmpSwapLog(CossSwapDir * sd, int *clean_flag, int *zero_flag)
     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);
@@ -659,7 +657,7 @@ storeCossDirOpenTmpSwapLog(CossSwapDir * sd, int *clean_flag, int *zero_flag)
     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.");
     }
 
@@ -668,7 +666,7 @@ storeCossDirOpenTmpSwapLog(CossSwapDir * sd, int *clean_flag, int *zero_flag)
     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");
     }
 
@@ -745,8 +743,7 @@ CossSwapDir::writeCleanStart()
     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)
@@ -803,9 +800,8 @@ CossCleanLog::write(StoreEntry const &e)
 
     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);
@@ -830,10 +826,8 @@ CossSwapDir::writeCleanDone()
         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);
@@ -1075,9 +1069,9 @@ CossSwapDir::parse(int anIndex, char *aPath)
     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");
     }
 }
@@ -1096,9 +1090,9 @@ CossSwapDir::reconfigure(int index, char *path)
         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;
     }
 
@@ -1142,8 +1136,7 @@ CossSwapDir::optionBlockSizeParse(const char *option, const char *value, int rec
         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;
     }
 
index ba51e5f4745ccfa199e5dfd3ccff0adfb13fe3a7..ab227f6a8ce111db90df4e770849718d59d153db 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -94,7 +94,7 @@ CossSwapDir::allocate(const StoreEntry * e, int which)
         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;
@@ -108,8 +108,7 @@ CossSwapDir::allocate(const StoreEntry * e, int which)
         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;
     }
@@ -126,7 +125,7 @@ CossSwapDir::allocate(const StoreEntry * e, int which)
         return storeCossDiskOffsetToFileno(retofs);
     } else {
         StoreFScoss::GetInstance().stats.alloc.collisions++;
-        debug(79, 3) ("CossSwapDir::allocate: Collision\n");
+        debugs(79, 3, "CossSwapDir::allocate: Collision");
         return -1;
     }
 }
@@ -134,7 +133,7 @@ CossSwapDir::allocate(const StoreEntry * e, int which)
 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);
@@ -163,10 +162,11 @@ CossSwapDir::createStoreIO(StoreEntry &e, StoreIOState::STFNCB * file_callback,
     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);
 
@@ -196,7 +196,7 @@ CossSwapDir::openStoreIO(StoreEntry & e, StoreIOState::STFNCB * file_callback,
     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);
@@ -243,7 +243,7 @@ CossSwapDir::openStoreIO(StoreEntry & e, StoreIOState::STFNCB * file_callback,
             /* 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;
         }
@@ -278,7 +278,7 @@ CossSwapDir::openStoreIO(StoreEntry & e, StoreIOState::STFNCB * file_callback,
 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++;
@@ -297,7 +297,7 @@ CossState::read_(char *buf, size_t size, off_t offset, STRCB * callback, void *c
     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;
 
@@ -339,7 +339,7 @@ CossState::write(char const *buf, size_t size, off_t offset, FREE * free_func)
     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);
@@ -421,7 +421,7 @@ CossState::doCallback(int errflag)
 {
     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;
@@ -457,7 +457,7 @@ void
 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;
 }
@@ -471,7 +471,7 @@ CossSwapDir::storeCossMemBufUnlock(StoreIOState::Pointer sio)
     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--;
 
@@ -499,7 +499,7 @@ CossSwapDir::sync()
         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! */
         }
 
@@ -519,11 +519,11 @@ CossMemBuf::maybeWrite(CossSwapDir * SD)
     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);
 }
@@ -532,8 +532,7 @@ void
 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));
@@ -551,8 +550,8 @@ CossSwapDir::createMemBuf(size_t start, sfileno curfn, int *collision)
     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;
@@ -563,7 +562,7 @@ CossSwapDir::createMemBuf(size_t start, sfileno curfn, int *collision)
 
     /* 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;
@@ -590,7 +589,7 @@ CossSwapDir::createMemBuf(size_t start, sfileno curfn, int *collision)
     }
 
     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++;
 
@@ -618,11 +617,9 @@ CossState::~CossState()
 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' : '.'));
 }
 
index 3ff0e214ffd60751b6e46f2cc52c81d7924b05f7..9691bed30900960e84c6ee12ceeaa31bdb03e670 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -82,11 +82,9 @@ UFSSwapDir::parseSizeL1L2()
     /* 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;
@@ -273,9 +271,8 @@ UFSSwapDir::~UFSSwapDir()
 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);
 }
 
@@ -291,15 +288,14 @@ UFSSwapDir::doubleCheck(StoreEntry & e)
     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;
     }
@@ -378,8 +374,7 @@ UFSSwapDir::maintain()
      * 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);
 
@@ -401,8 +396,9 @@ UFSSwapDir::maintain()
     }
 
     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);
 }
 
 /*
@@ -414,8 +410,7 @@ UFSSwapDir::maintain()
 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);
@@ -429,8 +424,7 @@ UFSSwapDir::reference(StoreEntry &e)
 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);
@@ -504,7 +498,7 @@ UFSSwapDir::createDirectory(const char *path, int should_exist)
 
     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);
         }
@@ -516,7 +510,7 @@ UFSSwapDir::createDirectory(const char *path, int should_exist)
 
     } 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",
@@ -533,12 +527,12 @@ UFSSwapDir::pathIsDirectory(const char *path)const
     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;
     }
 
@@ -581,7 +575,7 @@ UFSSwapDir::createSwapSubDirs()
         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);
@@ -637,11 +631,11 @@ UFSSwapDir::openLog()
     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);
@@ -659,8 +653,7 @@ UFSSwapDir::closeLog()
 
     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;
 
@@ -699,7 +692,8 @@ UFSSwapDir::addDiskRestore(const cache_key * key,
                            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();
@@ -749,14 +743,14 @@ UFSSwapDir::closeTmpSwapLog()
     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 *
@@ -773,7 +767,7 @@ UFSSwapDir::openTmpSwapLog(int *clean_flag, int *zero_flag)
     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);
@@ -790,7 +784,7 @@ UFSSwapDir::openTmpSwapLog(int *clean_flag, int *zero_flag)
     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.");
     }
 
@@ -799,7 +793,7 @@ UFSSwapDir::openTmpSwapLog(int *clean_flag, int *zero_flag)
     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");
     }
 
@@ -877,8 +871,7 @@ UFSSwapDir::writeCleanStart()
     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)
@@ -930,9 +923,8 @@ UFSCleanLog::write(StoreEntry const &e)
     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);
@@ -960,10 +952,8 @@ UFSSwapDir::writeCleanDone()
     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);
@@ -1080,12 +1070,12 @@ UFSSwapDir::DirClean(int swap_index)
     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)
@@ -1097,7 +1087,7 @@ UFSSwapDir::DirClean(int swap_index)
                 return 0;
         }
 
-        debug(50, 0) ("storeDirClean: %s: %s\n", p1, xstrerror());
+        debugs(50, 0, "storeDirClean: " << p1 << ": " << xstrerror());
         safeunlink(p1, 1);
         return 0;
     }
@@ -1127,13 +1117,13 @@ UFSSwapDir::DirClean(int swap_index)
         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;
 }
 
@@ -1267,7 +1257,9 @@ UFSSwapDir::validFileno(sfileno filn, int flag) const
 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));
 }
@@ -1275,7 +1267,8 @@ UFSSwapDir::unlinkFile(sfileno f)
 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);
@@ -1289,8 +1282,7 @@ UFSSwapDir::unlink(StoreEntry & e)
 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);
 }
 
@@ -1307,8 +1299,7 @@ UFSSwapDir::replacementRemove(StoreEntry * e)
 
     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);
 }
index 7966c40907a3fd788ec90172e16c2865acd5af2e..fa395e2a2f897392d533198af2c87e61a81c913d 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -103,8 +103,11 @@ UFSStoreState::ioCompletedNotification()
 {
     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();
 
@@ -113,15 +116,21 @@ UFSStoreState::ioCompletedNotification()
 
     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();
@@ -149,15 +158,17 @@ UFSStoreState::openDone()
     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());
@@ -181,8 +192,8 @@ UFSStoreState::closeCompleted()
 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();
 }
 
@@ -196,15 +207,15 @@ UFSStoreState::read_(char *buf, size_t size, off_t offset, STRCB * callback, voi
     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;
@@ -223,7 +234,8 @@ UFSStoreState::read_(char *buf, size_t size, off_t offset, STRCB * callback, voi
 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");
@@ -290,8 +302,9 @@ UFSStoreState::readCompleted(const char *buf, int len, int errflag, RefCount<Rea
 {
     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;
@@ -330,8 +343,9 @@ UFSStoreState::readCompleted(const char *buf, int len, int errflag, RefCount<Rea
 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
@@ -363,7 +377,7 @@ UFSStoreState::writeCompleted(int errflag, size_t len, RefCount<WriteRequest> wr
 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
@@ -439,8 +453,7 @@ UFSStoreState::kickReadQueue()
     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;
 
@@ -455,7 +468,7 @@ UFSStoreState::kickReadQueue()
 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;
@@ -547,7 +560,7 @@ UFSStrategy::open(SwapDir * SD, StoreEntry * e, StoreIOState::STFNCB * file_call
                   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);
@@ -584,7 +597,7 @@ UFSStrategy::create(SwapDir * SD, StoreEntry * e, StoreIOState::STFNCB * file_ca
     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? */
 
index 84767f5d8c430ad615bf1633df5eb574727245d7..ccab8e80b7006cc749ce1d43a3a977368572e818 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $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
@@ -73,8 +73,7 @@ RebuildState::RebuildState (RefCount<UFSSwapDir> aSwapDir) : sd (aSwapDir), e(NU
     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()
@@ -146,7 +145,7 @@ RebuildState::rebuildFromDirectory()
     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);
@@ -155,8 +154,7 @@ RebuildState::rebuildFromDirectory()
         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) {
@@ -167,8 +165,7 @@ RebuildState::rebuildFromDirectory()
         /* 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;
@@ -176,18 +173,16 @@ RebuildState::rebuildFromDirectory()
         }
 
         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;
@@ -202,7 +197,7 @@ RebuildState::rebuildFromDirectory()
         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;
@@ -211,13 +206,13 @@ RebuildState::rebuildFromDirectory()
         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);
@@ -226,7 +221,7 @@ RebuildState::rebuildFromDirectory()
         tlv_list = NULL;
 
         if (storeKeyNull(key)) {
-            debug(47, 1) ("commonUfsDirRebuildFromDirectory: NULL key\n");
+            debugs(47, 1, "commonUfsDirRebuildFromDirectory: NULL key");
             sd->unlinkFile(filn);
             continue;
         }
@@ -239,8 +234,10 @@ RebuildState::rebuildFromDirectory()
         } 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;
         }
@@ -324,8 +321,7 @@ RebuildState::rebuildFromSwapLog()
         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;
@@ -350,10 +346,11 @@ RebuildState::rebuildFromSwapLog()
          */
         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;
@@ -397,8 +394,7 @@ RebuildState::rebuildFromSwapLog()
             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++;
 
@@ -459,7 +455,7 @@ RebuildState::rebuildFromSwapLog()
                 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;
@@ -469,8 +465,10 @@ RebuildState::rebuildFromSwapLog()
              * 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
@@ -535,11 +533,10 @@ RebuildState::getNextFile(sfileno * filn_p, int *size)
 {
     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;
@@ -569,16 +566,14 @@ RebuildState::getNextFile(sfileno * filn_p, int *size)
             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);
             }
         }
 
@@ -586,29 +581,31 @@ RebuildState::getNextFile(sfileno * filn_p, int *size)
             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++;
 
index e73985d5eecff1ddd434439971314c50d1b297f8..f8b32ca42be68357a347957c0e271dda218c48af 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -376,7 +376,7 @@ FtpStateData::ftpSocketClosed(int fdnotused, void *data)
 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;
@@ -397,7 +397,7 @@ FtpStateData::FtpStateData(FwdState *theFwdState) : ServerStateData(theFwdState)
 
 FtpStateData::~FtpStateData()
 {
-    debug(9, 3) ("~ftpStateData: %s\n", entry->url());
+    debugs(9, 3, "~ftpStateData: " << entry->url()  );
 
     entry->unregisterAbort();
 
@@ -489,13 +489,13 @@ FtpStateData::ftpTimeout(int fd, void *data)
 {
     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);
@@ -576,7 +576,7 @@ FtpStateData::listingStart()
             /* 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;
         }
     }
@@ -1107,7 +1107,7 @@ FtpStateData::parseListing()
     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;
     }
 
@@ -1123,15 +1123,16 @@ FtpStateData::parseListing()
 
     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 */
@@ -1139,7 +1140,7 @@ FtpStateData::parseListing()
     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)
@@ -1150,7 +1151,7 @@ FtpStateData::parseListing()
 
         xstrncpy(line, s, linelen);
 
-        debug(9, 7) ("ftpParseListing: {%s}\n", line);
+        debugs(9, 7, "ftpParseListing: {" << line << "}");
 
         if (!strncmp(line, "total", 5))
             continue;
@@ -1186,7 +1187,7 @@ FtpStateData::dataDescriptor() const {
 void
 FtpStateData::dataComplete()
 {
-    debug(9, 3) ("ftpDataComplete\n");
+    debugs(9, 3, "ftpDataComplete");
     /* Connection closed; transfer done. */
 
     if (data.fd > -1) {
@@ -1303,7 +1304,7 @@ FtpStateData::dataRead(int fd, char *buf, size_t len, comm_err_t errflag, int xe
     }
 
     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);
@@ -1528,9 +1529,10 @@ FtpStateData::start()
 
     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);
@@ -1572,7 +1574,7 @@ void
 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);
@@ -1599,7 +1601,7 @@ FtpStateData::ftpWriteCommandCallback(int fd, char *buf, size_t size, comm_err_t
 {
     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);
@@ -1611,7 +1613,7 @@ FtpStateData::ftpWriteCommandCallback(int fd, char *buf, size_t size, comm_err_t
         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;
@@ -1632,7 +1634,7 @@ FtpStateData::ftpParseControlReply(char *buf, size_t len, int *codep, int *used)
     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
      */
@@ -1645,15 +1647,15 @@ FtpStateData::ftpParseControlReply(char *buf, size_t len, int *codep, int *used)
 
     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);
@@ -1662,7 +1664,7 @@ FtpStateData::ftpParseControlReply(char *buf, size_t len, int *codep, int *used)
         if (complete)
             break;
 
-        debug(9, 3) ("ftpParseControlReply: s = {%s}\n", s);
+        debugs(9, 3, "ftpParseControlReply: s = {" << s << "}");
 
         linelen = strcspn(s, crlf) + 1;
 
@@ -1687,7 +1689,7 @@ FtpStateData::ftpParseControlReply(char *buf, size_t len, int *codep, int *used)
 
         xstrncpy(list->key, s + offset, linelen - offset);
 
-        debug(9, 7) ("%d %s\n", code, list->key);
+        debugs(9, 7, "" << code << " " << list->key);
 
         *tail = list;
 
@@ -1714,7 +1716,7 @@ FtpStateData::ftpParseControlReply(char *buf, size_t len, int *codep, int *used)
 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 */
@@ -1740,7 +1742,7 @@ FtpStateData::ftpReadControlReply(int fd, char *buf, size_t len, comm_err_t errf
 {
     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);
@@ -1763,7 +1765,7 @@ FtpStateData::ftpReadControlReply(int fd, char *buf, size_t len, comm_err_t errf
 
 
     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);
@@ -1838,8 +1840,7 @@ FtpStateData::handleControlReply()
      */
     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);
 }
@@ -1850,7 +1851,7 @@ static void
 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++;
@@ -1867,8 +1868,7 @@ ftpReadWelcome(FtpStateData * ftpState)
         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 {
@@ -1895,7 +1895,7 @@ static void
 ftpReadUser(FtpStateData * ftpState)
 {
     int code = ftpState->ctrl.replycode;
-    debug(9, 3) ("ftpReadUser\n");
+    debugs(9, 3, "ftpReadUser");
 
     if (code == 230) {
         ftpReadPass(ftpState);
@@ -1918,7 +1918,7 @@ static void
 ftpReadPass(FtpStateData * ftpState)
 {
     int code = ftpState->ctrl.replycode;
-    debug(9, 3) ("ftpReadPass\n");
+    debugs(9, 3, "ftpReadPass");
 
     if (code == 230) {
         ftpSendType(ftpState);
@@ -1980,7 +1980,7 @@ ftpReadType(FtpStateData * 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());
@@ -2016,8 +2016,7 @@ static void
 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;
@@ -2026,7 +2025,7 @@ ftpTraverseDirectory(FtpStateData * ftpState)
     /* 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;
     }
@@ -2044,7 +2043,7 @@ ftpTraverseDirectory(FtpStateData * ftpState)
     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;
     }
@@ -2054,7 +2053,7 @@ static void
 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;
@@ -2073,7 +2072,7 @@ static void
 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 */
@@ -2103,7 +2102,7 @@ static void
 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;
@@ -2115,7 +2114,7 @@ ftpReadMkdir(FtpStateData * ftpState)
     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);
@@ -2142,7 +2141,7 @@ static void
 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;
     }
@@ -2163,7 +2162,7 @@ static void
 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);
@@ -2196,16 +2195,17 @@ static void
 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) {
@@ -2256,8 +2256,7 @@ ftpSendPasv(FtpStateData * ftpState)
     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;
     }
@@ -2270,7 +2269,7 @@ ftpSendPasv(FtpStateData * ftpState)
                        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);
@@ -2313,24 +2312,27 @@ ftpReadPasv(FtpStateData * 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;
     }
@@ -2338,7 +2340,10 @@ ftpReadPasv(FtpStateData * ftpState)
     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;
     }
@@ -2346,14 +2351,20 @@ ftpReadPasv(FtpStateData * ftpState)
     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;
         }
@@ -2372,7 +2383,7 @@ ftpReadPasv(FtpStateData * ftpState)
 
     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);
 }
@@ -2381,10 +2392,10 @@ void
 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);
@@ -2421,8 +2432,7 @@ ftpOpenListenSocket(FtpStateData * ftpState, int fallback)
     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;
     }
 
@@ -2441,10 +2451,10 @@ ftpOpenListenSocket(FtpStateData * ftpState, int fallback)
                    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;
     }
 
@@ -2468,13 +2478,14 @@ ftpSendPort(FtpStateData * ftpState)
     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;
@@ -2493,11 +2504,11 @@ static void
 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);
     }
 
@@ -2510,7 +2521,7 @@ ftpAcceptDataConnection(int fd, int newfd, ConnectionDetail *details,
                         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;
@@ -2524,7 +2535,10 @@ ftpAcceptDataConnection(int fd, int newfd, ConnectionDetail *details,
         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;
@@ -2532,7 +2546,7 @@ ftpAcceptDataConnection(int fd, int newfd, ConnectionDetail *details,
     }
 
     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;
@@ -2541,7 +2555,7 @@ ftpAcceptDataConnection(int fd, int newfd, ConnectionDetail *details,
     /* 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;
 
@@ -2565,7 +2579,7 @@ ftpAcceptDataConnection(int fd, int newfd, ConnectionDetail *details,
 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;
@@ -2576,7 +2590,7 @@ ftpRestOrList(FtpStateData * ftpState)
             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);
@@ -2613,19 +2627,19 @@ ftpReadStor(FtpStateData * 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
@@ -2636,13 +2650,13 @@ void FtpStateData::readStor() {
                        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);
     }
 }
@@ -2682,14 +2696,14 @@ static void
 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 {
@@ -2729,7 +2743,7 @@ static void
 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 */
@@ -2773,11 +2787,11 @@ static void
 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;
@@ -2812,7 +2826,7 @@ static void
 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. */
@@ -2822,8 +2836,7 @@ ftpReadTransferDone(FtpStateData * ftpState)
 
         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;
@@ -2852,11 +2865,10 @@ static void
 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;
     }
@@ -2939,7 +2951,7 @@ FtpStateData::hackShortcut(FTPSM * nextState)
 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 */
@@ -3064,11 +3076,10 @@ ftpSendReply(FtpStateData * ftpState)
     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;
index 4b7515082fa114622775c372b8367e9572e5b682..3848ebdaa7df15aef8bbbab27b1ce38103ec5eca 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -399,8 +399,7 @@ gopherToHTML(GopherStateData * gopherState, char *inbuf, int len)
             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;
             }
 
@@ -413,8 +412,7 @@ gopherToHTML(GopherStateData * gopherState, char *inbuf, int 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;
                 }
 
@@ -444,8 +442,7 @@ gopherToHTML(GopherStateData * gopherState, char *inbuf, int 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;
                 }
 
@@ -708,7 +705,7 @@ gopherTimeout(int fd, void *data)
 {
     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));
 
@@ -761,7 +758,7 @@ gopherReadReply(int fd, char *buf, size_t len, comm_err_t flag, int xerrno, void
         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);
@@ -774,7 +771,7 @@ gopherReadReply(int fd, char *buf, size_t len, comm_err_t flag, int xerrno, void
     }
 
     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;
@@ -829,8 +826,7 @@ gopherSendComplete(int fd, char *buf, size_t size, comm_err_t errflag, int xerrn
 {
     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);
@@ -921,7 +917,7 @@ gopherSendRequest(int fd, void *data)
         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))
@@ -947,7 +943,7 @@ gopherStart(FwdState * fwd)
 
     gopherState->fwd = fwd;
 
-    debug(10, 3) ("gopherStart: %s\n", entry->url());
+    debugs(10, 3, "gopherStart: " << entry->url()  );
 
     statCounter.server.all.requests++;
 
index fefe816708dad7a40c815a3a53d2afcdabcd6854..3d3adefb6012bbc8c54952b9384d1e8473db3f31 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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?
@@ -96,8 +96,7 @@ helperOpenServers(helper * hlp)
     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);
 
@@ -124,7 +123,7 @@ helperOpenServers(helper * hlp)
                         &hIpc);
 
         if (pid < 0) {
-            debug(84, 1) ("WARNING: Cannot run '%s' process.\n", progname);
+            debugs(84, 1, "WARNING: Cannot run '" << progname << "' process.");
             continue;
         }
 
@@ -198,8 +197,7 @@ helperStatefulOpenServers(statefulhelper * hlp)
     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);
 
@@ -226,7 +224,7 @@ helperStatefulOpenServers(statefulhelper * hlp)
                         &hIpc);
 
         if (pid < 0) {
-            debug(84, 1) ("WARNING: Cannot run '%s' process.\n", progname);
+            debugs(84, 1, "WARNING: Cannot run '" << progname << "' process.");
             continue;
         }
 
@@ -289,7 +287,7 @@ helperSubmit(helper * hlp, const char *buf, HLPCB * callback, void *data)
     helper_server *srv;
 
     if (hlp == NULL) {
-        debug(84, 3) ("helperSubmit: hlp == NULL\n");
+        debugs(84, 3, "helperSubmit: hlp == NULL");
         callback(data, NULL);
         return;
     }
@@ -303,7 +301,7 @@ helperSubmit(helper * hlp, const char *buf, HLPCB * callback, void *data)
     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
@@ -316,7 +314,7 @@ helperStatefulSubmit(statefulhelper * hlp, const char *buf, HLPSCB * callback, v
     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;
     }
@@ -333,7 +331,7 @@ helperStatefulSubmit(statefulhelper * hlp, const char *buf, HLPSCB * callback, v
     }
 
     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 
@@ -350,10 +348,10 @@ helperStatefulSubmit(statefulhelper * hlp, const char *buf, HLPSCB * callback, v
         }
 
         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 {
@@ -363,7 +361,7 @@ helperStatefulSubmit(statefulhelper * hlp, const char *buf, HLPSCB * callback, v
             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 *
@@ -375,15 +373,15 @@ helperStatefulDefer(statefulhelper * hlp)
 
     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;
     }
 
@@ -418,7 +416,7 @@ helperStatefulDefer(statefulhelper * hlp)
 
     if (rv == NULL)
     {
-        debug(84, 1) ("helperStatefulDefer: None available.\n");
+        debugs(84, 1, "helperStatefulDefer: None available.");
         return NULL;
     }
 
@@ -455,8 +453,7 @@ helperStatefulReset(helper_stateful_server * srv)
     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);
@@ -634,8 +631,7 @@ helperShutdown(helper * hlp)
         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;
         }
 
@@ -645,14 +641,12 @@ helperShutdown(helper * hlp)
         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;
         }
 
@@ -665,8 +659,7 @@ helperShutdown(helper * hlp)
         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
          */
@@ -676,9 +669,10 @@ helperShutdown(helper * hlp)
         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);
@@ -706,8 +700,7 @@ helperStatefulShutdown(statefulhelper * hlp)
         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;
         }
 
@@ -716,26 +709,22 @@ helperStatefulShutdown(statefulhelper * hlp)
         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;
         }
 
@@ -748,8 +737,8 @@ helperStatefulShutdown(statefulhelper * hlp)
         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
          */
@@ -759,9 +748,9 @@ helperStatefulShutdown(statefulhelper * hlp)
         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);
@@ -802,8 +791,8 @@ helperFree(helper * 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);
 }
@@ -816,8 +805,8 @@ helperStatefulFree(statefulhelper * 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);
 }
@@ -881,16 +870,16 @@ helperServerFree(int fd, void *data)
     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);
         }
@@ -944,16 +933,15 @@ helperStatefulServerFree(int fd, void *data)
     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);
         }
@@ -983,12 +971,11 @@ helperHandleRead(int fd, char *buf, size_t len, comm_err_t flag, int xerrno, voi
         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);
 
@@ -997,12 +984,14 @@ helperHandleRead(int fd, char *buf, size_t len, comm_err_t flag, int xerrno, voi
 
     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';
     }
@@ -1012,7 +1001,7 @@ helperHandleRead(int fd, char *buf, size_t len, comm_err_t flag, int xerrno, voi
         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';
@@ -1054,8 +1043,10 @@ helperHandleRead(int fd, char *buf, size_t len, comm_err_t flag, int xerrno, voi
 
             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);
@@ -1089,12 +1080,13 @@ helperStatefulHandleRead(int fd, char *buf, size_t len, comm_err_t flag, int xer
         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);
 
@@ -1107,14 +1099,16 @@ helperStatefulHandleRead(int fd, char *buf, size_t len, comm_err_t flag, int xer
 
     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';
@@ -1136,10 +1130,12 @@ helperStatefulHandleRead(int fd, char *buf, size_t len, comm_err_t flag, int xer
                     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;
@@ -1149,7 +1145,7 @@ helperStatefulHandleRead(int fd, char *buf, size_t len, comm_err_t flag, int xer
                 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");
                 }
@@ -1163,7 +1159,7 @@ helperStatefulHandleRead(int fd, char *buf, size_t len, comm_err_t flag, int xer
                 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:
@@ -1171,7 +1167,7 @@ helperStatefulHandleRead(int fd, char *buf, size_t len, comm_err_t flag, int xer
             }
 
         } else {
-            debug(84, 1) ("StatefulHandleRead: no callback data registered\n");
+            debugs(84, 1, "StatefulHandleRead: no callback data registered");
         }
 
         srv->flags.busy = 0;
@@ -1222,14 +1218,15 @@ Enqueue(helper * hlp, helper_request * r)
 
     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
@@ -1253,11 +1250,11 @@ StatefulEnqueue(statefulhelper * hlp, helper_stateful_request * r)
 
     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
@@ -1277,11 +1274,11 @@ StatefulServerEnqueue(helper_stateful_server * srv, helper_stateful_request * r)
      * 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." );  */
 }
 
 
@@ -1378,7 +1375,7 @@ StatefulGetFirstAvailable(statefulhelper * hlp)
 {
     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;
@@ -1401,7 +1398,7 @@ StatefulGetFirstAvailable(statefulhelper * hlp)
         return srv;
     }
 
-    debug(84, 5) ("StatefulGetFirstAvailable: None available.\n");
+    debugs(84, 5, "StatefulGetFirstAvailable: None available.");
     return NULL;
 }
 
@@ -1418,8 +1415,7 @@ helperDispatchWriteDone(int fd, char *buf, size_t len, comm_err_t flag, int xerr
 
     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;
     }
 
@@ -1443,7 +1439,7 @@ helperDispatch(helper_server * srv, helper_request * r)
     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;
     }
@@ -1480,8 +1476,8 @@ helperDispatch(helper_server * srv, helper_request * r)
                    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++;
 }
@@ -1500,12 +1496,12 @@ helperStatefulDispatch(helper_stateful_server * srv, helper_stateful_request * r
     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. */
@@ -1543,8 +1539,10 @@ helperStatefulDispatch(helper_stateful_server * srv, helper_stateful_request * r
                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++;
 }
index 2590e22afddac1b73e7aa4037604104877682dbd..44624b1f4aeca6af586fa4ee33238756baf142f4 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -310,7 +310,7 @@ htcpHexdump(const char *tag, const char *s, int sz)
     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++) {
@@ -320,7 +320,7 @@ htcpHexdump(const char *tag, const char *s, int sz)
         if (k < 15 && i < (sz - 1))
             continue;
 
-        debug(31, 3) ("\t%s\n", hex);
+        debugs(31, 3, "\t" << hex);
 
         memset(hex, '\0', 80);
     }
@@ -363,7 +363,7 @@ htcpBuildCountstr(char *buf, size_t buflen, const char *s)
 
     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);
 
@@ -415,7 +415,7 @@ htcpBuildSpecifier(char *buf, size_t buflen, htcpStuff * stuff)
 
     off += s;
 
-    debug(31, 3) ("htcpBuildSpecifier: size %d\n", (int) off);
+    debugs(31, 3, "htcpBuildSpecifier: size " << (int) off);
 
     return off;
 }
@@ -455,12 +455,12 @@ htcpBuildTstOpData(char *buf, size_t buflen, htcpStuff * stuff)
     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;
@@ -478,8 +478,7 @@ static ssize_t
 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) {
 
@@ -519,7 +518,7 @@ htcpBuildData(char *buf, size_t buflen, htcpStuff * stuff)
 
     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;
 
@@ -551,7 +550,7 @@ htcpBuildData(char *buf, size_t buflen, htcpStuff * stuff)
         xmemcpy(buf, &hdrSquid, hdr_sz);
     }
 
-    debug(31, 3) ("htcpBuildData: size %d\n", (int) off);
+    debugs(31, 3, "htcpBuildData: size " << (int) off);
 
     return off;
 }
@@ -598,7 +597,7 @@ htcpBuildPacket(char *buf, size_t buflen, htcpStuff * stuff)
 
     xmemcpy(buf, &hdr, hdr_sz);
 
-    debug(31, 3) ("htcpBuildPacket: size %d\n", (int) off);
+    debugs(31, 3, "htcpBuildPacket: size " << (int) off);
 
     return off;
 }
@@ -618,7 +617,7 @@ htcpSend(const char *buf, int len, struct sockaddr_in *to)
                         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++;
 }
@@ -670,7 +669,7 @@ htcpUnpackSpecifier(char *buf, int sz)
     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;
     }
@@ -688,7 +687,7 @@ htcpUnpackSpecifier(char *buf, int sz)
     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;
     }
@@ -711,7 +710,7 @@ htcpUnpackSpecifier(char *buf, int sz)
     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;
     }
@@ -734,7 +733,7 @@ htcpUnpackSpecifier(char *buf, int sz)
     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;
     }
@@ -751,7 +750,7 @@ htcpUnpackSpecifier(char *buf, int sz)
 
     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 
@@ -788,7 +787,7 @@ htcpUnpackDetail(char *buf, int sz)
     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;
     }
@@ -806,7 +805,7 @@ htcpUnpackDetail(char *buf, int sz)
     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;
     }
@@ -829,7 +828,7 @@ htcpUnpackDetail(char *buf, int sz)
     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;
     }
@@ -846,7 +845,7 @@ htcpUnpackDetail(char *buf, int sz)
 
     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 
@@ -892,7 +891,7 @@ htcpTstReply(htcpDataHeader * dhdr, StoreEntry * e, htcpSpecifier * spec, struct
     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)
@@ -908,7 +907,7 @@ htcpTstReply(htcpDataHeader * dhdr, StoreEntry * e, htcpSpecifier * spec, struct
                    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();
 
@@ -922,7 +921,7 @@ htcpTstReply(htcpDataHeader * dhdr, StoreEntry * e, htcpSpecifier * spec, struct
 
         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();
 
@@ -940,7 +939,7 @@ htcpTstReply(htcpDataHeader * dhdr, StoreEntry * e, htcpSpecifier * spec, struct
 
         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);
@@ -954,7 +953,7 @@ htcpTstReply(htcpDataHeader * dhdr, StoreEntry * e, htcpSpecifier * spec, struct
 
     if (!pktlen)
     {
-        debug(31, 1) ("htcpTstReply: htcpBuildPacket() failed\n");
+        debugs(31, 1, "htcpTstReply: htcpBuildPacket() failed");
         return;
     }
 
@@ -984,7 +983,7 @@ htcpClrReply(htcpDataHeader * dhdr, int purgeSucceeded, struct sockaddr_in *from
 
     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;
 
@@ -992,7 +991,7 @@ htcpClrReply(htcpDataHeader * dhdr, int purgeSucceeded, struct sockaddr_in *from
 
     if (pktlen == 0)
     {
-        debug(31, 1) ("htcpClrReply: htcpBuildPacket() failed\n");
+        debugs(31, 1, "htcpClrReply: htcpBuildPacket() failed");
         return;
     }
 
@@ -1003,7 +1002,7 @@ static void
 
 htcpHandleNop(htcpDataHeader * hdr, char *buf, int sz, struct sockaddr_in *from)
 {
-    debug(31, 3) ("htcpHandleNop: Unimplemented\n");
+    debugs(31, 3, "htcpHandleNop: Unimplemented");
 }
 
 void
@@ -1013,7 +1012,7 @@ htcpSpecifier::checkHit()
     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;
     }
@@ -1021,7 +1020,7 @@ htcpSpecifier::checkHit()
     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());
@@ -1038,21 +1037,21 @@ htcpSpecifier::created (StoreEntry *e)
     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:
@@ -1062,7 +1061,7 @@ 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();
 }
 
@@ -1075,7 +1074,7 @@ htcpClrStore(const htcpSpecifier * s)
     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;
     }
 
@@ -1083,7 +1082,7 @@ htcpClrStore(const htcpSpecifier * s)
     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;
     }
 
@@ -1096,10 +1095,10 @@ htcpClrStore(const htcpSpecifier * s)
     }
 
     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;
     }
 }
@@ -1108,7 +1107,7 @@ static void
 
 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);
@@ -1133,7 +1132,11 @@ htcpHandleTstResponse(htcpDataHeader * hdr, char *buf, int sz, struct sockaddr_i
 
     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;
     }
 
@@ -1141,7 +1144,7 @@ htcpHandleTstResponse(htcpDataHeader * hdr, char *buf, int sz, struct sockaddr_i
 
     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;
     }
 
@@ -1149,30 +1152,30 @@ htcpHandleTstResponse(htcpDataHeader * hdr, char *buf, int sz, struct sockaddr_i
 
     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;
         }
 
@@ -1186,7 +1189,7 @@ htcpHandleTstResponse(htcpDataHeader * hdr, char *buf, int sz, struct sockaddr_i
             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();
 
@@ -1203,7 +1206,7 @@ htcpHandleTstRequest(htcpDataHeader * dhdr, char *buf, int sz, struct sockaddr_i
 
     if (sz == 0)
     {
-        debug(31, 3) ("htcpHandleTst: nothing to do\n");
+        debugs(31, 3, "htcpHandleTst: nothing to do");
         return;
     }
 
@@ -1219,29 +1222,26 @@ htcpHandleTstRequest(htcpDataHeader * dhdr, char *buf, int sz, struct sockaddr_i
 
     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();
 }
 
@@ -1260,14 +1260,14 @@ static void
 
 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
@@ -1277,7 +1277,7 @@ htcpHandleClr(htcpDataHeader * hdr, char *buf, int sz, struct sockaddr_in *from)
     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;
 
@@ -1285,7 +1285,7 @@ htcpHandleClr(htcpDataHeader * hdr, char *buf, int sz, struct sockaddr_in *from)
 
     if (sz == 0)
     {
-        debug(31, 4) ("htcpHandleClr: nothing to do\n");
+        debugs(31, 4, "htcpHandleClr: nothing to do");
         return;
     }
 
@@ -1293,22 +1293,19 @@ htcpHandleClr(htcpDataHeader * hdr, char *buf, int sz, struct sockaddr_in *from)
 
     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
@@ -1340,7 +1337,7 @@ htcpHandleData(char *buf, int sz, struct sockaddr_in *from)
 
     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;
     }
 
@@ -1362,27 +1359,24 @@ htcpHandleData(char *buf, int sz, struct sockaddr_in *from)
 
     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;
     }
 
@@ -1396,7 +1390,7 @@ htcpHandleData(char *buf, int sz, struct sockaddr_in *from)
 
     sz -= sizeof(htcpDataHeader);
 
-    debug(31, 3) ("htcpHandleData: sz = %d\n", sz);
+    debugs(31, 3, "htcpHandleData: sz = " << sz);
 
     htcpHexdump("htcpHandleData", buf, sz);
 
@@ -1437,7 +1431,7 @@ htcpHandle(char *buf, int sz, struct sockaddr_in *from)
 
     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;
     }
 
@@ -1450,25 +1444,25 @@ htcpHandle(char *buf, int sz, struct sockaddr_in *from)
     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;
     }
 
@@ -1491,8 +1485,8 @@ htcpRecv(int fd, void *data)
     /* 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++;
@@ -1512,7 +1506,7 @@ void
 htcpInit(void)
 {
     if (Config.Port.htcp <= 0) {
-        debug(31, 1) ("HTCP Disabled.\n");
+        debugs(31, 1, "HTCP Disabled.");
         return;
     }
 
@@ -1530,8 +1524,7 @@ htcpInit(void)
 
     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();
@@ -1548,8 +1541,7 @@ htcpInit(void)
 
         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 {
@@ -1619,7 +1611,7 @@ htcpQuery(StoreEntry * e, HttpRequest * req, peer * p)
     mb.clean();
 
     if (!pktlen) {
-        debug(31, 1) ("htcpQuery: htcpBuildPacket() failed\n");
+        debugs(31, 1, "htcpQuery: htcpBuildPacket() failed");
         return;
     }
 
@@ -1628,7 +1620,7 @@ htcpQuery(StoreEntry * e, HttpRequest * req, peer * p)
     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));
 }
 
 /*
@@ -1642,7 +1634,7 @@ htcpSocketShutdown(void)
         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);
     }
 
@@ -1674,7 +1666,7 @@ htcpSocketClose(void)
     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;
     }
index ed296d46f2f4ac8529cb06bc24aa7c70dcc4dbf6..d2e5e54493cbde1d82f7f4c3b8841d4f57732f41 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -161,7 +161,7 @@ static void
 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;
 }
 
@@ -182,7 +182,7 @@ httpTimeout(int fd, void *data)
 {
     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));
@@ -467,7 +467,7 @@ HttpStateData::cacheableReply()
          */
 
         if (!refreshIsCachable(entry)) {
-            debug(22, 3) ("refreshIsCachable() returned non-cacheable..\n");
+            debugs(22, 3, "refreshIsCachable() returned non-cacheable..");
             return 0;
         }
 
@@ -646,7 +646,7 @@ httpMakeVaryMark(HttpRequest * request, HttpReply const * reply)
     vary.clean();
 #endif
 
-    debug(11, 3) ("httpMakeVaryMark: %s\n", vstr.buf());
+    debugs(11, 3, "httpMakeVaryMark: " << vstr.buf());
     return vstr.buf();
 }
 
@@ -674,8 +674,8 @@ HttpStateData::keepaliveAccounting(HttpReply *reply)
             _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;
         }
     }
@@ -688,8 +688,7 @@ HttpStateData::checkDateSkew(HttpReply *reply)
         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!");
     }
 }
 
@@ -707,7 +706,7 @@ HttpStateData::processReplyHeader()
      */
     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);
 
@@ -734,8 +733,7 @@ HttpStateData::processReplyHeader()
 
     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);
@@ -791,7 +789,7 @@ HttpStateData::haveParsedReplyHeaders()
     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);
@@ -885,9 +883,7 @@ HttpStateData::statusIfComplete() const
      * 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;
     }
 
@@ -912,19 +908,18 @@ HttpStateData::statusIfComplete() const
 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)
@@ -973,7 +968,7 @@ HttpStateData::readReply (size_t len, comm_err_t flag, int xerrno)
      */
 
     if (flag == COMM_ERR_CLOSING) {
-        debug (11,3)("http socket closing\n");
+        debugs(11, 3, "http socket closing");
         return;
     }
 
@@ -985,7 +980,7 @@ HttpStateData::readReply (size_t len, comm_err_t flag, int xerrno)
     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);
@@ -1030,8 +1025,7 @@ HttpStateData::readReply (size_t len, comm_err_t flag, int xerrno)
 #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;
@@ -1184,7 +1178,7 @@ HttpStateData::processReplyBody()
         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) {
@@ -1197,7 +1191,7 @@ HttpStateData::processReplyBody()
             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;
@@ -1226,7 +1220,7 @@ HttpStateData::processReplyBody()
             return;
 
         case COMPLETE_NONPERSISTENT_MSG:
-            debug(11,5)("processReplyBody: COMPLETE_NONPERSISTENT_MSG\n");
+            debugs(11, 5, "processReplyBody: COMPLETE_NONPERSISTENT_MSG");
             serverComplete();
             return;
         }
@@ -1291,8 +1285,7 @@ void
 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();
@@ -1574,11 +1567,10 @@ HttpStateData::httpBuildRequestHeader(HttpRequest * request,
 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;
     }
 
@@ -1717,8 +1709,9 @@ HttpStateData::decideIfWeDoRanges (HttpRequest * orig_request)
             || 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;
 }
@@ -1759,7 +1752,7 @@ HttpStateData::sendRequest()
 {
     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;
@@ -1817,7 +1810,7 @@ HttpStateData::sendRequest()
 
     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;
@@ -1826,13 +1819,11 @@ HttpStateData::sendRequest()
 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;
     }
@@ -1860,13 +1851,13 @@ HttpStateData::doneSendingRequestBody()
     /* 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);
     }
 }
@@ -1890,9 +1881,7 @@ HttpStateData::handleMoreRequestBodyAvailable()
 
         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);
index 859c17c3ea834824d6e4b4d61b5b008795bd3c55..f4d31de57fccfbb4ff3319225b0f8aa93f4a0e37 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -94,7 +94,7 @@ icmpRecv(int unused1, void *unused2)
                       0);
 
     if (n < 0 && EAGAIN != errno) {
-        debug(37, 1) ("icmpRecv: recv: %s\n", xstrerror());
+        debugs(37, 1, "icmpRecv: recv: " << xstrerror());
 
         if (errno == ECONNREFUSED)
             icmpClose();
@@ -135,7 +135,7 @@ icmpRecv(int unused1, void *unused2)
         break;
 
     default:
-        debug(37, 1) ("icmpRecv: Bad opcode: %d\n", (int) preply.opcode);
+        debugs(37, 1, "icmpRecv: Bad opcode: " << (int) preply.opcode);
         break;
     }
 }
@@ -148,20 +148,20 @@ icmpSend(pingerEchoData * pkt, int len)
     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");
     }
 }
 
@@ -176,8 +176,8 @@ icmpHandleSourcePing(const struct sockaddr_in *from, const char *buf)
     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);
 }
@@ -195,7 +195,7 @@ icmpSourcePing(struct IN_ADDR to, const icp_common_t * header, const char *url)
     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;
@@ -224,7 +224,7 @@ void
 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
 }
@@ -264,11 +264,11 @@ icmpOpen(void)
 
     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
@@ -282,7 +282,7 @@ icmpClose(void)
     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_
 
@@ -297,9 +297,7 @@ icmpClose(void)
     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);
index 5fb415c62d376dc75eb73442f2c9258b7afce06b..72f04afa3948908ad3bda951fa77db35705fb9bc 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -131,7 +131,7 @@ void
 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)) {
@@ -264,12 +264,10 @@ icpUdpSend(int fd,
     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)
@@ -380,8 +378,7 @@ void
 
 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))
     {
@@ -498,17 +495,14 @@ _icp_common_t::handleReply(char *buf, struct sockaddr_in *from)
 {
     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);
@@ -520,7 +514,7 @@ icpHandleIcpV2(int fd, struct sockaddr_in from, char *buf, int len)
 {
     if (len <= 0)
     {
-        debug(12, 3) ("icpHandleIcpV2: ICP message is too small\n");
+        debugs(12, 3, "icpHandleIcpV2: ICP message is too small");
         return;
     }
 
@@ -531,7 +525,7 @@ icpHandleIcpV2(int fd, struct sockaddr_in from, char *buf, int len)
 
     if (len != header.length)
     {
-        debug(12, 3) ("icpHandleIcpV2: ICP message is too small\n");
+        debugs(12, 3, "icpHandleIcpV2: ICP message is too small");
         return;
     }
 
@@ -565,8 +559,8 @@ icpHandleIcpV2(int fd, struct sockaddr_in from, char *buf, int len)
         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;
     }
 }
@@ -578,16 +572,14 @@ icpPktDump(icp_common_t * pkt)
 
     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
@@ -631,8 +623,7 @@ icpHandleUdp(int sock, void *data)
             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;
         }
@@ -640,17 +631,17 @@ icpHandleUdp(int sock, void *data)
         (*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;
         }
 
@@ -661,10 +652,8 @@ icpHandleUdp(int sock, void *data)
         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));
     }
 }
 
@@ -706,9 +695,10 @@ icpConnectionsOpen(void)
     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();
@@ -729,8 +719,7 @@ icpConnectionsOpen(void)
                       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");
 
@@ -748,8 +737,7 @@ icpConnectionsOpen(void)
                     (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;
 }
@@ -765,7 +753,7 @@ icpConnectionShutdown(void)
         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);
     }
 
@@ -794,7 +782,7 @@ icpConnectionClose(void)
     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;
     }
index 2302f28d10defaf8653ff63c2285be43a2cba47c..8b8c5874b7efa5cc736b05b6159148d82fdf1132 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -87,8 +87,7 @@ void
 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)) {
@@ -110,7 +109,7 @@ icpHandleIcpV3(int fd, struct sockaddr_in from, char *buf, int len)
 {
     if (len <= 0)
     {
-        debug(12, 3) ("icpHandleIcpV3: ICP message is too small\n");
+        debugs(12, 3, "icpHandleIcpV3: ICP message is too small");
         return;
     }
 
@@ -121,7 +120,7 @@ icpHandleIcpV3(int fd, struct sockaddr_in from, char *buf, int len)
 
     if (len != header.length)
     {
-        debug(12, 3) ("icpHandleIcpV3: ICP message is too small\n");
+        debugs(12, 3, "icpHandleIcpV3: ICP message is too small");
         return;
     }
 
@@ -154,8 +153,7 @@ icpHandleIcpV3(int fd, struct sockaddr_in from, char *buf, int len)
         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;
     }
 }
index d1d4b2dc821aa38b61b7b2f27f769c72ab5b3202..178d875312ce06e21a269edb1499fd63589cc08a 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -107,8 +107,8 @@ static void
 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);
 }
 
@@ -175,7 +175,7 @@ identReadReply(int fd, char *buf, size_t len, comm_err_t flag, int xerrno, void
     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, ':'))) {
index 38e786a6a4f866273a41a10cb5a24479b6bf31b9..37aa418a4b0e2ce67094442fb8f7865bfe614515 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -51,8 +51,7 @@ internalStart(HttpRequest * request, StoreEntry * entry)
 {
     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);
index 5e921a957d66de02425635d52c25f63085010cab..42392e0f2b19bbff41eaa71dd3d998a9aafeebbd 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -135,12 +135,12 @@ ipcCreate(int type, const char *prog, const char *const args[], const char *name
         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;
         }
 
@@ -155,7 +155,7 @@ ipcCreate(int type, const char *prog, const char *const args[], const char *name
         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;
         }
 
@@ -169,7 +169,7 @@ ipcCreate(int type, const char *prog, const char *const args[], const char *name
         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;
         }
 
@@ -181,18 +181,18 @@ ipcCreate(int type, const char *prog, const char *const args[], const char *name
         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);
     }
 
@@ -201,38 +201,38 @@ ipcCreate(int type, const char *prog, const char *const args[], const char *name
         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);
     }
 
@@ -258,13 +258,13 @@ ipcCreate(int type, const char *prog, const char *const args[], const char *name
             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);
         }
 
@@ -306,14 +306,14 @@ ipcCreate(int type, const char *prog, const char *const args[], const char *name
     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) {
@@ -325,14 +325,14 @@ ipcCreate(int type, const char *prog, const char *const args[], const char *name
         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);
         }
     }
@@ -390,7 +390,7 @@ ipcCreate(int type, const char *prog, const char *const args[], const char *name
 
     debug_log = fdopen(2, "a+");
 
-    debug(54, 0) ("ipcCreate: %s: %s\n", prog, xstrerror());
+    debugs(54, 0, "ipcCreate: " << prog << ": " << xstrerror());
 
     _exit(1);
 
index 0f195f65a81b4a3fc826baf4a4d91d23223e8145..6e7f0c4ef989109bc4980d38449527130b9306d7 100755 (executable)
@@ -1,6 +1,6 @@
 
 /*
- * $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>
@@ -172,18 +172,16 @@ ipcCreate(int type, const char *prog, const char *const args[], const char *name
                                 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);
@@ -192,12 +190,12 @@ ipcCreate(int type, const char *prog, const char *const args[], const char *name
     }
 
     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);
     }
 
@@ -206,31 +204,29 @@ ipcCreate(int type, const char *prog, const char *const args[], const char *name
         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 */
@@ -251,7 +247,7 @@ ipcCreate(int type, const char *prog, const char *const args[], const char *name
     thread = _beginthreadex(NULL, 0, ipc_thread_1, &params, 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);
     }
 
@@ -264,14 +260,14 @@ ipcCreate(int type, const char *prog, const char *const args[], const char *name
     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);
     }
@@ -279,8 +275,8 @@ ipcCreate(int type, const char *prog, const char *const args[], const char *name
     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);
     }
@@ -289,14 +285,14 @@ ipcCreate(int type, const char *prog, const char *const args[], const char *name
     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);
     }
@@ -353,8 +349,8 @@ ipcSend(int cwfd, const char *buf, int len)
     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;
@@ -405,14 +401,14 @@ ipc_thread_1(void *in_params)
     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);
@@ -426,8 +422,8 @@ ipc_thread_1(void *in_params)
     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;
     }
 
@@ -436,25 +432,25 @@ ipc_thread_1(void *in_params)
     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;
     }
@@ -464,8 +460,7 @@ ipc_thread_1(void *in_params)
         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;
         }
@@ -474,8 +469,7 @@ ipc_thread_1(void *in_params)
         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;
         }
@@ -484,24 +478,23 @@ ipc_thread_1(void *in_params)
         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));
@@ -589,7 +582,8 @@ ipc_thread_1(void *in_params)
 
     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;
     }
@@ -600,8 +594,8 @@ ipc_thread_1(void *in_params)
         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;
         }
@@ -609,10 +603,9 @@ ipc_thread_1(void *in_params)
         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;
         }
@@ -620,18 +613,16 @@ ipc_thread_1(void *in_params)
         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;
         }
@@ -639,10 +630,9 @@ ipc_thread_1(void *in_params)
         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;
         }
@@ -650,18 +640,16 @@ ipc_thread_1(void *in_params)
         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;
         }
@@ -701,7 +689,7 @@ ipc_thread_1(void *in_params)
         (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;
     }
@@ -711,30 +699,27 @@ ipc_thread_1(void *in_params)
     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);
@@ -742,8 +727,8 @@ ipc_thread_1(void *in_params)
             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;
         }
     }
@@ -770,21 +755,21 @@ cleanup:
             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);
@@ -825,16 +810,16 @@ ipc_thread_2(void *in_params)
 
         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;
         }
 
@@ -846,14 +831,14 @@ ipc_thread_2(void *in_params)
             }
         }
 
-        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;
         }
     }
index 7f54344cc9af2f1c97bb0d289fba8e1855cf15cd..d9ef0c62395d57aae00fdbb4c8a24b5cee390d18 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -117,7 +117,7 @@ static int
 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;
@@ -134,7 +134,8 @@ ipcache_testname(void)
 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);
@@ -192,7 +193,7 @@ ipcache_purgelru(void *voidnotused)
         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). */
@@ -290,17 +291,18 @@ ipcacheParse(ipcache_entry *i, const char *inbuf)
     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;
     }
@@ -313,7 +315,8 @@ ipcacheParse(ipcache_entry *i, const char *inbuf)
     }
 
     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;
     }
@@ -321,7 +324,8 @@ ipcacheParse(ipcache_entry *i, const char *inbuf)
     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;
     }
@@ -345,14 +349,14 @@ ipcacheParse(ipcache_entry *i, const char *inbuf)
             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;
     }
 
@@ -386,14 +390,13 @@ ipcacheParse(ipcache_entry *i, rfc1035_rr * answers, int nr, const char *error_m
     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;
     }
@@ -408,7 +411,7 @@ ipcacheParse(ipcache_entry *i, rfc1035_rr * answers, int nr, const char *error_m
             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;
         }
 
@@ -416,7 +419,7 @@ ipcacheParse(ipcache_entry *i, rfc1035_rr * answers, int nr, const char *error_m
     }
 
     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;
     }
@@ -434,9 +437,8 @@ ipcacheParse(ipcache_entry *i, rfc1035_rr * answers, int nr, const char *error_m
 
             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;
 
@@ -498,11 +500,11 @@ ipcache_nbgethostbyname(const char *name, IPH * handler, void *handlerData)
     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;
@@ -525,7 +527,7 @@ ipcache_nbgethostbyname(const char *name, IPH * handler, void *handlerData)
         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++;
@@ -541,7 +543,7 @@ ipcache_nbgethostbyname(const char *name, IPH * handler, void *handlerData)
         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;
@@ -562,17 +564,17 @@ void
 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));
@@ -602,7 +604,7 @@ ipcache_gethostbyname(const char *name, int flags)
     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);
 
@@ -794,8 +796,7 @@ ipcacheCycleAddr(const char *name, ipcache_addrs * ia)
 
     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;
@@ -805,8 +806,7 @@ ipcacheCycleAddr(const char *name, ipcache_addrs * ia)
         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]));
 }
 
 /*
@@ -840,7 +840,7 @@ ipcacheMarkBadAddr(const char *name, struct IN_ADDR addr)
         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);
@@ -875,7 +875,7 @@ ipcacheMarkGoodAddr(const char *name, struct IN_ADDR addr)
 
     ia->badcount--;
 
-    debug(14, 2) ("ipcacheMarkGoodAddr: %s [%s]\n", name, inet_ntoa(addr));
+    debugs(14, 2, "ipcacheMarkGoodAddr: " << name << " [" << inet_ntoa(addr) << "]");
 }
 
 static void
@@ -921,10 +921,9 @@ ipcacheAddEntryFromHosts(const char *name, const char *ipaddr)
 
     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;
@@ -934,8 +933,7 @@ ipcacheAddEntryFromHosts(const char *name, const char *ipaddr)
         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);
@@ -966,7 +964,7 @@ variable_list *
 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;
 
index 5b0ac7d60b1e3f3386ed3c2a80b9f3cc0b7690fc..7547232c30eb39514c8f0b18dccf51418b766863 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $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
@@ -129,7 +129,7 @@ logfileOpen(const char *path, size_t bufsz, int fatal_flag)
                        "\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;
             }
         }
@@ -186,7 +186,7 @@ logfileRotate(Logfile * lf)
 
 #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;) {
@@ -210,7 +210,7 @@ logfileRotate(Logfile * lf)
     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());
     }
 }
index b69d380951c5aced754580999474af3435738a36..ac90e48f19b0917013743baa3a380c841096aef9 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -174,10 +174,8 @@ SignalDispatcher::dispatch()
         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
@@ -604,7 +602,7 @@ serverConnectionsClose(void)
 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();
@@ -686,7 +684,7 @@ mainReconfigure(void)
 
     writePidFile();            /* write PID file */
 
-    debug(1, 1) ("Ready to serve requests.\n");
+    debugs(1, 1, "Ready to serve requests.");
 
     reconfiguring = 0;
 }
@@ -736,10 +734,10 @@ setEffectiveUser(void)
 #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'!");
     }
 }
@@ -753,18 +751,18 @@ mainSetCwd(void)
         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());
     }
 }
 
@@ -804,30 +802,28 @@ mainInitialize(void)
 
 #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
 
@@ -1028,7 +1024,7 @@ mainInitialize(void)
 
     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);
@@ -1251,7 +1247,7 @@ main(int argc, char **argv)
         }
 
         setEffectiveUser();
-        debug(0, 0) ("Creating Swap Directories\n");
+        debugs(0, 0, "Creating Swap Directories");
         Store::Root().create();
 
         return 0;
@@ -1340,7 +1336,7 @@ sendSignal(void)
     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();
@@ -1601,7 +1597,7 @@ SquidShutdown()
     WIN32_svcstatusupdate(SERVICE_STOP_PENDING, 10000);
 #endif
 
-    debug(1, 1) ("Shutting down...\n");
+    debugs(1, 1, "Shutting down...");
 #if USE_DNSSERVERS
 
     dnsShutdown();
@@ -1700,7 +1696,7 @@ SquidShutdown()
 
     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
@@ -1715,8 +1711,7 @@ SquidShutdown()
         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
index 4030cc26990e9d8ae6fbe6d9ba8c4d839009e5b8..45506bd3eb9d865f984b8d520c87ea18126ccee0 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -143,9 +143,9 @@ Mem::Stats(StoreEntry * sentry)
        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";
@@ -362,7 +362,7 @@ memConfigure(void)
      * 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);
@@ -382,8 +382,8 @@ Mem::Init(void)
      * 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));
@@ -474,8 +474,9 @@ memClean(void)
     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
index c9175c206e541f551a40823316f628e923310701..97bf0a3fbfd67534da9a45b6dd52ef0329f9aa37 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -125,7 +125,7 @@ mime_get_header_field(const char *mime, const char *name, const char *prefix)
 
     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)
@@ -147,7 +147,7 @@ mime_get_header_field(const char *mime, const char *name, const char *prefix)
 
         xstrncpy(header, p, l);
 
-        debug(25, 5) ("mime_get_header: checking '%s'\n", header);
+        debugs(25, 5, "mime_get_header: checking '" << header << "'");
 
         q = header;
 
@@ -166,7 +166,7 @@ mime_get_header_field(const char *mime, const char *name, const char *prefix)
         }
 
         if (got) {
-            debug(25, 5) ("mime_get_header: returning '%s'\n", q);
+            debugs(25, 5, "mime_get_header: returning '" << q << "'");
             return q;
         }
     }
@@ -397,7 +397,7 @@ mimeInit(char *filename)
         return;
 
     if ((fp = fopen(filename, "r")) == NULL) {
-        debug(25, 1) ("mimeInit: %s: %s\n", filename, xstrerror());
+        debugs(25, 1, "mimeInit: " << filename << ": " << xstrerror());
         return;
     }
 
@@ -424,27 +424,27 @@ mimeInit(char *filename)
         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;
         }
 
@@ -457,11 +457,11 @@ mimeInit(char *filename)
             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;
         }
 
@@ -487,7 +487,7 @@ mimeInit(char *filename)
 
         MimeTableTail = &m->next;
 
-        debug(25, 5) ("mimeInit: added '%s'\n", buf);
+        debugs(25, 5, "mimeInit: added '" << buf << "'");
     }
 
     fclose(fp);
@@ -498,7 +498,7 @@ mimeInit(char *filename)
     for (m = MimeTable; m != NULL; m = m->next)
         m->theIcon.load();
 
-    debug(25, 1) ("Loaded Icons.\n");
+    debugs(25, 1, "Loaded Icons.");
 }
 
 void
@@ -555,12 +555,12 @@ MimeIcon::created (StoreEntry *newEntry)
     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;
     }
@@ -610,7 +610,7 @@ MimeIcon::created (StoreEntry *newEntry)
 
     e->timestampsSet();
 
-    debug(25, 3) ("Loaded icon %s\n", url);
+    debugs(25, 3, "Loaded icon " << url);
 
     e->unlock();
 
index 2c57fd1adfb0dc2e84e70c2fc437b4a242cb9f22..b43d0c072b88d8c724f510f368dc18881f8d0d9a 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -42,8 +42,7 @@ mcastSetTtl(int fd, int mcast_ttl)
     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
 
@@ -62,13 +61,12 @@ mcastJoinGroups(const ipcache_addrs * ia, void *datanotused)
     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,
@@ -76,13 +74,12 @@ mcastJoinGroups(const ipcache_addrs * ia, void *datanotused)
                        (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
index ec2cf0e54a7312a8cd7d574e91af9f2d23b6bf13..db004b36ed065175d2e919fcf388bb997242d02b 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -102,7 +102,7 @@ whichPeer(const struct sockaddr_in * from)
 
     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)
     {
@@ -273,7 +273,7 @@ neighborsCount(HttpRequest * request)
         if (peerWouldBePinged(p, request))
             count++;
 
-    debug(15, 3) ("neighborsCount: %d\n", count);
+    debugs(15, 3, "neighborsCount: " << count);
 
     return count;
 }
@@ -296,7 +296,7 @@ getFirstUpParent(HttpRequest * request)
         break;
     }
 
-    debug(15, 3) ("getFirstUpParent: returning %s\n", p ? p->host : "NULL");
+    debugs(15, 3, "getFirstUpParent: returning " << (p ? p->host : "NULL"));
     return p;
 }
 
@@ -329,7 +329,7 @@ getRoundRobinParent(HttpRequest * request)
     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;
 }
@@ -376,10 +376,10 @@ getWeightedRoundRobinParent(HttpRequest * request)
 
         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;
 }
 
@@ -413,12 +413,12 @@ getDefaultParent(HttpRequest * request)
         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;
 }
 
@@ -440,12 +440,12 @@ getAnyParent(HttpRequest * request)
         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;
 }
 
@@ -506,7 +506,7 @@ neighbors_init(void)
         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;
@@ -519,11 +519,13 @@ neighbors_init(void)
                 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);
             }
@@ -610,32 +612,31 @@ neighborsUdpPing(HttpRequest * request,
         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,
@@ -681,8 +682,7 @@ neighborsUdpPing(HttpRequest * request,
             /* 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;
             }
         }
@@ -710,10 +710,9 @@ neighborsUdpPing(HttpRequest * request,
         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) {
@@ -730,8 +729,7 @@ neighborsUdpPing(HttpRequest * request,
                            0);
             }
         } else {
-            debug(15, 6) ("neighborsUdpPing: Source Ping: unknown host: %s\n",
-                          host);
+            debugs(15, 6, "neighborsUdpPing: Source Ping: unknown host: " << host);
         }
     }
 
@@ -776,33 +774,32 @@ peerDigestLookup(peer * p, HttpRequest * request)
     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;
 
@@ -852,8 +849,7 @@ neighborsDigestSelect(HttpRequest * request)
 
         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)) {
@@ -863,13 +859,11 @@ neighborsDigestSelect(HttpRequest * request)
             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;
@@ -891,8 +885,9 @@ peerNoteDigestLookup(HttpRequest * request, peer * p, lookup_t lookup)
 
     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
 }
@@ -901,8 +896,7 @@ static void
 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;
     }
 
@@ -946,8 +940,7 @@ static void
 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;
     }
 
@@ -1005,8 +998,7 @@ neighborIgnoreNonPeer(const struct sockaddr_in *from, icp_opcode opcode)
     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
@@ -1047,8 +1039,7 @@ neighborsUdpAck(const cache_key * key, icp_common_t * header, const struct socka
     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;
@@ -1067,8 +1058,7 @@ neighborsUdpAck(const cache_key * key, icp_common_t * header, const struct socka
     /* 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;
     }
@@ -1076,38 +1066,33 @@ neighborsUdpAck(const cache_key * key, icp_common_t * header, const struct socka
     /* 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)
     {
@@ -1145,7 +1130,7 @@ neighborsUdpAck(const cache_key * key, icp_common_t * header, const struct socka
     } 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
 
@@ -1154,7 +1139,7 @@ neighborsUdpAck(const cache_key * key, icp_common_t * header, const struct socka
 #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)
     {
@@ -1162,8 +1147,8 @@ neighborsUdpAck(const cache_key * key, icp_common_t * header, const struct socka
             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 {
@@ -1175,7 +1160,7 @@ neighborsUdpAck(const cache_key * key, icp_common_t * header, const struct socka
         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);
     }
 }
 
@@ -1279,22 +1264,21 @@ peerDNSConfigure(const ipcache_addrs * ia, void *data)
     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;
     }
 
@@ -1302,7 +1286,7 @@ peerDNSConfigure(const ipcache_addrs * ia, void *data)
 
     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++;
     }
 
@@ -1348,15 +1332,15 @@ peerConnectFailedSilent(peer * p)
     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;
     }
 }
@@ -1364,7 +1348,7 @@ peerConnectFailedSilent(peer * p)
 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);
 }
 
@@ -1372,9 +1356,8 @@ void
 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);
@@ -1517,11 +1500,9 @@ peerCountMcastPeersDone(void *data)
                                                (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;
     }
 
@@ -1767,8 +1748,9 @@ neighborsHtcpReply(const cache_key * key, htcpReplyData * htcp, const struct soc
     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;
@@ -1779,8 +1761,7 @@ neighborsHtcpReply(const cache_key * key, htcpReplyData * htcp, const struct soc
     /* 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;
     }
@@ -1788,32 +1769,28 @@ neighborsHtcpReply(const cache_key * key, htcpReplyData * htcp, const struct soc
     /* 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;
     }
@@ -1830,7 +1807,7 @@ neighborsHtcpReply(const cache_key * key, htcpReplyData * htcp, const struct soc
         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);
 }
 
index 8464b5251a43facad3fc834cc1b454af1d7e56b5..97a15b8b03a13960aab3e0be77292aad64a8fa9c 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -306,13 +306,12 @@ netdbSendPing(const ipcache_addrs * ia, void *data)
         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;
         }
@@ -336,7 +335,7 @@ netdbSendPing(const ipcache_addrs * ia, void *data)
     }
 
     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;
@@ -418,8 +417,7 @@ netdbPeerAdd(netdbEntry * n, peer * e)
         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));
 
@@ -486,7 +484,7 @@ netdbSaveState(void *foo)
     lf = logfileOpen(path, 4096, 0);
 
     if (NULL == lf) {
-        debug(50, 1) ("netdbSaveState: %s: %s\n", path, xstrerror());
+        debugs(50, 1, "netdbSaveState: " << path << ": " << xstrerror());
         return;
     }
 
@@ -518,8 +516,9 @@ netdbSaveState(void *foo)
 
     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);
 }
 
@@ -639,8 +638,9 @@ netdbReloadState(void)
 
     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 *
@@ -695,19 +695,19 @@ netdbExchangeHandleReply(void *data, StoreIOBuffer recievedData)
     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;
     }
@@ -730,8 +730,7 @@ netdbExchangeHandleReply(void *data, StoreIOBuffer recievedData)
             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);
@@ -766,12 +765,10 @@ netdbExchangeHandleReply(void *data, StoreIOBuffer recievedData)
     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;
 
@@ -799,7 +796,7 @@ netdbExchangeHandleReply(void *data, StoreIOBuffer recievedData)
                 break;
 
             default:
-                debug(38, 1) ("netdbExchangeHandleReply: corrupt data, aborting\n");
+                debugs(38, 1, "netdbExchangeHandleReply: corrupt data, aborting");
                 netdbExchangeDone(ex);
                 return;
             }
@@ -846,22 +843,23 @@ netdbExchangeHandleReply(void *data, StoreIOBuffer recievedData)
      */
     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);
     }
@@ -871,7 +869,7 @@ static void
 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();
@@ -941,7 +939,7 @@ netdbHandlePingReply(const struct sockaddr_in *from, int hops, int rtt)
 #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;
@@ -958,10 +956,9 @@ netdbHandlePingReply(const struct sockaddr_in *from, int hops, int rtt)
 
     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
 }
@@ -1024,8 +1021,8 @@ netdbDump(StoreEntry * sentry)
         *(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,
@@ -1122,11 +1119,11 @@ netdbUpdatePeer(HttpRequest * r, peer * e, int irtt, int ihops)
     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;
     }
 
@@ -1157,8 +1154,10 @@ netdbExchangeUpdatePeer(struct IN_ADDR addr, peer * e, double rtt, double hops)
 #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)
@@ -1196,7 +1195,7 @@ netdbDeleteAddrNetwork(struct IN_ADDR addr)
     if (n == NULL)
         return;
 
-    debug(38, 3) ("netdbDeleteAddrNetwork: %s\n", n->network);
+    debugs(38, 3, "netdbDeleteAddrNetwork: " << n->network);
 
     netdbRelease(n);
 
@@ -1302,12 +1301,12 @@ netdbExchangeStart(void *data)
     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;
     }
 
index 7d072ae93fb82f2890c619bc6521b60a1df800b4..37f0b4716efe2fbc87b161e1498e9919acc0101e 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -87,13 +87,13 @@ IdleConnList::removeFD(int fd)
 {
     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;
     }
 }
@@ -109,7 +109,7 @@ void
 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));
@@ -151,7 +151,7 @@ IdleConnList::findUseableFD()
 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 */
@@ -166,7 +166,7 @@ IdleConnList::read(int fd, char *buf, size_t len, comm_err_t flag, int xerrno, v
 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);
@@ -237,7 +237,7 @@ PconnPool::push(int fd, const char *host, u_short port, const char *domain, stru
 
     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)
@@ -253,7 +253,7 @@ PconnPool::push(int fd, const char *host, u_short port, const char *domain, stru
     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);
     }
 
@@ -262,7 +262,7 @@ PconnPool::push(int fd, const char *host, u_short port, const char *domain, stru
     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);
 }
 
 /*
@@ -315,7 +315,7 @@ PconnModule::PconnModule() : pools(NULL), poolCount(0)
 {
     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 *
index 21b50e46b96e71c07584204336b9b139c9bd7fa0..52c6ae6a45268d5c637fe41b8b03f3dc9df94122 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -187,8 +187,7 @@ peerDigestNeeded(PeerDigest * pd)
 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;
@@ -232,8 +231,7 @@ peerDigestSetCheck(PeerDigest * pd, time_t delay)
 {
     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");
 }
 
 /*
@@ -243,12 +241,10 @@ void
 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);
     }
 }
@@ -271,9 +267,10 @@ peerDigestCheck(void *data)
         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 */
@@ -282,17 +279,21 @@ peerDigestCheck(void *data)
     /* 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;
     }
 
@@ -333,7 +334,7 @@ peerDigestRequest(PeerDigest * pd)
 
     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);
@@ -373,7 +374,7 @@ peerDigestRequest(PeerDigest * pd)
     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()
 
@@ -392,7 +393,7 @@ peerDigestRequest(PeerDigest * pd)
         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);
 
@@ -545,9 +546,9 @@ peerDigestFetchReply(void *data, char *buf, ssize_t size)
         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() */
 
@@ -584,7 +585,7 @@ peerDigestFetchReply(void *data, char *buf, ssize_t size)
             /* 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();
@@ -635,8 +636,10 @@ peerDigestSwapInHeaders(void *data, char *buf, ssize_t size)
         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;
         }
@@ -795,8 +798,7 @@ peerDigestFetchedEnough(DigestFetchState * fetch, char *buf, ssize_t size, const
     /* 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 {
@@ -813,8 +815,7 @@ static void
 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);
 }
 
@@ -823,8 +824,7 @@ static void
 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);
 }
 
@@ -884,9 +884,7 @@ peerDigestPDFinish(DigestFetchState * fetch, int pcb_valid, int err)
     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);
@@ -905,9 +903,9 @@ peerDigestPDFinish(DigestFetchState * fetch, int pcb_valid, int err)
         /* 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);
@@ -921,7 +919,7 @@ peerDigestFetchFinish(DigestFetchState * fetch, int err)
     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();
@@ -972,11 +970,16 @@ peerDigestFetchSetStats(DigestFetchState * fetch)
     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) <<
+           ")");
+
 }
 
 
@@ -995,22 +998,28 @@ peerDigestSetCBlock(PeerDigest * pd, const char *buf)
     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;
     }
 
@@ -1018,7 +1027,7 @@ peerDigestSetCBlock(PeerDigest * pd, const char *buf)
     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;
     }
 
@@ -1033,8 +1042,8 @@ peerDigestSetCBlock(PeerDigest * pd, const char *buf)
 
     /* 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;
     }
 
@@ -1051,8 +1060,8 @@ peerDigestSetCBlock(PeerDigest * pd, const char *buf)
     }
 
     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)
@@ -1073,8 +1082,9 @@ peerDigestUseful(const PeerDigest * pd)
     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;
     }
 
index 96de3d698faaf2754494185657a04cc779035423..84bf37dfba46ceb28a943cd77c2a150fb8427f26 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -109,7 +109,7 @@ static void
 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);
     }
 
@@ -131,7 +131,7 @@ peerSelectIcpPing(HttpRequest * request, int direct, StoreEntry * entry)
     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;
@@ -142,7 +142,7 @@ peerSelectIcpPing(HttpRequest * request, int direct, StoreEntry * entry)
 
     n = neighborsCount(request);
 
-    debug(44, 3) ("peerSelectIcpPing: counted %d neighbors\n", n);
+    debugs(44, 3, "peerSelectIcpPing: counted " << n << " neighbors");
 
     return n;
 }
@@ -157,9 +157,9 @@ peerSelect(HttpRequest * request,
     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;
 
@@ -192,7 +192,7 @@ peerCheckNeverDirectDone(int answer, void *data)
 {
     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);
 }
@@ -202,7 +202,7 @@ peerCheckAlwaysDirectDone(int answer, void *data)
 {
     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);
 }
@@ -216,7 +216,7 @@ peerSelectCallback(ps_state * 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);
@@ -225,10 +225,10 @@ peerSelectCallback(ps_state * 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;
@@ -256,20 +256,18 @@ peerCheckNetdbDirect(ps_state * psstate)
 
     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;
@@ -279,8 +277,7 @@ peerCheckNetdbDirect(ps_state * psstate)
     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;
@@ -293,9 +290,7 @@ peerSelectFoo(ps_state * ps)
 {
     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) {
@@ -328,8 +323,7 @@ peerSelectFoo(ps_state * ps)
             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) {
@@ -407,7 +401,7 @@ peerGetSomeNeighbor(ps_state * ps)
         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,
@@ -417,10 +411,11 @@ peerGetSomeNeighbor(ps_state * ps)
                                                &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;
@@ -435,7 +430,7 @@ peerGetSomeNeighbor(ps_state * ps)
 
     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);
     }
 
@@ -458,7 +453,7 @@ peerGetSomeNeighborReplies(ps_state * ps)
 
     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;
     }
@@ -480,7 +475,7 @@ peerGetSomeNeighborReplies(ps_state * ps)
             }
 
     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);
     }
 }
@@ -511,9 +506,7 @@ peerGetSomeParent(ps_state * ps)
     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;
@@ -537,7 +530,7 @@ peerGetSomeParent(ps_state * ps)
     }
 
     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);
     }
 }
@@ -562,7 +555,7 @@ peerGetAllParents(ps_state * ps)
         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);
     }
@@ -584,7 +577,7 @@ peerPingTimeout(void *data)
     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 */
@@ -652,9 +645,7 @@ peerHandleIcpReply(peer * p, peer_t type, icp_common_t * header, void *data)
 {
     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 */
 
@@ -695,9 +686,9 @@ static void
 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) {
@@ -771,16 +762,16 @@ peerHandlePingReply(peer * p, peer_t type, protocol_t proto, void *pingdata, voi
 #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;
 
index dbb93d56766aae6dfed6dd703ebd4dfd5eb4aed7..369ffaa91a0e69f8d77596b3fd9d6e83b6dbee0a 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -248,7 +248,7 @@ pingerOpen(void)
 
     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);
     }
@@ -260,7 +260,7 @@ pingerOpen(void)
 
     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);
     }
@@ -269,19 +269,19 @@ pingerOpen(void)
 #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 =
@@ -290,7 +290,7 @@ pingerOpen(void)
 
     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);
     }
@@ -299,7 +299,7 @@ pingerOpen(void)
 
     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);
     }
@@ -309,19 +309,19 @@ pingerOpen(void)
     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
 }
 
@@ -447,7 +447,8 @@ pingerRecv(void)
 
 #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;
 
@@ -522,14 +523,12 @@ static void
 
 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
@@ -594,7 +593,7 @@ pingerSendtoSquid(pingerReplyData * preply)
     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);
     }
@@ -642,7 +641,7 @@ main(int argc, char *argv[])
 
         if (FD_ISSET(socket_from_squid, &R))
             if (pingerReadRequest() < 0) {
-                debug(42, 0) ("Pinger exiting.\n");
+                debugs(42, 0, "Pinger exiting.");
                 pingerClose();
                 exit(1);
             }
index 27f58352b7cea6c3d7740a550dabd8d30bf85679..eaa351b1adbf4ae66834fe9e4dad637b77ce34e8 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -70,7 +70,7 @@ redirectHandleReply(void *data, char *reply)
     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, ' ')))
@@ -120,7 +120,7 @@ redirectStart(ClientHttpRequest * http, RH * handler, void *data)
     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 */
index 83bd40ce74c3373b92ff8e8959d7201ad4390c7d..8c9d69cbc9f24ff1a7ea2ebe2f6f30f2b8204b90 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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)
@@ -47,7 +47,7 @@ refererOpenLog(void)
     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;
     }
 
index 83e60f6c74d4a4285b6ffefffec5763782e5c929..9d4a1fedcb1b7278e62964e4e698780ee2aa8538 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -168,12 +168,14 @@ refreshStaleness(const StoreEntry * entry, time_t check_time, time_t age, const
         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);
         }
     }
@@ -185,7 +187,7 @@ refreshStaleness(const StoreEntry * entry, time_t check_time, time_t age, const
      */
 
     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);
     }
@@ -202,12 +204,10 @@ refreshStaleness(const StoreEntry * entry, time_t check_time, time_t age, const
         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;
         }
     }
@@ -217,12 +217,12 @@ refreshStaleness(const StoreEntry * entry, time_t check_time, time_t age, const
      * 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);
 }
 
@@ -246,7 +246,7 @@ refreshCheck(const StoreEntry * entry, HttpRequest * request, time_t delta)
     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;
@@ -260,19 +260,21 @@ refreshCheck(const StoreEntry * entry, HttpRequest * request, time_t delta)
 
     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;
     }
 
@@ -282,7 +284,7 @@ refreshCheck(const StoreEntry * entry, HttpRequest * request, time_t delta)
 
         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;
         }
 
@@ -292,14 +294,14 @@ refreshCheck(const StoreEntry * entry, HttpRequest * request, time_t delta)
             (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;
         }
@@ -314,13 +316,13 @@ refreshCheck(const StoreEntry * entry, HttpRequest * request, time_t delta)
 #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;
                     }
                 }
@@ -329,10 +331,10 @@ refreshCheck(const StoreEntry * entry, HttpRequest * request, time_t delta)
             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;
                 }
             }
@@ -340,22 +342,22 @@ refreshCheck(const StoreEntry * entry, HttpRequest * request, time_t delta)
     }
 
     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;
     }
 
@@ -367,7 +369,7 @@ refreshCheck(const StoreEntry * entry, HttpRequest * request, time_t delta)
 #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;
         }
 
@@ -382,7 +384,7 @@ refreshCheck(const StoreEntry * entry, HttpRequest * request, time_t delta)
 #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;
         }
 
@@ -390,7 +392,7 @@ refreshCheck(const StoreEntry * entry, HttpRequest * request, time_t delta)
         return STALE_LMFACTOR_RULE;
     }
 
-    debug(22, 3) ("refreshCheck: returning STALE_DEFAULT\n");
+    debugs(22, 3, "refreshCheck: returning STALE_DEFAULT");
     return STALE_DEFAULT;
 }
 
@@ -483,7 +485,7 @@ time_t
 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;
index b8f932037b48906019b20bd8f6fd01a8923ef421..08fb4e98dcf7490de14702b4e197d10e43c15c2d 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -89,8 +89,7 @@ HeapKeyGen_StoreEntry_LFUDA(void *entry, double heap_age)
            " 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;
 }
@@ -129,8 +128,7 @@ HeapKeyGen_StoreEntry_GDSF(void *entry, double heap_age)
            " -> " << 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;
 }
@@ -146,12 +144,12 @@ heap_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;
 }
index f686bcabd588d89b37801504d38e26e3750c74ef..260c3e6f44fb02be1458c8ee5d01e49f6e516865 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -260,8 +260,7 @@ heap_purgeDone(RemovalPurgeWalker * walker)
 
     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  );
     }
 
     /*
@@ -326,7 +325,7 @@ createRemovalPolicy_heap(wordlist * args)
         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";
     }
 
@@ -337,8 +336,7 @@ createRemovalPolicy_heap(wordlist * args)
     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;
     }
 
index bb7839f0d93829c63489cc10be462b45a4716463..5e9a45d45784ea23aa7f59603aa6fa6b5d3832d4 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -70,11 +70,11 @@ send_announce(const ipcache_addrs * ia, void *junk)
     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);
@@ -105,7 +105,7 @@ send_announce(const ipcache_addrs * ia, void *junk)
             sndbuf[l] = '\0';
             file_close(fd);
         } else {
-            debug(50, 1) ("send_announce: %s: %s\n", file, xstrerror());
+            debugs(50, 1, "send_announce: " << file << ": " << xstrerror());
         }
     }
 
@@ -119,6 +119,5 @@ send_announce(const ipcache_addrs * ia, void *junk)
                         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());
 }
index 538e731f83ab6237454e33e2fce81cc31e574ecf..d57bc55e8149ebd54fd706b48f6404ac6d1f15ae 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -49,7 +49,7 @@ variable_list *
 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;
 
@@ -86,7 +86,7 @@ snmp_confFn(variable_list * Var, snint * ErrP)
 {
     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]) {
@@ -192,7 +192,7 @@ snmp_meshPtblFn(variable_list * Var, snint * ErrP)
     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]);
 
@@ -301,7 +301,7 @@ snmp_prfSysFn(variable_list * Var, snint * ErrP)
     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]) {
@@ -405,7 +405,7 @@ snmp_prfProtoFn(variable_list * Var, snint * ErrP)
     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]) {
@@ -525,10 +525,8 @@ snmp_prfProtoFn(variable_list * Var, snint * ErrP)
 
         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]) {
 
index 1a93dceb658b83075e92fd368535f87c27630e5e..70092771fdeeaf6bc21f94ae9e53c86ade5b70ab 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -96,9 +96,7 @@ static void snmpSnmplibDebug(int lvl, char *buf);
 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;
 
@@ -354,7 +352,7 @@ snmpInit(void)
                                            )
                                );
 
-    debug(49, 9) ("snmpInit: Completed SNMP mib tree structure\n");
+    debugs(49, 9, "snmpInit: Completed SNMP mib tree structure");
 }
 
 void
@@ -366,7 +364,7 @@ snmpConnectionOpen(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();
@@ -383,8 +381,7 @@ snmpConnectionOpen(void)
 
         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();
@@ -404,8 +401,7 @@ snmpConnectionOpen(void)
                           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");
 
@@ -423,8 +419,7 @@ snmpConnectionOpen(void)
                         (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;
     }
@@ -437,7 +432,7 @@ snmpConnectionShutdown(void)
         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);
     }
 
@@ -465,7 +460,7 @@ snmpConnectionClose(void)
     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);
     }
 }
@@ -487,7 +482,7 @@ snmpHandleUdp(int sock, void *not_used)
     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);
 
@@ -505,10 +500,7 @@ snmpHandleUdp(int sock, void *not_used)
 
     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;
@@ -521,7 +513,7 @@ snmpHandleUdp(int sock, void *not_used)
         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());
     }
 }
 
@@ -539,7 +531,7 @@ snmpDecodePacket(snmp_request_t * rq)
     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;
@@ -557,11 +549,10 @@ snmpDecodePacket(snmp_request_t * rq)
     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);
     }
 
@@ -578,7 +569,7 @@ snmpConstructReponse(snmp_request_t * rq)
 
     struct snmp_pdu *RespPDU;
 
-    debug(49, 5) ("snmpConstructReponse: Called.\n");
+    debugs(49, 5, "snmpConstructReponse: Called.");
     RespPDU = snmpAgentResponse(rq->PDU);
     snmp_free_pdu(rq->PDU);
 
@@ -601,7 +592,7 @@ static struct snmp_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)))
     {
@@ -633,7 +624,7 @@ static struct snmp_pdu *
 
                 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);
@@ -651,7 +642,7 @@ static struct snmp_pdu *
                 /* 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);
@@ -689,9 +680,9 @@ snmpTreeGet(oid * Current, snint CurrentLen)
     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;
@@ -708,7 +699,7 @@ snmpTreeGet(oid * Current, snint CurrentLen)
     if (mibTreeEntry && mibTreeEntry->parsefunction)
         Fn = mibTreeEntry->parsefunction;
 
-    debug(49, 5) ("snmpTreeGet: return\n");
+    debugs(49, 5, "snmpTreeGet: return");
 
     return (Fn);
 }
@@ -720,9 +711,9 @@ snmpTreeNext(oid * Current, snint CurrentLen, oid ** Next, snint * NextLen)
     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;
@@ -741,7 +732,7 @@ snmpTreeNext(oid * Current, snint CurrentLen, oid ** Next, snint * NextLen)
             count++;
         }
 
-        debug(49, 5) ("snmpTreeNext: Recursed down to requested object\n");
+        debugs(49, 5, "snmpTreeNext: Recursed down to requested object");
     } else {
         return NULL;
     }
@@ -762,11 +753,11 @@ snmpTreeNext(oid * Current, snint CurrentLen, oid ** Next, snint * NextLen)
         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--;
@@ -1041,7 +1032,7 @@ va_dcl
     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);
@@ -1118,7 +1109,7 @@ snmpDebugOid(int lvl, oid * Name, snint Len)
         strncat(objid, mbuf, sizeof(objid));
     }
 
-    debug(49, lvl) ("   oid = %s\n", objid);
+    debugs(49, lvl, "   oid = " << objid);
 }
 
 static void
index 82b8ac5353f5de59b1fc06cd13bfb171c4bd5972..3267df06a50177366a0e697781774c7383aaa606 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -101,12 +101,12 @@ ssl_temp_rsa_cb(SSL * ssl, int anInt, int keylen)
         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;
     }
 
@@ -114,7 +114,7 @@ ssl_temp_rsa_cb(SSL * ssl, int anInt, int keylen)
         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;
@@ -134,15 +134,14 @@ ssl_verify_cb(int ok, X509_STORE_CTX * ctx)
                       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));
@@ -154,8 +153,7 @@ ssl_verify_cb(int ok, X509_STORE_CTX * ctx)
 
                 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;
@@ -164,7 +162,7 @@ ssl_verify_cb(int ok, X509_STORE_CTX * ctx)
             }
 
             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;
             }
         }
@@ -172,28 +170,29 @@ ssl_verify_cb(int ok, X509_STORE_CTX * ctx)
         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;
         }
     }
@@ -509,13 +508,13 @@ ssl_load_crl(SSL_CTX *sslContext, const char *CRLfile)
     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++;
 
@@ -548,24 +547,24 @@ sslCreateServerContext(const char *certfile, const char *keyfile, int version, c
     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;
     }
@@ -589,13 +588,13 @@ sslCreateServerContext(const char *certfile, const char *keyfile, int version, c
     }
 
     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();
@@ -604,61 +603,58 @@ sslCreateServerContext(const char *certfile, const char *keyfile, int version, c
         }
     }
 
-    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;
         }
 
@@ -666,10 +662,10 @@ sslCreateServerContext(const char *certfile, const char *keyfile, int version, c
         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);
         }
 
@@ -687,7 +683,7 @@ sslCreateServerContext(const char *certfile, const char *keyfile, int version, c
 #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);
     }
 
@@ -702,10 +698,10 @@ sslCreateServerContext(const char *certfile, const char *keyfile, int version, c
         }
 
         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;
             }
@@ -745,24 +741,24 @@ sslCreateClientContext(const char *certfile, const char *keyfile, int version, c
     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;
     }
@@ -778,7 +774,7 @@ sslCreateClientContext(const char *certfile, const char *keyfile, int version, c
     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();
@@ -788,7 +784,7 @@ sslCreateClientContext(const char *certfile, const char *keyfile, int version, c
     }
 
     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();
@@ -796,7 +792,7 @@ sslCreateClientContext(const char *certfile, const char *keyfile, int version, c
                    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)) {
@@ -805,7 +801,7 @@ sslCreateClientContext(const char *certfile, const char *keyfile, int version, c
                    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();
@@ -814,24 +810,23 @@ sslCreateClientContext(const char *certfile, const char *keyfile, int version, c
         }
     }
 
-    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) {
@@ -850,9 +845,8 @@ sslCreateClientContext(const char *certfile, const char *keyfile, int version, c
     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;
@@ -876,7 +870,7 @@ ssl_read_method(int fd, char *buf, int len)
     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;
@@ -924,7 +918,7 @@ ssl_get_attribute(X509_NAME * name, const char *attribute_name)
     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;
     }
 
index b5dd8fb47baa27a6dc72426a575d998f58ebb8b5..06bb8c9764885b3c5f2b83051e1bd113a3fa1bfe 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $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
@@ -840,8 +840,7 @@ statAvgDump(StoreEntry * sentry, int minutes, int hours)
 
         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;
     }
 
@@ -1020,7 +1019,7 @@ void
 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]);
@@ -1147,7 +1146,7 @@ statAvgTick(void *notused)
         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) {
@@ -1158,7 +1157,7 @@ statAvgTick(void *notused)
             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");
         }
     }
 
@@ -1178,7 +1177,7 @@ statAvgTick(void *notused)
 #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");
     }
 }
 
@@ -1547,7 +1546,7 @@ statPctileSvc(double pctile, int interval, int which)
         break;
 
     default:
-        debug(49, 5) ("statPctileSvc: unknown type.\n");
+        debugs(49, 5, "statPctileSvc: unknown type.");
         x = 0;
     }
 
index be352e4bf3f2cded9610b8c0245e98f82f587ed6..c34eebe98420e9e0d7c58fd88cb015c7a8370bdb 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -91,7 +91,7 @@ bool
 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;
     }
 
index aacfc5bca5bf575e524329d7cbc561f173ae4a29..9c11c4c012af2c22cce2df470aef012650be45da 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -313,7 +313,7 @@ StoreEntry::storeClientType() const
 
     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;
     }
 
@@ -406,8 +406,7 @@ destroyStoreEntry(void *data)
 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);
 }
@@ -430,8 +429,7 @@ StoreEntry::purgeMem()
     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();
 
@@ -452,7 +450,7 @@ StoreEntry::lock()
 {
     lock_count++;
     debugs(20, 3, "StoreEntry::lock: key '" << getMD5Text() <<"' count=" <<
-           lock_count << "\n");
+           lock_count  );
     lastref = squid_curtime;
     Store::Root().reference(*this);
 }
@@ -463,7 +461,7 @@ StoreEntry::setReleaseFlag()
     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);
 }
@@ -492,8 +490,7 @@ int
 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;
@@ -513,7 +510,7 @@ StoreEntry::unlock()
         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();
@@ -653,8 +650,7 @@ StoreEntry::setPublicKey()
 #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
 
@@ -729,7 +725,7 @@ StoreEntry::setPublicKey()
         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();
 
@@ -755,7 +751,7 @@ storeCreateEntry(const char *url, const char *log_url, request_flags flags, meth
 {
     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() */
@@ -792,7 +788,7 @@ storeCreateEntry(const char *url, const char *log_url, request_flags flags, meth
 void
 StoreEntry::expireNow()
 {
-    debug(20, 3) ("StoreEntry::expireNow: '%s'\n", getMD5Text());
+    debugs(20, 3, "StoreEntry::expireNow: '" << getMD5Text() << "'");
     expires = squid_curtime;
 }
 
@@ -959,37 +955,34 @@ StoreEntry::checkCachable()
 #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) {
             /*
@@ -999,12 +992,10 @@ StoreEntry::checkCachable()
              */
             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++;
@@ -1050,7 +1041,7 @@ storeCheckCachableStats(StoreEntry *sentry)
 void
 StoreEntry::complete()
 {
-    debug(20, 3) ("storeComplete: '%s'\n", getMD5Text());
+    debugs(20, 3, "storeComplete: '" << getMD5Text() << "'");
 
     if (store_status != STORE_PENDING) {
         /*
@@ -1101,7 +1092,7 @@ StoreEntry::abort()
     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()
 
@@ -1190,9 +1181,9 @@ storeGetMemSpace(int size)
     }
 
     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);
 }
 
@@ -1248,13 +1239,13 @@ void
 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;
@@ -1323,7 +1314,7 @@ storeLateRelease(void *unused)
 
         if (e == NULL) {
             /* done! */
-            debug(20, 1) ("storeLateRelease: released %d objects\n", n);
+            debugs(20, 1, "storeLateRelease: released " << n << " objects");
             return;
         }
 
@@ -1364,29 +1355,24 @@ StoreEntry::validLength() const
     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;
     }
 
@@ -1401,10 +1387,7 @@ StoreEntry::validLength() const
     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;
 }
@@ -1576,23 +1559,23 @@ StoreEntry::unregisterAbort()
 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);
 }
 
 /*
@@ -1610,23 +1593,19 @@ StoreEntry::setMemStatus(mem_status_t new_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--;
@@ -1700,7 +1679,7 @@ void
 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();
@@ -1756,9 +1735,9 @@ createRemovalPolicy(RemovalPolicySettings * settings)
             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 */
 }
@@ -1792,11 +1771,11 @@ storeSwapFileNumberSet(StoreEntry * e, sfileno filn)
 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;
     }
 
@@ -1835,9 +1814,8 @@ bool
 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));
@@ -1846,7 +1824,7 @@ StoreEntry::swapoutPossible()
     }
 
     if (EBIT_TEST(flags, ENTRY_SPECIAL)) {
-        debug(20, 3) ("storeSwapOut: %s SPECIAL\n", url());
+        debugs(20, 3, "storeSwapOut: " << url() << " SPECIAL");
         return false;
     }
 
@@ -1884,9 +1862,9 @@ StoreEntry::modifiedSince(HttpRequest * request) const
     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;
@@ -1898,19 +1876,19 @@ StoreEntry::modifiedSince(HttpRequest * request) const
         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;
     }
 }
index fe40aaab1e0403fadbbb8e904a6024007f9b4def..234f58d2f13920a7e8f6789cd5db4e9628efb2d3 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -170,7 +170,7 @@ static void
 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;
 
@@ -228,12 +228,11 @@ store_client::copy(StoreEntry * anEntry,
     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));
@@ -303,18 +302,18 @@ storeClientCopy2(StoreEntry * e, store_client * sc)
     }
 
     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
@@ -341,7 +340,9 @@ store_client::doCopy(StoreEntry *anEntry)
     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! */
@@ -352,7 +353,7 @@ store_client::doCopy(StoreEntry *anEntry)
 
     /* 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;
     }
@@ -378,7 +379,7 @@ store_client::doCopy(StoreEntry *anEntry)
 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()) {
@@ -404,7 +405,7 @@ store_client::startSwapin()
 
         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;
     }
@@ -429,7 +430,7 @@ store_client::scheduleDiskRead()
 
     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();
 
@@ -441,7 +442,7 @@ store_client::scheduleMemRead()
 {
     /* 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;
@@ -476,14 +477,14 @@ storeClientReadBody(void *data, const char *buf, ssize_t len, StoreIOState::Poin
     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");
         }
     }
 
@@ -515,10 +516,10 @@ storeClientReadHeader(void *data, const char *buf, ssize_t len, StoreIOState::Po
 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;
     }
@@ -528,7 +529,7 @@ store_client::unpackHeader(char const *buf, ssize_t len)
 
     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;
     }
@@ -536,7 +537,7 @@ store_client::unpackHeader(char const *buf, ssize_t len)
     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;
     }
@@ -585,8 +586,7 @@ store_client::readHeader(char const *buf, ssize_t len)
          */
         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) {
@@ -594,7 +594,7 @@ store_client::readHeader(char const *buf, ssize_t len)
             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!");
             }
         }
 
@@ -650,15 +650,15 @@ storeUnregister(store_client * sc, StoreEntry * e, void *data)
     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;
     }
 
@@ -676,8 +676,7 @@ storeUnregister(store_client * sc, StoreEntry * e, void *data)
 
     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();
     }
 
@@ -711,13 +710,13 @@ StoreEntry::invokeHandlers()
 
     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;
@@ -735,7 +734,7 @@ storePendingNClients(const StoreEntry * e)
 {
     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;
 }
 
@@ -745,15 +744,15 @@ CheckQuickAbort2(StoreEntry * entry)
 {
     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;
     }
 
@@ -768,36 +767,36 @@ CheckQuickAbort2(StoreEntry * entry)
     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;
 }
 
index d20d8482583d5d4172a0f1f9c5532d7673ca203d..6439d149aa107b1849c3e9497376ae53b308ac6a 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -115,18 +115,20 @@ storeDigestInit(void)
 
     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
 }
 
@@ -161,19 +163,16 @@ storeDigestDel(const StoreEntry * entry)
     }
 
     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());
         }
     }
 
@@ -218,47 +217,45 @@ storeDigestAddable(const StoreEntry * e)
 {
     /* 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;
     }
 
@@ -287,8 +284,7 @@ storeDigestAdd(const StoreEntry * entry)
 
         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++;
 
@@ -305,15 +301,15 @@ storeDigestRebuildStart(void *datanotused)
     /* 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;
     }
 
@@ -344,7 +340,7 @@ storeDigestRebuildFinish(void)
     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 */
@@ -362,8 +358,7 @@ storeDigestRebuildStep(void *datanotused)
                 (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());
@@ -388,24 +383,24 @@ storeDigestRewriteStart(void *datanotused)
     /* 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;
     }
 
@@ -430,8 +425,8 @@ storeDigestRewriteResume(void)
     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);
@@ -446,8 +441,8 @@ storeDigestRewriteFinish(StoreEntry * 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();
@@ -518,8 +513,8 @@ storeDigestCalcCap(void)
     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;
@@ -539,16 +534,16 @@ storeDigestResize(void)
     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;
     }
index dee260155840535a550342db4514baefb01beb3d..83359b3680b81c711a67e1cab9a45aa88a88cc92 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -89,10 +89,10 @@ StoreController::init()
 
     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");
     }
 }
 
@@ -320,11 +320,11 @@ storeDirSwapLog(const StoreEntry * e, int op)
 
     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);
 }
@@ -430,12 +430,12 @@ storeDirWriteCleanLogs(int reopen)
     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;
 
@@ -443,7 +443,7 @@ storeDirWriteCleanLogs(int reopen)
         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;
         }
     }
@@ -476,7 +476,8 @@ storeDirWriteCleanLogs(int reopen)
 
             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.");
             }
         }
     }
@@ -492,10 +493,10 @@ storeDirWriteCleanLogs(int reopen)
 
     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;
 }
@@ -545,7 +546,7 @@ storeDirGetBlkSize(const char *path, int *blksize)
     struct statvfs sfs;
 
     if (statvfs(path, &sfs)) {
-        debug(50, 1) ("%s: %s\n", path, xstrerror());
+        debugs(50, 1, "" << path << ": " << xstrerror());
         *blksize = 2048;
         return 1;
     }
@@ -556,7 +557,7 @@ storeDirGetBlkSize(const char *path, int *blksize)
     struct statfs sfs;
 
     if (statfs(path, &sfs)) {
-        debug(50, 1) ("%s: %s\n", path, xstrerror());
+        debugs(50, 1, "" << path << ": " << xstrerror());
         *blksize = 2048;
         return 1;
     }
@@ -584,7 +585,7 @@ storeDirGetUFSStats(const char *path, int *totl_kb, int *free_kb, int *totl_in,
     struct statvfs sfs;
 
     if (statvfs(path, &sfs)) {
-        debug(50, 1) ("%s: %s\n", path, xstrerror());
+        debugs(50, 1, "" << path << ": " << xstrerror());
         return 1;
     }
 
@@ -597,7 +598,7 @@ storeDirGetUFSStats(const char *path, int *totl_kb, int *free_kb, int *totl_in,
     struct statfs sfs;
 
     if (statfs(path, &sfs)) {
-        debug(50, 1) ("%s: %s\n", path, xstrerror());
+        debugs(50, 1, "" << path << ": " << xstrerror());
         return 1;
     }
 
@@ -765,7 +766,7 @@ StoreHashIndex::get
     (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;
index f7decc0b3df1bc11521bf6784bdc6ecb368a15ad..21bbf8ff5e63e75bf00a6a8346f8e6aeecd11188 100644 (file)
@@ -49,12 +49,12 @@ storeCreate(StoreEntry * e, StoreIOState::STFNCB * file_callback, StoreIOState::
     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 */
index d6f76b8ec7a2bdc240e6f89ab2c9df1612f4a8e7..6e57e95e9f0085d0105674d24e1f0d91557c7f47 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -65,7 +65,7 @@ storeLog(int tag, const StoreEntry * e)
     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);
         }
@@ -128,7 +128,7 @@ void
 storeLogOpen(void)
 {
     if (strcmp(Config.Log.store, "none") == 0) {
-        debug(20, 1) ("Store logging disabled\n");
+        debugs(20, 1, "Store logging disabled");
         return;
     }
 
index 85df970935e217f21ceb019a2bc1a3ffb7925348..dd8f6df30cb7494ba807f3e94b53229c76473d22 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -154,28 +154,18 @@ storeRebuildComplete(struct _store_rebuild_data *dc)
 
     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);
 
@@ -241,6 +231,6 @@ storeRebuildProgress(int sd_index, int total, int sofar)
         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;
 }
index 870e31317f16fe31996eb2688345e7a1891c4b78..ccd47a9cf431b42cffe24c524f515739ff2e747b 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -51,23 +51,22 @@ storeSwapInStart(store_client * sc)
         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);
 }
 
@@ -75,8 +74,7 @@ static void
 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()) {
@@ -93,7 +91,9 @@ storeSwapInFileNotify(void *data, int errflag, StoreIOState::Pointer self)
     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;
index 05dd515a78245cdaff8b8ece7ea1b3fa9be89696..2b3472a8e5d80f6a150c8cb99582e368ec0c3cb0 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -64,7 +64,7 @@ storeSwapMetaBuild(StoreEntry * e)
     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) {
index 42aa6da155e6e523a97b9dd105f36568bf8b7116..508b9e79a6f4d5c685eeb24cc57f3feefb10dabc 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -56,8 +56,9 @@ storeSwapOutStart(StoreEntry * e)
     /* 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
@@ -146,12 +147,11 @@ doPages(StoreEntry *anEntry)
          */
         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;
 
@@ -189,18 +189,12 @@ StoreEntry::swapOut()
     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);
 
@@ -208,8 +202,7 @@ StoreEntry::swapOut()
 
     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
@@ -226,7 +219,7 @@ StoreEntry::swapOut()
          * 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;
     }
 
@@ -234,7 +227,7 @@ StoreEntry::swapOut()
 #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;
     }
@@ -246,8 +239,7 @@ StoreEntry::swapOut()
     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)
@@ -307,8 +299,8 @@ void
 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;
@@ -327,8 +319,10 @@ storeSwapOutFileClosed(void *data, int errflag, StoreIOState::Pointer self)
     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
@@ -350,8 +344,9 @@ storeSwapOutFileClosed(void *data, int errflag, StoreIOState::Pointer self)
         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);
@@ -364,7 +359,7 @@ storeSwapOutFileClosed(void *data, int errflag, StoreIOState::Pointer self)
         statCounter.swap.outs++;
     }
 
-    debug(20, 3) ("storeSwapOutFileClosed: %s:%d\n", __FILE__, __LINE__);
+    debugs(20, 3, "storeSwapOutFileClosed: " << __FILE__ << ":" << __LINE__);
     mem->swapout.sio = NULL;
     e->unlock();
 }
index c65fd183a2305081aee6436f8c9859918c2148f6..6a7cd54781adb0f59ea9aecd5b937e3ec554a1ba 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $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
@@ -133,7 +133,7 @@ void
 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);
index f6326de50d13fc44cfca284db16074e415c472f5..be0b445a74c97b214644e8c9331c6e8c8739fff5 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -425,7 +425,8 @@ sigusr2_handle(int sig)
 
 #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
 }
@@ -609,9 +610,8 @@ getMyHostname(void)
             /* 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, '.'))
@@ -619,20 +619,18 @@ getMyHostname(void)
 
         }
 
-        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);
@@ -675,7 +673,7 @@ leave_suid(void)
 #endif
 
         if (setgid(Config2.effectiveGroupID) < 0)
-            debug(50, 0) ("ALERT: setgid: %s\n", xstrerror());
+            debugs(50, 0, "ALERT: setgid: " << xstrerror());
 
     }
 
@@ -691,29 +689,29 @@ leave_suid(void)
     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
@@ -740,7 +738,7 @@ leave_suid(void)
 #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
 }
@@ -761,7 +759,7 @@ enter_suid(void)
     /* 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
 }
@@ -779,20 +777,20 @@ no_suid(void)
 #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
 }
@@ -822,7 +820,7 @@ writePidFile(void)
     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;
     }
@@ -887,7 +885,7 @@ setMaxFD(void)
 #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;
 
@@ -903,7 +901,7 @@ setMaxFD(void)
 
 #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;
 
@@ -919,14 +917,14 @@ setMaxFD(void)
 
 #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 */
 
@@ -940,7 +938,7 @@ setMaxFD(void)
 #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 */
 
@@ -977,7 +975,7 @@ squid_signal(int sig, SIGHDLR * func, int flags)
     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_
@@ -1162,7 +1160,7 @@ debugObj(int section, int level, const char *label, void *obj, ObjPackMethod pm)
     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();
 }
@@ -1185,8 +1183,7 @@ parseEtcHosts(void)
     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;
     }
 
@@ -1208,7 +1205,7 @@ parseEtcHosts(void)
 
         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);
 
@@ -1217,7 +1214,7 @@ parseEtcHosts(void)
 
         *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;
 
@@ -1225,13 +1222,13 @@ parseEtcHosts(void)
             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 */
@@ -1330,7 +1327,7 @@ keepCapabilities(void)
 
     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");
         }
     }
 
index 5974ffdffeffa7e4ac28bb4322b92af6755cdfb5..95663f55fbedcce9bf9f7ab08d82a53f9aff4911 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -130,7 +130,7 @@ static void
 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);
 
@@ -142,7 +142,7 @@ static void
 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);
 
@@ -153,7 +153,7 @@ sslClientClosed(int fd, void *data)
 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);
@@ -227,7 +227,7 @@ SslStateData::readServer(char *buf, size_t len, comm_err_t errcode, int xerrno)
     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);
@@ -247,8 +247,8 @@ SslStateData::Connection::error(int const xerrno)
     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());
@@ -276,7 +276,7 @@ SslStateData::readClient(char *buf, size_t len, comm_err_t errcode, int xerrno)
     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);
@@ -323,7 +323,7 @@ SslStateData::WriteServerDone(int fd, char *buf, size_t len, comm_err_t flag, in
 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) {
@@ -381,7 +381,7 @@ SslStateData::Connection::dataSent (size_t amount)
 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) {
@@ -417,7 +417,7 @@ static void
 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);
 
@@ -503,7 +503,7 @@ static void
 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);
@@ -545,7 +545,7 @@ sslConnectDone(int fdnotused, comm_err_t status, int xerrno, void *data)
                       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);
@@ -612,8 +612,7 @@ sslStart(ClientHttpRequest * http, size_t * size_ptr, int *status_ptr)
         }
     }
 
-    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. */
@@ -626,7 +625,7 @@ sslStart(ClientHttpRequest * http, size_t * size_ptr, int *status_ptr)
                        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;
@@ -678,7 +677,7 @@ sslProxyConnected(int fd, void *data)
     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;
index 87c418779fe8edd8850a0d451c6ad7afc6c9c00a..9b3ec19a051d5aa35b1efd3891c9092a6e8edc11 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -121,13 +121,11 @@ unlinkdUnlink(const char *path)
     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;
     }
@@ -242,11 +240,11 @@ IPC_FIFO,
     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
 
index 4b89bd600462624ac107d748f9727a5973126adb..e4788fce9df4aa08dbeb25f808022ae5bd411eb2 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -84,7 +84,7 @@ url_convert_hex(char *org_url, int allocate)
 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'.
      */
@@ -230,7 +230,7 @@ urlParse(method_t method, char *url, HttpRequest *request)
     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;
     }
 
@@ -284,7 +284,7 @@ urlParse(method_t method, char *url, HttpRequest *request)
     }
 
     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;
     }
 
@@ -303,7 +303,7 @@ urlParse(method_t method, char *url, HttpRequest *request)
         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;
     }
 
@@ -311,13 +311,13 @@ urlParse(method_t method, char *url, HttpRequest *request)
     /* 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) {
 
@@ -367,7 +367,7 @@ urlParse(method_t method, char *url, HttpRequest *request)
 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);
 }
 
index d158927a42857729768ec6cfc8cd9ed55c95504b..94e7755a5a122cd6300b300faca704d1757c7643 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -135,22 +135,22 @@ urnFindMinRtt(url_entry * urls, method_t m, int *rtt_ret)
     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;
@@ -166,9 +166,9 @@ urnFindMinRtt(url_entry * urls, method_t m, int *rtt_ret)
     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;
 }
@@ -227,7 +227,7 @@ UrnState::setUriResFromRequest(HttpRequest *r)
     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;
@@ -242,7 +242,7 @@ UrnState::setUriResFromRequest(HttpRequest *r)
 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);
 
@@ -328,7 +328,7 @@ urnHandleReply(void *data, StoreIOBuffer result)
     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);
@@ -368,8 +368,7 @@ urnHandleReply(void *data, StoreIOBuffer result)
     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;
     }
 
@@ -377,10 +376,10 @@ urnHandleReply(void *data, StoreIOBuffer result)
     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);
@@ -398,10 +397,10 @@ urnHandleReply(void *data, StoreIOBuffer result)
     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);
@@ -420,7 +419,7 @@ urnHandleReply(void *data, StoreIOBuffer result)
 
     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);
 
@@ -446,7 +445,7 @@ urnHandleReply(void *data, StoreIOBuffer result)
                     "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);
     }
@@ -485,11 +484,11 @@ urnParseReply(const char *inbuf, method_t m)
     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;
@@ -508,7 +507,7 @@ urnParseReply(const char *inbuf, method_t m)
         rtt = netdbHostRtt(host);
 
         if (0 == rtt) {
-            debug(52, 3) ("urnParseReply: Pinging %s\n", host);
+            debugs(52, 3, "urnParseReply: Pinging " << host);
             netdbPingSite(host);
         }
 
@@ -519,6 +518,6 @@ urnParseReply(const char *inbuf, method_t m)
         i++;
     }
 
-    debug(52, 3) ("urnParseReply: Found %d URLs\n", i);
+    debugs(52, 3, "urnParseReply: Found " << i << " URLs");
     return list;
 }
index 66cf7f0e9029a84df98ed2b26f316e5a638cf717..17affe7aaba53648dda8191938427c325091b124 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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>
@@ -47,7 +47,7 @@ useragentOpenLog(void)
     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;
     }
 
index 6ae16ae26a1878cc5d6e00695d076bd8d082b696..ab8eee3b16d16090392d358655bbc500b79cf74f 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -114,7 +114,7 @@ static void wccpAssignBuckets(void);
 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);
@@ -136,10 +136,10 @@ wccpConnectionOpen(void)
 
     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;
     }
 
@@ -159,8 +159,7 @@ wccpConnectionOpen(void)
                   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);
@@ -191,7 +190,7 @@ void
 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;
     }
@@ -212,7 +211,7 @@ wccpHandleUdp(int sock, void *not_used)
     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);
 
@@ -227,14 +226,13 @@ wccpHandleUdp(int sock, void *not_used)
 
                             (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;
@@ -249,8 +247,10 @@ wccpHandleUdp(int sock, void *not_used)
         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;
     }
 
@@ -309,7 +309,7 @@ wccpLowestIP(void)
 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,
@@ -335,7 +335,7 @@ wccpAssignBuckets(void)
     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);
index 82050ed63a490f0cc42a4846feebd3cbbac2c6dd..639760a0c6715aa50b7ba4586e91b681ebc9194c 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -32,6 +32,7 @@
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
  *
  */
+
 #include "squid.h"
 #include "comm.h"
 #include "event.h"
@@ -453,7 +454,7 @@ void wccp2_add_service_list(int service, int service_id, int service_priority,
 static void
 wccp2InitServices(void)
 {
-    debug(80, 5) ("wccp2InitServices: called\n");
+    debugs(80, 5, "wccp2InitServices: called");
 }
 
 static void
@@ -488,7 +489,7 @@ wccp2_add_service_list(int service, int service_id, int service_priority,
 
     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);
@@ -539,7 +540,7 @@ wccp2_update_md5_security(char *password, char *ptr, char *packet, int len)
 
     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));
@@ -550,7 +551,7 @@ wccp2_update_md5_security(char *password, char *ptr, char *packet, int len)
     /* 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;
     }
 
@@ -595,7 +596,7 @@ wccp2_check_security(struct wccp2_service_list_t *srv, char *security, char *pac
 
     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;
     }
 
@@ -606,7 +607,7 @@ wccp2_check_security(struct wccp2_service_list_t *srv, char *security, char *pac
 
     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;
     }
 
@@ -647,7 +648,7 @@ wccp2Init(void)
 
     struct wccp2_security_md5_t wccp2_security_md5;
 
-    debug(80, 5) ("wccp2Init: Called\n");
+    debugs(80, 5, "wccp2Init: Called");
 
     if (wccp2_connected == 1)
         return;
@@ -951,10 +952,10 @@ wccp2ConnectionOpen(void)
 
     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;
     }
 
@@ -981,10 +982,8 @@ wccp2ConnectionOpen(void)
                   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));
@@ -1048,7 +1047,7 @@ wccp2ConnectionClose(void)
     }
 
     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;
     }
@@ -1142,7 +1141,7 @@ wccp2HandleUdp(int sock, void *not_used)
     char *ptr;
     int num_caches;
 
-    debug(80, 6) ("wccp2HandleUdp: Called.\n");
+    debugs(80, 6, "wccp2HandleUdp: Called.");
 
     commSetSelect(sock, COMM_SELECT_READ, wccp2HandleUdp, NULL, 0);
 
@@ -1166,7 +1165,7 @@ wccp2HandleUdp(int sock, void *not_used)
     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);
@@ -1174,7 +1173,7 @@ wccp2HandleUdp(int sock, void *not_used)
     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;
     }
 
@@ -1188,7 +1187,7 @@ wccp2HandleUdp(int sock, void *not_used)
         case WCCP2_SECURITY_INFO:
 
             if (security_info != NULL) {
-                debug(80, 1) ("Duplicate security definition\n");
+                debugs(80, 1, "Duplicate security definition");
                 return;
             }
 
@@ -1198,7 +1197,7 @@ wccp2HandleUdp(int sock, void *not_used)
         case WCCP2_SERVICE_INFO:
 
             if (service_info != NULL) {
-                debug(80, 1) ("Duplicate service_info definition\n");
+                debugs(80, 1, "Duplicate service_info definition");
                 return;
             }
 
@@ -1208,7 +1207,7 @@ wccp2HandleUdp(int sock, void *not_used)
         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;
             }
 
@@ -1218,7 +1217,7 @@ wccp2HandleUdp(int sock, void *not_used)
         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;
             }
 
@@ -1228,7 +1227,7 @@ wccp2HandleUdp(int sock, void *not_used)
         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;
             }
 
@@ -1241,25 +1240,24 @@ wccp2HandleUdp(int sock, void *not_used)
             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;
@@ -1273,7 +1271,7 @@ wccp2HandleUdp(int sock, void *not_used)
     }
 
     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;
     }
 
@@ -1283,7 +1281,7 @@ wccp2HandleUdp(int sock, void *not_used)
     }
 
     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;
     }
 
@@ -1294,7 +1292,7 @@ wccp2HandleUdp(int sock, void *not_used)
     }
 
     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;
     }
 
@@ -1310,7 +1308,7 @@ wccp2HandleUdp(int sock, void *not_used)
     /* 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;
         }
@@ -1355,15 +1353,14 @@ wccp2HandleUdp(int sock, void *not_used)
                 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) {
@@ -1452,7 +1449,7 @@ wccp2HandleUdp(int sock, void *not_used)
 
             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 */
 
@@ -1465,7 +1462,7 @@ wccp2HandleUdp(int sock, void *not_used)
             }
         }
     } 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;
@@ -1483,16 +1480,16 @@ wccp2HandleUdp(int sock, void *not_used)
 
     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");
     }
 }
 
@@ -1512,10 +1509,10 @@ wccp2HereIam(void *voidnotused)
     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;
     }
 
@@ -1534,7 +1531,7 @@ wccp2HereIam(void *voidnotused)
     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;
@@ -1565,7 +1562,7 @@ wccp2HereIam(void *voidnotused)
                 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) {
@@ -1647,7 +1644,7 @@ wccp2AssignBuckets(void *voidnotused)
     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) {
@@ -1991,14 +1988,13 @@ parse_wccp2_service(void *v)
     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();
     }
 
@@ -2007,7 +2003,7 @@ parse_wccp2_service(void *v)
     } 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();
     }
 
@@ -2015,7 +2011,7 @@ parse_wccp2_service(void *v)
     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();
     }
 
@@ -2041,7 +2037,7 @@ dump_wccp2_service(StoreEntry * e, const char *label, void *v)
     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);
@@ -2176,18 +2172,17 @@ parse_wccp2_service_info(void *v)
     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();
     }
 
@@ -2253,12 +2248,13 @@ dump_wccp2_service_info(StoreEntry * e, const char *label, void *v)
     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;
index d797dbd1451af04c8e225f7ee11000046ab3e34a..ba0d35f364449eb06d1c4e8dba7c04d46bd2fa90 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $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
@@ -113,7 +113,7 @@ static void
 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);
 }
 
@@ -146,8 +146,8 @@ WhoisState::readReply (int fd, char *buf, size_t len, comm_err_t flag, int xerrn
     }
 
     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)
@@ -166,8 +166,7 @@ WhoisState::readReply (int fd, char *buf, size_t len, comm_err_t flag, int xerrn
 
         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;
@@ -188,7 +187,7 @@ WhoisState::readReply (int fd, char *buf, size_t len, comm_err_t flag, int xerrn
 
         fwd->complete();
 
-        debug(75, 3) ("whoisReadReply: Done: %s\n", entry->url());
+        debugs(75, 3, "whoisReadReply: Done: " << entry->url()  );
 
         comm_close(fd);
 
@@ -203,7 +202,7 @@ static void
 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);
 }