Patch file generated Fri May 18 18:34:42 NZST 2007 from CVS branch ayjwork CVS base branch HEAD CVS repository: amosjeffries@cvs.devel.squid-cache.org:/cvsroot/squid CVS module: squid3 cvs -q rdiff -u -kk -r Z-ayjwork_merge_HEAD -r ayjwork squid3 Index: squid3/src/ACLHTTPHeaderData.cc diff -u squid3/src/ACLHTTPHeaderData.cc:1.3 squid3/src/ACLHTTPHeaderData.cc:1.2.14.3 --- squid3/src/ACLHTTPHeaderData.cc:1.3 Sat Apr 28 15:51:47 2007 +++ squid3/src/ACLHTTPHeaderData.cc Wed May 2 05:53:05 2007 @@ -87,14 +87,14 @@ char* t = strtokFile(); assert (t != NULL); hdrName = t; - hdrId = httpHeaderIdByNameDef(hdrName.buf(), strlen(hdrName.buf())); + hdrId = httpHeaderIdByNameDef(hdrName.c_str(), hdrName.size()); regex_rule->parse(); } Index: squid3/src/AuthUser.cc diff -u squid3/src/AuthUser.cc:1.7 squid3/src/AuthUser.cc:1.3.4.3 --- squid3/src/AuthUser.cc:1.7 Wed May 9 01:51:04 2007 +++ squid3/src/AuthUser.cc Thu May 17 21:44:45 2007 @@ -143,7 +143,7 @@ if (!proxy_auth_username_cache) { /* First time around, 7921 should be big enough */ proxy_auth_username_cache = - hash_create((HASHCMP *) strcmp, 7921, hash_string); + hash_create((HASHCMP *) std::strcmp, 7921, hash_string); assert(proxy_auth_username_cache); eventAdd("User Cache Maintenance", cacheCleanup, NULL, Config.authenticateGCInterval, 1); } Index: squid3/src/DelayTagged.cc diff -u squid3/src/DelayTagged.cc:1.4 squid3/src/DelayTagged.cc:1.3.24.3 --- squid3/src/DelayTagged.cc:1.4 Sat Apr 28 15:51:48 2007 +++ squid3/src/DelayTagged.cc Mon May 7 03:32:21 2007 @@ -77,7 +77,7 @@ DelayTaggedCmp(DelayTaggedBucket::Pointer const &left, DelayTaggedBucket::Pointer const &right) { /* for rate limiting, case insensitive */ - return left->tag.caseCmp(right->tag.buf()); + return strcasecmp(left->tag, right->tag); } void Index: squid3/src/ESI.cc diff -u squid3/src/ESI.cc:1.23 squid3/src/ESI.cc:1.22.8.3 --- squid3/src/ESI.cc:1.23 Sat Apr 28 15:51:48 2007 +++ squid3/src/ESI.cc Mon May 7 03:32:21 2007 @@ -2450,7 +2450,7 @@ */ return 0; - if (strstr (sctusable->content.buf(), "ESI/1.0")) + if (strstr (sctusable->content, "ESI/1.0")) rv = 1; httpHdrScTargetDestroy (sctusable); Index: squid3/src/ESIVarState.cc diff -u squid3/src/ESIVarState.cc:1.8 squid3/src/ESIVarState.cc:1.7.8.3 --- squid3/src/ESIVarState.cc:1.8 Sat Apr 28 15:51:48 2007 +++ squid3/src/ESIVarState.cc Mon May 7 03:32:22 2007 @@ -885,10 +885,9 @@ if (!tempstr[0]) return; - String strVary (rep->header.getList (HDR_VARY)); + string strVary (rep->header.getList (HDR_VARY)); - if (!strVary.size() || strVary.buf()[0] != '*') { + if (!strVary.size() || strVary[0] != '*') { rep->header.putStr (HDR_VARY, tempstr); } } Index: squid3/src/HttpHdrRange.cc diff -u squid3/src/HttpHdrRange.cc:1.15 squid3/src/HttpHdrRange.cc:1.13.8.3 --- squid3/src/HttpHdrRange.cc:1.15 Mon Apr 30 10:51:35 2007 +++ squid3/src/HttpHdrRange.cc Thu May 3 03:05:07 2007 @@ -253,14 +253,14 @@ int count = 0; assert(this && range_spec); ++ParsedCount; - debugs(64, 8, "parsing range field: '" << range_spec->buf() << "'"); + debugs(64, 8, "parsing range field: '" << *range_spec << "'"); /* check range type */ - if (range_spec->caseCmp("bytes=", 6)) + if (strncasecmp(*range_spec,"bytes=", 6)) return 0; /* skip "bytes="; hack! */ Index: squid3/src/HttpHdrSc.cc diff -u squid3/src/HttpHdrSc.cc:1.6 squid3/src/HttpHdrSc.cc:1.5.8.5 --- squid3/src/HttpHdrSc.cc:1.6 Sat Apr 28 15:51:48 2007 +++ squid3/src/HttpHdrSc.cc Mon May 7 03:32:22 2007 @@ -370,9 +369,9 @@ while (node) { HttpHdrScTarget *sct = (HttpHdrScTarget *)node->data; - if (target && sct->target.buf() && !strcmp (target, sct->target.buf())) + if (target && !sct->target.empty() && !strcmp(target, sct->target) ) return sct; - else if (!target && !sct->target.buf()) + else if (!target && sct->target.empty()) return sct; node = node->next; Index: squid3/src/HttpHeader.cc diff -u squid3/src/HttpHeader.cc:1.44 squid3/src/HttpHeader.cc:1.40.4.7 --- squid3/src/HttpHeader.cc:1.44 Mon May 7 11:51:32 2007 +++ squid3/src/HttpHeader.cc Tue May 8 05:40:10 2007 @@ -602,7 +602,7 @@ } } - if (e->id == HDR_OTHER && stringHasWhitespace(e->name.buf())) { + if (e->id == HDR_OTHER && strpbrk(e->name, w_space) != NULL) { debugs(55, Config.onoff.relaxed_header_parser <= 0 ? 1 : 2, "WARNING: found whitespace in HTTP header name {" << getStringPrefix(field_start, field_end) << "}"); @@ -725,7 +725,7 @@ debugs(55, 9, "deleting '" << name << "' fields in hdr " << this); while ((e = getEntry(&pos))) { - if (!e->name.caseCmp(name)) + if (!strcasecmp(e->name,name)) delAt(pos, count); else CBIT_SET(mask, e->id); @@ -937,12 +937,12 @@ if (id != -1) return getStrOrList(id); - String result; + string result; /* Sorry, an unknown header name. Do linear search */ while ((e = getEntry(&pos))) { - if (e->id == HDR_OTHER && e->name.caseCmp(name) == 0) { - strListAdd(&result, e->value.buf(), ','); + if (e->id == HDR_OTHER && strcasecmp(e->name,name) == 0) { + strListAdd(&result, e->value.c_str(), ','); } } @@ -1625,15 +1618,15 @@ } http_hdr_type -httpHeaderIdByName(const char *name, int name_len, const HttpHeaderFieldInfo * info, int end) +httpHeaderIdByName(const char *name, unsigned int name_len, const HttpHeaderFieldInfo * info, int end) { int i; for (i = 0; i < end; ++i) { - if (name_len >= 0 && name_len != info[i].name.size()) + if (name_len >= 0 && name_len != (unsigned int)info[i].name.size()) continue; - if (!strncasecmp(name, info[i].name.buf(), + if (!strncasecmp(name, info[i].name, name_len < 0 ? info[i].name.size() + 1 : name_len)) return info[i].id; } Index: squid3/src/HttpReply.cc diff -u squid3/src/HttpReply.cc:1.39 squid3/src/HttpReply.cc:1.38.4.5 --- squid3/src/HttpReply.cc:1.39 Fri Apr 20 00:58:35 2007 +++ squid3/src/HttpReply.cc Mon May 7 03:32:22 2007 @@ -278,9 +278,7 @@ two = otherRep->header.getStrOrList(HDR_ETAG); - if (!one.buf() || !two.buf() || strcasecmp (one.buf(), two.buf())) { - one.clean(); - two.clean(); + if (one.empty() || two.empty() || strcasecmp (one, two)) { return 0; } @@ -292,9 +290,9 @@ two = otherRep->header.getStrOrList(HDR_CONTENT_MD5); - if (!one.buf() || !two.buf() || strcasecmp (one.buf(), two.buf())) { - one.clean(); - two.clean(); + if (one.empty() || two.empty() || strcasecmp (one, two)) { + one.clear(); + two.clear(); return 0; } @@ -435,8 +433,8 @@ bool HttpReply::sanityCheckStartLine(MemBuf *buf, http_status *error) { - if (buf->contentSize() >= protoPrefix.size() && protoPrefix.cmp(buf->content(), protoPrefix.size()) != 0) { - debugs(58, 3, "HttpReply::sanityCheckStartLine: missing protocol prefix (" << protoPrefix.buf() << ") in '" << buf->content() << "'"); + if (buf->contentSize() >= protoPrefix.size() && strncmp(protoPrefix, buf->content(), protoPrefix.size()) != 0) { + debugs(58, 3, "HttpReply::sanityCheckStartLine: missing protocol prefix (" << protoPrefix << ") in '" << buf->content() << "'"); *error = HTTP_INVALID_HEADER; return false; } Index: squid3/src/HttpStatusLine.cc diff -u squid3/src/HttpStatusLine.cc:1.7 squid3/src/HttpStatusLine.cc:1.5.12.4 --- squid3/src/HttpStatusLine.cc:1.7 Fri May 4 15:51:11 2007 +++ squid3/src/HttpStatusLine.cc Sat May 5 07:37:31 2007 @@ -90,7 +90,7 @@ // XXX: HttpMsg::parse() has a similar check but is using // casesensitive comparison (which is required by HTTP errata?) - if (protoPrefix.caseCmp(start, protoPrefix.size()) != 0) + if (strncasecmp(protoPrefix,start, protoPrefix.size()) != 0) return 0; start += protoPrefix.size(); Index: squid3/src/access_log.cc diff -u squid3/src/access_log.cc:1.45 squid3/src/access_log.cc:1.41.4.8 --- squid3/src/access_log.cc:1.45 Thu May 17 13:51:55 2007 +++ squid3/src/access_log.cc Thu May 17 22:24:38 2007 @@ -1631,8 +1631,8 @@ static void fvdbInit(void) { - via_table = hash_create((HASHCMP *) strcmp, 977, hash4); - forw_table = hash_create((HASHCMP *) strcmp, 977, hash4); + via_table = hash_create((HASHCMP *) std::strcmp, 977, hash4); + forw_table = hash_create((HASHCMP *) std::strcmp, 977, hash4); } static void @@ -1717,10 +1717,10 @@ { hashFreeItems(via_table, fvdbFreeEntry); hashFreeMemory(via_table); - via_table = hash_create((HASHCMP *) strcmp, 977, hash4); + via_table = hash_create((HASHCMP *) std::strcmp, 977, hash4); hashFreeItems(forw_table, fvdbFreeEntry); hashFreeMemory(forw_table); - forw_table = hash_create((HASHCMP *) strcmp, 977, hash4); + forw_table = hash_create((HASHCMP *) std::strcmp, 977, hash4); } #endif Index: squid3/src/client_db.cc diff -u squid3/src/client_db.cc:1.11 squid3/src/client_db.cc:1.10.8.2 --- squid3/src/client_db.cc:1.11 Sat Apr 28 15:51:49 2007 +++ squid3/src/client_db.cc Thu May 3 06:37:05 2007 @@ -80,7 +80,7 @@ if (client_table) return; - client_table = hash_create((HASHCMP *) strcmp, CLIENT_DB_HASH_SIZE, hash_string); + client_table = hash_create((HASHCMP *) std::strcmp, CLIENT_DB_HASH_SIZE, hash_string); } void Index: squid3/src/dns_internal.cc diff -u squid3/src/dns_internal.cc:1.40 squid3/src/dns_internal.cc:1.38.2.2 --- squid3/src/dns_internal.cc:1.40 Mon Apr 30 10:51:35 2007 +++ squid3/src/dns_internal.cc Thu May 3 06:37:05 2007 @@ -1238,7 +1238,7 @@ if (!init) { memDataInit(MEM_IDNS_QUERY, "idns_query", sizeof(idns_query), 0); memset(RcodeMatrix, '\0', sizeof(RcodeMatrix)); - idns_lookup_hash = hash_create((HASHCMP *) strcmp, 103, hash_string); + idns_lookup_hash = hash_create((HASHCMP *) std::strcmp, 103, hash_string); init++; } } Index: squid3/src/external_acl.cc diff -u squid3/src/external_acl.cc:1.54 squid3/src/external_acl.cc:1.52.4.5 --- squid3/src/external_acl.cc:1.54 Sat Apr 28 15:51:52 2007 +++ squid3/src/external_acl.cc Thu May 3 06:37:05 2007 @@ -1270,7 +1270,7 @@ for (p = Config.externalAclHelperList; p; p = p->next) { if (!p->cache) - p->cache = hash_create((HASHCMP *) strcmp, hashPrime(1024), hash4); + p->cache = hash_create((HASHCMP *) std::strcmp, hashPrime(1024), hash4); if (!p->theHelper) p->theHelper = helperCreate(p->name); Index: squid3/src/fqdncache.cc diff -u squid3/src/fqdncache.cc:1.19 squid3/src/fqdncache.cc:1.18.8.2 --- squid3/src/fqdncache.cc:1.19 Sat Apr 28 15:51:52 2007 +++ squid3/src/fqdncache.cc Thu May 3 06:37:05 2007 @@ -527,7 +527,7 @@ n = hashPrime(fqdncache_high / 4); - fqdn_table = hash_create((HASHCMP *) strcmp, n, hash4); + fqdn_table = hash_create((HASHCMP *) std::strcmp, n, hash4); memDataInit(MEM_FQDNCACHE_ENTRY, "fqdncache_entry", sizeof(fqdncache_entry), 0); Index: squid3/src/ftp.cc diff -u squid3/src/ftp.cc:1.73 squid3/src/ftp.cc:1.62.4.9 --- squid3/src/ftp.cc:1.73 Mon May 7 14:51:23 2007 +++ squid3/src/ftp.cc Tue May 8 05:40:11 2007 @@ -2959,7 +2959,7 @@ if (!ftpState->flags.isdir && /* Not a directory */ !ftpState->flags.try_slash_hack && /* Not in slash hack */ ftpState->mdtm <= 0 && ftpState->size < 0 && /* Not known as a file */ - ftpState->request->urlpath.caseCmp("/%2f", 4) != 0) { /* No slash encoded */ + strncasecmp(ftpState->request->urlpath, "/%2f", 4) != 0) { /* No slash encoded */ switch (ftpState->state) { Index: squid3/src/ident.cc diff -u squid3/src/ident.cc:1.16 squid3/src/ident.cc:1.15.4.2 --- squid3/src/ident.cc:1.16 Sat Apr 28 15:51:53 2007 +++ squid3/src/ident.cc Thu May 3 06:37:06 2007 @@ -270,7 +270,7 @@ void identInit(void) { - ident_hash = hash_create((HASHCMP *) strcmp, + ident_hash = hash_create((HASHCMP *) std::strcmp, hashPrime(Squid_MaxFD / 8), hash4); } Index: squid3/src/ipcache.cc diff -u squid3/src/ipcache.cc:1.20 squid3/src/ipcache.cc:1.19.8.2 --- squid3/src/ipcache.cc:1.20 Sat Apr 28 15:51:53 2007 +++ squid3/src/ipcache.cc Thu May 3 06:37:06 2007 @@ -586,7 +586,7 @@ ipcache_low = (long) (((float) Config.ipcache.size * (float) Config.ipcache.low) / (float) 100); n = hashPrime(ipcache_high / 4); - ip_table = hash_create((HASHCMP *) strcmp, n, hash4); + ip_table = hash_create((HASHCMP *) std::strcmp, n, hash4); memDataInit(MEM_IPCACHE_ENTRY, "ipcache_entry", sizeof(ipcache_entry), 0); } Index: squid3/src/net_db.cc diff -u squid3/src/net_db.cc:1.30 squid3/src/net_db.cc:1.27.8.3 --- squid3/src/net_db.cc:1.30 Mon Apr 30 10:51:40 2007 +++ squid3/src/net_db.cc Tue May 8 23:59:36 2007 @@ -892,11 +892,11 @@ n = hashPrime(Config.Netdb.high / 4); - addr_table = hash_create((HASHCMP *) strcmp, n, hash_string); + addr_table = hash_create((HASHCMP *) std::strcmp, n, hash_string); n = hashPrime(3 * Config.Netdb.high / 4); - host_table = hash_create((HASHCMP *) strcmp, n, hash_string); + host_table = hash_create((HASHCMP *) std::strcmp, n, hash_string); eventAddIsh("netdbSaveState", netdbSaveState, NULL, 3600.0, 1); Index: squid3/src/pconn.cc diff -u squid3/src/pconn.cc:1.17 squid3/src/pconn.cc:1.14.2.3 --- squid3/src/pconn.cc:1.17 Fri May 11 06:51:19 2007 +++ squid3/src/pconn.cc Thu May 17 21:44:46 2007 @@ -217,7 +217,7 @@ PconnPool::PconnPool(const char *aDescr) : table(NULL), descr(aDescr) { int i; - table = hash_create((HASHCMP *) strcmp, 229, hash_string); + table = hash_create((HASHCMP *) std::strcmp, 229, hash_string); for (i = 0; i < PCONN_HIST_SZ; i++) hist[i] = 0; Index: squid3/src/url.cc diff -u squid3/src/url.cc:1.18 squid3/src/url.cc:1.17.4.3 --- squid3/src/url.cc:1.18 Sat Apr 28 15:51:56 2007 +++ squid3/src/url.cc Tue May 1 17:09:51 2007 @@ -268,7 +268,7 @@ for (t = host; *t; t++) *t = xtolower(*t); - if (stringHasWhitespace(host)) { + if (strpbrk(host, w_space) != NULL) { if (URI_WHITESPACE_STRIP == Config.uri_whitespace) { t = q = host; @@ -316,7 +316,7 @@ } #endif - if (stringHasWhitespace(urlpath)) { + if (strpbrk(urlpath, w_space) != NULL) { debugs(23, 2, "urlParse: URI has whitespace: {" << url << "}"); switch (Config.uri_whitespace) { @@ -410,6 +410,22 @@ return (request->canonical = xstrdup(urlbuf)); } +int +stringHasCntl(const char *s) +{ + unsigned char c; + + while ((c = (unsigned char) *s++) != '\0') { + if (c <= 0x1f) + return 1; + + if (c >= 0x7f && c <= 0x9f) + return 1; + } + + return 0; +} + char * urlCanonicalClean(const HttpRequest * request) { Index: squid3/src/urn.cc diff -u squid3/src/urn.cc:1.27 squid3/src/urn.cc:1.25.8.4 --- squid3/src/urn.cc:1.27 Sat Apr 28 15:51:56 2007 +++ squid3/src/urn.cc Thu May 3 03:05:14 2007 @@ -193,7 +193,7 @@ bool UrnState::RequestNeedsMenu(HttpRequest *r) { - return strncasecmp(r->urlpath.buf(), "menu.", 5) == 0; + return strncasecmp(r->urlpath, "menu.", 5) == 0; } void Index: squid3/src/ICAP/ICAPOptions.cc diff -u squid3/src/ICAP/ICAPOptions.cc:1.9 squid3/src/ICAP/ICAPOptions.cc:1.9.4.2 --- squid3/src/ICAP/ICAPOptions.cc:1.9 Thu Apr 5 22:52:43 2007 +++ squid3/src/ICAP/ICAPOptions.cc Mon May 7 03:32:23 2007 @@ -172,8 +172,8 @@ if (eLen < urlLen) { const int eOff = urlLen - eLen; // RFC 3507 examples imply that extensions come without leading '.' - if (urlPath.buf()[eOff-1] == '.' && - strcmp(urlPath.buf() + eOff, e->key) == 0) { + if (urlPath[eOff-1] == '.' && + strcmp(&urlPath[eOff], e->key) == 0) { debugs(93,7, "ICAPOptions url " << urlPath << " matches " << name << " extension " << e->key); return true; Index: squid3/src/ICAP/ICAPServiceRep.cc diff -u squid3/src/ICAP/ICAPServiceRep.cc:1.10 squid3/src/ICAP/ICAPServiceRep.cc:1.7.4.6 --- squid3/src/ICAP/ICAPServiceRep.cc:1.10 Tue May 8 09:51:28 2007 +++ squid3/src/ICAP/ICAPServiceRep.cc Tue May 8 23:59:37 2007 @@ -80,24 +80,24 @@ char *service_type = NULL; - ConfigParser::ParseString(&key); + ConfigParser::ParseString(key); ConfigParser::ParseString(&service_type); ConfigParser::ParseBool(&bypass); - ConfigParser::ParseString(&uri); + ConfigParser::ParseString(uri); - debugs(3, 5, "ICAPService::parseConfigLine (line " << config_lineno << "): " << key.buf() << " " << service_type << " " << bypass); + debugs(3, 5, "ICAPService::parseConfigLine (line " << config_lineno << "): " << key << " " << service_type << " " << bypass); method = parseMethod(service_type); point = parseVectPoint(service_type); debugs(3, 5, "ICAPService::parseConfigLine (line " << config_lineno << "): service is " << methodStr() << "_" << vectPointStr()); - if (uri.cmp("icap://", 7) != 0) { - debugs(3, 0, "ICAPService::parseConfigLine (line " << config_lineno << "): wrong uri: " << uri.buf()); + if (strncmp(uri, "icap://", 7) != 0) { + debugs(3, 0, "ICAPService::parseConfigLine (line " << config_lineno << "): wrong uri: " << uri); return false; } - const char *s = uri.buf() + 7; + const char *s = &uri[7]; const char *e; Index: squid3/src/auth/digest/auth_digest.cc diff -u squid3/src/auth/digest/auth_digest.cc:1.34 squid3/src/auth/digest/auth_digest.cc:1.29.4.6 --- squid3/src/auth/digest/auth_digest.cc:1.34 Wed May 9 02:51:14 2007 +++ squid3/src/auth/digest/auth_digest.cc Thu May 17 21:44:48 2007 @@ -204,7 +204,7 @@ digest_nonce_pool = memPoolCreate("Digest Scheme nonce's", sizeof(digest_nonce_h)); if (!digest_nonce_cache) { - digest_nonce_cache = hash_create((HASHCMP *) strcmp, 7921, hash_string); + digest_nonce_cache = hash_create((HASHCMP *) std::strcmp, 7921, hash_string); assert(digest_nonce_cache); eventAdd("Digest none cache maintenance", authenticateDigestNonceCacheCleanup, NULL, digestConfig.nonceGCInterval, 1); } Index: squid3/src/auth/negotiate/auth_negotiate.cc diff -u squid3/src/auth/negotiate/auth_negotiate.cc:1.16 squid3/src/auth/negotiate/auth_negotiate.cc:1.11.4.4 --- squid3/src/auth/negotiate/auth_negotiate.cc:1.16 Wed May 9 02:51:14 2007 +++ squid3/src/auth/negotiate/auth_negotiate.cc Thu May 17 21:44:48 2007 @@ -180,7 +180,7 @@ negotiateauthenticators = helperStatefulCreate("negotiateauthenticator"); if (!proxy_auth_cache) - proxy_auth_cache = hash_create((HASHCMP *) strcmp, 7921, hash_string); + proxy_auth_cache = hash_create((HASHCMP *) std::strcmp, 7921, hash_string); assert(proxy_auth_cache); Index: squid3/src/auth/ntlm/auth_ntlm.cc diff -u squid3/src/auth/ntlm/auth_ntlm.cc:1.38 squid3/src/auth/ntlm/auth_ntlm.cc:1.33.4.4 --- squid3/src/auth/ntlm/auth_ntlm.cc:1.38 Wed May 9 02:51:14 2007 +++ squid3/src/auth/ntlm/auth_ntlm.cc Thu May 17 21:44:48 2007 @@ -181,7 +181,7 @@ ntlmauthenticators = helperStatefulCreate("ntlmauthenticator"); if (!proxy_auth_cache) - proxy_auth_cache = hash_create((HASHCMP *) strcmp, 7921, hash_string); + proxy_auth_cache = hash_create((HASHCMP *) std::strcmp, 7921, hash_string); assert(proxy_auth_cache);