--------------------- PatchSet 10255 Date: 2007/12/16 02:28:29 Author: adri Branch: s27_adri Tag: (none) Log: strBuf() -> strBuf2() Members: src/client_side.c:1.202.2.9.4.15->1.202.2.9.4.16 src/internal.c:1.15.12.3->1.15.12.4 src/peer_digest.c:1.21.10.2.4.3->1.21.10.2.4.4 src/protos.h:1.146.2.4.4.19->1.146.2.4.4.20 Index: squid/src/client_side.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/client_side.c,v retrieving revision 1.202.2.9.4.15 retrieving revision 1.202.2.9.4.16 diff -u -r1.202.2.9.4.15 -r1.202.2.9.4.16 --- squid/src/client_side.c 15 Dec 2007 11:09:20 -0000 1.202.2.9.4.15 +++ squid/src/client_side.c 16 Dec 2007 02:32:25 -0000 1.202.2.9.4.16 @@ -1,6 +1,6 @@ /* - * $Id: client_side.c,v 1.202.2.9.4.15 2007/12/15 11:09:20 adri Exp $ + * $Id: client_side.c,v 1.202.2.9.4.16 2007/12/16 02:32:25 adri Exp $ * * DEBUG: section 33 Client-side Routines * AUTHOR: Duane Wessels @@ -3619,7 +3619,7 @@ debug(33, 1) ("parseHttpRequest: CONNECT not valid in accelerator mode\n"); goto invalid_request; } - } else if (*url == '/' && Config.onoff.global_internal_static && internalCheck(url)) { + } else if (*url == '/' && Config.onoff.global_internal_static && internalCheck(url, strlen(url))) { internal: /* prepend our name & port */ http->uri = xstrdup(internalStoreUri("", url, strlen(url))); @@ -3664,7 +3664,7 @@ snprintf(http->uri, url_sz, "%s://%s%s", conn->port->protocol, host, url); } - } else if (internalCheck(url)) { + } else if (internalCheck(url, strlen(url))) { goto internal; } else { goto invalid_request; @@ -3718,7 +3718,7 @@ inet_ntoa(http->conn->me.sin_addr), vport, url); debug(33, 5) ("VPORT REWRITE: '%s'\n", http->uri); - } else if (internalCheck(url)) { + } else if (internalCheck(url, strlen(url))) { goto internal; } else { goto invalid_request; @@ -3865,7 +3865,7 @@ if (conn->in.offset > 0) xmemmove(conn->in.buf, conn->in.buf + http->req_sz, conn->in.offset); - if (!http->flags.internal && internalCheck(strBuf(request->urlpath))) { + if (!http->flags.internal && internalCheck(strBuf2(request->urlpath), strLen2(request->urlpath))) { if (internalHostnameIs(request->host)) http->flags.internal = 1; else if (Config.onoff.global_internal_static && internalStaticCheck(request->urlpath)) Index: squid/src/internal.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/internal.c,v retrieving revision 1.15.12.3 retrieving revision 1.15.12.4 diff -u -r1.15.12.3 -r1.15.12.4 --- squid/src/internal.c 15 Dec 2007 11:09:24 -0000 1.15.12.3 +++ squid/src/internal.c 16 Dec 2007 02:32:26 -0000 1.15.12.4 @@ -1,6 +1,6 @@ /* - * $Id: internal.c,v 1.15.12.3 2007/12/15 11:09:24 adri Exp $ + * $Id: internal.c,v 1.15.12.4 2007/12/16 02:32:26 adri Exp $ * * DEBUG: section 76 Internal Squid Object handling * AUTHOR: Duane, Alex, Henrik @@ -66,9 +66,9 @@ } int -internalCheck(const char *urlpath) +internalCheck(const char *urlpath, int len) { - return (0 == strncmp(urlpath, "/squid-internal-", 16)); + return (len > 16 && 0 == strncmp(urlpath, "/squid-internal-", 16)); } int Index: squid/src/peer_digest.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/peer_digest.c,v retrieving revision 1.21.10.2.4.3 retrieving revision 1.21.10.2.4.4 diff -u -r1.21.10.2.4.3 -r1.21.10.2.4.4 --- squid/src/peer_digest.c 15 Dec 2007 12:07:43 -0000 1.21.10.2.4.3 +++ squid/src/peer_digest.c 16 Dec 2007 02:28:29 -0000 1.21.10.2.4.4 @@ -1,6 +1,6 @@ /* - * $Id: peer_digest.c,v 1.21.10.2.4.3 2007/12/15 12:07:43 adri Exp $ + * $Id: peer_digest.c,v 1.21.10.2.4.4 2007/12/16 02:28:29 adri Exp $ * * DEBUG: section 72 Peer Digest Routines * AUTHOR: Alex Rousskov @@ -536,6 +536,7 @@ { PeerDigest *pd = NULL; const char *host = ""; /* peer host */ + int len = strlen(host); const char *reason = NULL; /* reason for completion */ const char *no_bug = NULL; /* successful completion if set */ const int fcb_valid = cbdataValid(fetch); @@ -554,11 +555,13 @@ else if (!cbdataValid(pd)) reason = "invalidated peer digest?!"; #endif - else - host = strBuf(pd->host); + else { + host = strBuf2(pd->host); + len = strLen2(pd->host); + } } - debug(72, 6) ("%s: peer %s, offset: %" PRINTF_OFF_T " size: %d.\n", - step_name, host, fcb_valid ? fetch->offset : (squid_off_t) - 1, (int) size); + debug(72, 6) ("%s: peer %.*s, offset: %" PRINTF_OFF_T " size: %d.\n", + step_name, len, host, fcb_valid ? fetch->offset : (squid_off_t) - 1, (int) size); /* continue checking (with pd and host known and valid) */ if (!reason) { @@ -585,8 +588,8 @@ /* 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); + debug(72, level) ("%s: peer %.*s, exiting after '%s'\n", + step_name, len, host, reason); peerDigestReqFinish(fetch, buf, fcb_valid, pdcb_valid, pcb_valid, reason, !no_bug); } else { Index: squid/src/protos.h =================================================================== RCS file: /cvsroot/squid-sf//squid/src/protos.h,v retrieving revision 1.146.2.4.4.19 retrieving revision 1.146.2.4.4.20 diff -u -r1.146.2.4.4.19 -r1.146.2.4.4.20 --- squid/src/protos.h 15 Dec 2007 12:07:44 -0000 1.146.2.4.4.19 +++ squid/src/protos.h 16 Dec 2007 02:32:26 -0000 1.146.2.4.4.20 @@ -1,6 +1,6 @@ /* - * $Id: protos.h,v 1.146.2.4.4.19 2007/12/15 12:07:44 adri Exp $ + * $Id: protos.h,v 1.146.2.4.4.20 2007/12/16 02:32:26 adri Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -1228,7 +1228,7 @@ extern void cacheDigestReport(CacheDigest * cd, const char *host, int len, StoreEntry * e); extern void internalStart(request_t *, StoreEntry *); -extern int internalCheck(const char *urlpath); +extern int internalCheck(const char *urlpath, int len); extern int internalStaticCheck(String urlpath); extern char *internalLocalUri(const char *dir, const char *name); extern char *internalStoreUri(const char *dir, const char *name, int len);