--------------------- PatchSet 4432 Date: 2007/05/01 16:09:26 Author: amosjeffries Branch: ayjwork Tag: (none) Log: Requested removal of old String/SquidString class. replacing with std::string Members: src/CommonPool.h:1.3->1.3.22.1 src/ConfigParser.h:1.6->1.6.8.1 src/ESIAssign.h:1.3->1.3.20.1 src/ESISegment.cc:1.4.22.1->1.4.22.2 src/ESISegment.h:1.5->1.5.8.1 src/ExternalACLEntry.h:1.5->1.5.8.1 src/HttpHdrCc.cc:1.6.12.1->1.6.12.2 src/HttpHdrRange.cc:1.13.8.1->1.13.8.2 src/HttpHdrSc.cc:1.5.8.1->1.5.8.2 src/HttpHdrSc.h:1.1->1.1.18.1 src/HttpHdrScTarget.cc:1.4->1.4.8.1 src/HttpHdrScTarget.h:1.1->1.1.18.1 src/HttpHeader.cc:1.40.4.2->1.40.4.3 src/HttpHeader.h:1.18->1.18.4.1 src/HttpHeaderRange.h:1.9->1.9.8.1 src/HttpHeaderTools.cc:1.21.4.2->1.21.4.3 src/HttpReply.cc:1.38.4.1->1.38.4.2 src/HttpReply.h:1.18->1.18.8.1 src/HttpRequest.h:1.25.4.1->1.25.4.2 src/HttpStatusLine.cc:1.5.12.1->1.5.12.2 src/HttpStatusLine.h:1.2->1.2.12.1 src/Makefile.am:1.116.2.1->1.116.2.2 src/Store.h:1.25.4.1->1.25.4.2 src/SwapDir.h:1.12->1.12.8.1 src/access_log.cc:1.41.4.3->1.41.4.4 src/cache_cf.cc:1.79.2.2->1.79.2.3 src/client_side.cc:1.119.2.2->1.119.2.3 src/client_side_reply.cc:1.90.4.2->1.90.4.3 src/client_side_request.cc:1.66.4.2->1.66.4.3 src/client_side_request.h:1.25->1.25.4.1 src/delay_pools.cc:1.20.8.1->1.20.8.2 src/errorpage.cc:1.41.4.2->1.41.4.3 src/external_acl.cc:1.52.4.2->1.52.4.3 src/ftp.cc:1.62.4.4->1.62.4.5 src/gopher.cc:1.23.4.2->1.23.4.3 src/http.cc:1.99.2.3->1.99.2.4 src/protos.h:1.80.2.1->1.80.2.2 src/store.cc:1.51.4.2->1.51.4.3 src/structs.h:1.105.2.1->1.105.2.2 src/typedefs.h:1.44->1.44.8.1 src/url.cc:1.17.4.1->1.17.4.2 src/auth/digest/auth_digest.cc:1.29.4.1->1.29.4.2 src/fs/ufs/store_dir_ufs.cc:1.28.4.2->1.28.4.3 src/fs/ufs/ufscommon.h:1.9->1.9.4.1 Index: squid3/src/CommonPool.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/CommonPool.h,v retrieving revision 1.3 retrieving revision 1.3.22.1 diff -u -r1.3 -r1.3.22.1 --- squid3/src/CommonPool.h 5 Aug 2003 02:12:48 -0000 1.3 +++ squid3/src/CommonPool.h 1 May 2007 16:09:26 -0000 1.3.22.1 @@ -1,6 +1,6 @@ /* - * $Id: CommonPool.h,v 1.3 2003/08/05 02:12:48 squidadm Exp $ + * $Id: CommonPool.h,v 1.3.22.1 2007/05/01 16:09:26 amosjeffries Exp $ * * DEBUG: section 77 Delay Pools * AUTHOR: Robert Collins @@ -43,7 +43,7 @@ #define COMMONPOOL_H #if DELAY_POOLS #include "squid.h" -#include "SquidString.h" +#include #include "CompositePoolNode.h" /* Next steps: make this a composite, and TypeLabel a composite method. Index: squid3/src/ConfigParser.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/ConfigParser.h,v retrieving revision 1.6 retrieving revision 1.6.8.1 diff -u -r1.6 -r1.6.8.1 --- squid3/src/ConfigParser.h 29 May 2006 00:50:18 -0000 1.6 +++ squid3/src/ConfigParser.h 1 May 2007 16:09:26 -0000 1.6.8.1 @@ -1,6 +1,6 @@ /* - * $Id: ConfigParser.h,v 1.6 2006/05/29 00:50:18 squidadm Exp $ + * $Id: ConfigParser.h,v 1.6.8.1 2007/05/01 16:09:26 amosjeffries Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -61,7 +61,7 @@ static void ParseUShort(u_short *var); static void ParseBool(bool *var); static void ParseString(char **var); - static void ParseString(String *var); + static void ParseString(string &var); static void ParseWordList(wordlist **list); static char * strtokFile(); }; Index: squid3/src/ESIAssign.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/ESIAssign.h,v retrieving revision 1.3 retrieving revision 1.3.20.1 diff -u -r1.3 -r1.3.20.1 --- squid3/src/ESIAssign.h 31 Aug 2004 02:14:26 -0000 1.3 +++ squid3/src/ESIAssign.h 1 May 2007 16:09:26 -0000 1.3.20.1 @@ -1,5 +1,5 @@ /* - * $Id: ESIAssign.h,v 1.3 2004/08/31 02:14:26 squidadm Exp $ + * $Id: ESIAssign.h,v 1.3.20.1 2007/05/01 16:09:26 amosjeffries Exp $ * * DEBUG: section 86 ESI processing * AUTHOR: Robert Collins @@ -38,7 +38,7 @@ #include "squid.h" #include "ESIElement.h" -#include "SquidString.h" +#include #include "ESIVarState.h" /* ESIVariableExpression */ Index: squid3/src/ESISegment.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/ESISegment.cc,v retrieving revision 1.4.22.1 retrieving revision 1.4.22.2 diff -u -r1.4.22.1 -r1.4.22.2 --- squid3/src/ESISegment.cc 1 May 2007 12:50:23 -0000 1.4.22.1 +++ squid3/src/ESISegment.cc 1 May 2007 16:09:26 -0000 1.4.22.2 @@ -1,6 +1,6 @@ /* - * $Id: ESISegment.cc,v 1.4.22.1 2007/05/01 12:50:23 amosjeffries Exp $ + * $Id: ESISegment.cc,v 1.4.22.2 2007/05/01 16:09:26 amosjeffries Exp $ * * DEBUG: section 86 ESI processing * AUTHOR: Robert Collins @@ -35,7 +35,6 @@ #include "squid.h" #include "ESISegment.h" -#include "SquidString.h" CBDATA_TYPE(ESISegment); @@ -234,7 +233,7 @@ void ESISegment::dumpOne() const { - String temp; + string temp; temp.limitInit(buf, len); - debugs(86, 9, "ESISegment::dumpOne: \"" << temp.buf() << "\""); + debugs(86, 9, "ESISegment::dumpOne: \"" << temp << "\""); } Index: squid3/src/ESISegment.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/ESISegment.h,v retrieving revision 1.5 retrieving revision 1.5.8.1 diff -u -r1.5 -r1.5.8.1 --- squid3/src/ESISegment.h 21 Aug 2006 01:51:49 -0000 1.5 +++ squid3/src/ESISegment.h 1 May 2007 16:09:26 -0000 1.5.8.1 @@ -1,5 +1,5 @@ /* - * $Id: ESISegment.h,v 1.5 2006/08/21 01:51:49 squidadm Exp $ + * $Id: ESISegment.h,v 1.5.8.1 2007/05/01 16:09:26 amosjeffries Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -39,7 +39,7 @@ #include "cbdata.h" #include "RefCount.h" -#include "SquidString.h" +#include class ESISegment : public RefCountable { Index: squid3/src/ExternalACLEntry.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/ExternalACLEntry.h,v retrieving revision 1.5 retrieving revision 1.5.8.1 diff -u -r1.5 -r1.5.8.1 --- squid3/src/ExternalACLEntry.h 21 Aug 2006 01:51:49 -0000 1.5 +++ squid3/src/ExternalACLEntry.h 1 May 2007 16:09:26 -0000 1.5.8.1 @@ -1,6 +1,6 @@ /* - * $Id: ExternalACLEntry.h,v 1.5 2006/08/21 01:51:49 squidadm Exp $ + * $Id: ExternalACLEntry.h,v 1.5.8.1 2007/05/01 16:09:26 amosjeffries Exp $ * * DEBUG: section 82 External ACL * AUTHOR: Henrik Nordstrom, MARA Systems AB @@ -61,11 +61,11 @@ ExternalACLEntryData() : result (-1) {} int result; - String user; - String password; - String message; - String tag; - String log; + string user; + string password; + string message; + string tag; + string log; }; @@ -88,11 +88,11 @@ dlink_node lru; int result; time_t date; - String user; - String password; - String message; - String tag; - String log; + string user; + string password; + string message; + string tag; + string log; external_acl *def; private: Index: squid3/src/HttpHdrCc.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/HttpHdrCc.cc,v retrieving revision 1.6.12.1 retrieving revision 1.6.12.2 diff -u -r1.6.12.1 -r1.6.12.2 --- squid3/src/HttpHdrCc.cc 1 May 2007 12:50:23 -0000 1.6.12.1 +++ squid3/src/HttpHdrCc.cc 1 May 2007 16:09:26 -0000 1.6.12.2 @@ -1,6 +1,6 @@ /* - * $Id: HttpHdrCc.cc,v 1.6.12.1 2007/05/01 12:50:23 amosjeffries Exp $ + * $Id: HttpHdrCc.cc,v 1.6.12.2 2007/05/01 16:09:26 amosjeffries Exp $ * * DEBUG: section 65 HTTP Cache Control Header * AUTHOR: Alex Rousskov @@ -66,7 +66,7 @@ /* local prototypes */ -static int httpHdrCcParseInit(HttpHdrCc * cc, const String * str); +static int httpHdrCcParseInit(HttpHdrCc * cc, const string * str); /* module initialization */ @@ -96,7 +96,7 @@ /* creates an cc object from a 0-terminating string */ HttpHdrCc * -httpHdrCcParseCreate(const String * str) +httpHdrCcParseCreate(const string * str) { HttpHdrCc *cc = httpHdrCcCreate(); @@ -110,7 +110,7 @@ /* parses a 0-terminating string and inits cc */ static int -httpHdrCcParseInit(HttpHdrCc * cc, const String * str) +httpHdrCcParseInit(HttpHdrCc * cc, const string * str) { const char *item; const char *p; /* '=' parameter */ @@ -135,13 +135,13 @@ CcFieldsInfo, CC_ENUM_END); if (type < 0) { - debugs(65, 2, "hdr cc: unknown cache-directive: near '" << item << "' in '" << str->buf() << "'"); + debugs(65, 2, "hdr cc: unknown cache-directive: near '" << item << "' in '" << *str << "'"); type = CC_OTHER; } if (EBIT_TEST(cc->mask, type)) { if (type != CC_OTHER) - debugs(65, 2, "hdr cc: ignoring duplicate cache-directive: near '" << item << "' in '" << str->buf() << "'"); + debugs(65, 2, "hdr cc: ignoring duplicate cache-directive: near '" << item << "' in '" << *str << "'"); CcFieldsInfo[type].stat.repCount++; @@ -206,8 +206,8 @@ { assert(cc); - if (cc->other.buf()) - cc->other.clean(); + if (cc->other.c_str()) + cc->other = ""; memFree(cc, MEM_HTTP_HDR_CC); } @@ -236,7 +236,7 @@ if (EBIT_TEST(cc->mask, flag) && flag != CC_OTHER) { /* print option name */ - packerPrintf(p, (pcount ? ", %s" : "%s"), CcFieldsInfo[flag].name.buf()); + packerPrintf(p, (pcount ? ", %s" : "%s"), CcFieldsInfo[flag].name.c_str()); /* handle options with values */ @@ -254,7 +254,7 @@ } if (cc->other.size()) - packerPrintf(p, (pcount ? ", %s" : "%s"), cc->other.buf()); + packerPrintf(p, (pcount ? ", %s" : "%s"), cc->other.c_str()); } /* negative max_age will clean old max_Age setting */ @@ -300,7 +300,7 @@ extern const HttpHeaderStat *dump_stat; /* argh! */ const int id = (int) val; const int valid_id = id >= 0 && id < CC_ENUM_END; - const char *name = valid_id ? CcFieldsInfo[id].name.buf() : "INVALID"; + const char *name = valid_id ? CcFieldsInfo[id].name.c_str() : "INVALID"; if (count || valid_id) storeAppendPrintf(sentry, "%2d\t %-20s\t %5d\t %6.2f\n", Index: squid3/src/HttpHdrRange.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/HttpHdrRange.cc,v retrieving revision 1.13.8.1 retrieving revision 1.13.8.2 diff -u -r1.13.8.1 -r1.13.8.2 --- squid3/src/HttpHdrRange.cc 1 May 2007 12:50:23 -0000 1.13.8.1 +++ squid3/src/HttpHdrRange.cc 1 May 2007 16:09:26 -0000 1.13.8.2 @@ -1,6 +1,6 @@ /* - * $Id: HttpHdrRange.cc,v 1.13.8.1 2007/05/01 12:50:23 amosjeffries Exp $ + * $Id: HttpHdrRange.cc,v 1.13.8.2 2007/05/01 16:09:26 amosjeffries Exp $ * * DEBUG: section 64 HTTP Range Header * AUTHOR: Alex Rousskov @@ -231,7 +231,7 @@ {} HttpHdrRange * -HttpHdrRange::ParseCreate(const String * range_spec) +HttpHdrRange::ParseCreate(const string * range_spec) { HttpHdrRange *r = new HttpHdrRange; @@ -245,7 +245,7 @@ /* returns true if ranges are valid; inits HttpHdrRange */ bool -HttpHdrRange::parseInit(const String * range_spec) +HttpHdrRange::parseInit(const string * range_spec) { const char *item; const char *pos = NULL; @@ -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->c_str(),"bytes=", 6)) return 0; /* skip "bytes="; hack! */ - pos = range_spec->buf() + 5; + pos = range_spec->c_str() + 5; /* iterate through comma separated list */ while (strListGetItem(range_spec, ',', &item, &ilen, &pos)) { @@ -276,8 +276,7 @@ ++count; } - debugs(64, 8, "parsed range range count: " << count << ", kept " << - specs.size()); + debugs(64, 8, "parsed range range count: " << count << ", kept " << specs.size()); return specs.count != 0; } Index: squid3/src/HttpHdrSc.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/HttpHdrSc.cc,v retrieving revision 1.5.8.1 retrieving revision 1.5.8.2 diff -u -r1.5.8.1 -r1.5.8.2 --- squid3/src/HttpHdrSc.cc 1 May 2007 12:50:23 -0000 1.5.8.1 +++ squid3/src/HttpHdrSc.cc 1 May 2007 16:09:26 -0000 1.5.8.2 @@ -1,6 +1,6 @@ /* - * $Id: HttpHdrSc.cc,v 1.5.8.1 2007/05/01 12:50:23 amosjeffries Exp $ + * $Id: HttpHdrSc.cc,v 1.5.8.2 2007/05/01 16:09:26 amosjeffries Exp $ * * DEBUG: section 90 HTTP Cache Control Header * AUTHOR: Alex Rousskov @@ -67,7 +67,7 @@ /* local prototypes */ -static int httpHdrScParseInit(HttpHdrSc * sc, const String * str); +static int httpHdrScParseInit(HttpHdrSc * sc, const string * str); /* module initialization */ @@ -94,7 +94,7 @@ /* creates an sc object from a 0-terminating string */ HttpHdrSc * -httpHdrScParseCreate(const String * str) +httpHdrScParseCreate(const string * str) { HttpHdrSc *sc = httpHdrScCreate(); @@ -108,7 +108,7 @@ /* parses a 0-terminating string and inits sc */ static int -httpHdrScParseInit(HttpHdrSc * sc, const String * str) +httpHdrScParseInit(HttpHdrSc * sc, const string * str) { const char *item; const char *p; /* '=' parameter */ @@ -139,7 +139,7 @@ ScFieldsInfo, SC_ENUM_END); if (type < 0) { - debugs(90, 2, "hdr sc: unknown control-directive: near '" << item << "' in '" << str->buf() << "'"); + debugs(90, 2, "hdr sc: unknown control-directive: near '" << item << "' in '" << *str << "'"); type = SC_OTHER; } @@ -163,7 +163,7 @@ if (EBIT_TEST(sct->mask, type)) { if (type != SC_OTHER) - debugs(90, 2, "hdr sc: ignoring duplicate control-directive: near '" << item << "' in '" << str->buf() << "'"); + debugs(90, 2, "hdr sc: ignoring duplicate control-directive: near '" << item << "' in '" << *str << "'"); ScFieldsInfo[type].stat.repCount++; @@ -197,7 +197,7 @@ if (!p || !httpHeaderParseQuotedString(p, &sct->content)) { debugs(90, 2, "sc: invalid content= quoted string near '" << item << "'"); - sct->content.clean(); + sct->content = ""; EBIT_CLR(sct->mask, type); } @@ -258,7 +258,7 @@ if (EBIT_TEST(sc->mask, flag) && flag != SC_OTHER) { /* print option name */ - packerPrintf(p, (pcount ? ", %s" : "%s"), ScFieldsInfo[flag].name.buf()); + packerPrintf(p, (pcount ? ", %s" : "%s"), ScFieldsInfo[flag].name.c_str()); /* handle options with values */ @@ -266,14 +266,14 @@ packerPrintf(p, "=%d", (int) sc->max_age); if (flag == SC_CONTENT) - packerPrintf(p, "=\"%s\"", sc->content.buf()); + packerPrintf(p, "=\"%s\"", sc->content.c_str()); pcount++; } } if (sc->target.size()) - packerPrintf (p, ";%s", sc->target.buf()); + packerPrintf (p, ";%s", sc->target.c_str()); } void @@ -340,7 +340,7 @@ extern const HttpHeaderStat *dump_stat; /* argh! */ const int id = (int) val; const int valid_id = id >= 0 && id < SC_ENUM_END; - const char *name = valid_id ? ScFieldsInfo[id].name.buf() : "INVALID"; + const char *name = valid_id ? ScFieldsInfo[id].name.c_str() : "INVALID"; if (count || valid_id) storeAppendPrintf(sentry, "%2d\t %-20s\t %5d\t %6.2f\n", @@ -353,7 +353,7 @@ extern const HttpHeaderStat *dump_stat; /* argh! */ const int id = (int) val; const int valid_id = id >= 0 && id < SC_ENUM_END; - const char *name = valid_id ? ScFieldsInfo[id].name.buf() : "INVALID"; + const char *name = valid_id ? ScFieldsInfo[id].name.c_str() : "INVALID"; if (count || valid_id) storeAppendPrintf(sentry, "%2d\t %-20s\t %5d\t %6.2f\n", @@ -370,9 +370,9 @@ while (node) { HttpHdrScTarget *sct = (HttpHdrScTarget *)node->data; - if (target && sct->target.buf() && !strcmp (target, sct->target.buf())) + if (target && sct->target.c_str() && !strcmp (target, sct->target.c_str())) return sct; - else if (!target && !sct->target.buf()) + else if (!target && !sct->target.c_str()) return sct; node = node->next; Index: squid3/src/HttpHdrSc.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/HttpHdrSc.h,v retrieving revision 1.1 retrieving revision 1.1.18.1 diff -u -r1.1 -r1.1.18.1 --- squid3/src/HttpHdrSc.h 23 Apr 2006 11:27:37 -0000 1.1 +++ squid3/src/HttpHdrSc.h 1 May 2007 16:09:26 -0000 1.1.18.1 @@ -1,6 +1,6 @@ /* - * $Id: HttpHdrSc.h,v 1.1 2006/04/23 11:27:37 squidadm Exp $ + * $Id: HttpHdrSc.h,v 1.1.18.1 2007/05/01 16:09:26 amosjeffries Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -54,7 +54,7 @@ extern void httpHdrScInitModule (void); extern void httpHdrScCleanModule (void); extern HttpHdrSc *httpHdrScCreate(void); -extern HttpHdrSc *httpHdrScParseCreate(String const *); +extern HttpHdrSc *httpHdrScParseCreate(string const *); extern void httpHdrScDestroy(HttpHdrSc * sc); extern HttpHdrSc *httpHdrScDup(const HttpHdrSc * sc); extern void httpHdrScPackInto(const HttpHdrSc * sc, Packer * p); Index: squid3/src/HttpHdrScTarget.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/HttpHdrScTarget.cc,v retrieving revision 1.4 retrieving revision 1.4.8.1 diff -u -r1.4 -r1.4.8.1 --- squid3/src/HttpHdrScTarget.cc 23 Apr 2006 11:27:37 -0000 1.4 +++ squid3/src/HttpHdrScTarget.cc 1 May 2007 16:09:26 -0000 1.4.8.1 @@ -1,6 +1,6 @@ /* - * $Id: HttpHdrScTarget.cc,v 1.4 2006/04/23 11:27:37 squidadm Exp $ + * $Id: HttpHdrScTarget.cc,v 1.4.8.1 2007/05/01 16:09:26 amosjeffries Exp $ * * DEBUG: section 90 HTTP Cache Control Header * AUTHOR: Alex Rousskov @@ -58,8 +58,6 @@ httpHdrScTargetDestroy(HttpHdrScTarget * sc) { assert(sc); - sc->target.clean(); - sc->content.clean(); delete sc; } @@ -68,7 +66,7 @@ { HttpHdrScTarget *dup; assert(sc); - dup = httpHdrScTargetCreate(sc->target.buf()); + dup = httpHdrScTargetCreate(sc->target.c_str()); dup->mask = sc->mask; dup->max_age = sc->max_age; dup->content = sc->content; Index: squid3/src/HttpHdrScTarget.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/HttpHdrScTarget.h,v retrieving revision 1.1 retrieving revision 1.1.18.1 diff -u -r1.1 -r1.1.18.1 --- squid3/src/HttpHdrScTarget.h 23 Apr 2006 11:27:37 -0000 1.1 +++ squid3/src/HttpHdrScTarget.h 1 May 2007 16:09:26 -0000 1.1.18.1 @@ -1,6 +1,6 @@ /* - * $Id: HttpHdrScTarget.h,v 1.1 2006/04/23 11:27:37 squidadm Exp $ + * $Id: HttpHdrScTarget.h,v 1.1.18.1 2007/05/01 16:09:26 amosjeffries Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -47,8 +47,8 @@ int mask; int max_age; int max_stale; - String content; - String target; + string content; + string target; }; MEMPROXY_CLASS_INLINE(HttpHdrScTarget); Index: squid3/src/HttpHeader.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/HttpHeader.cc,v retrieving revision 1.40.4.2 retrieving revision 1.40.4.3 diff -u -r1.40.4.2 -r1.40.4.3 --- squid3/src/HttpHeader.cc 1 May 2007 12:50:24 -0000 1.40.4.2 +++ squid3/src/HttpHeader.cc 1 May 2007 16:09:26 -0000 1.40.4.3 @@ -1,6 +1,6 @@ /* - * $Id: HttpHeader.cc,v 1.40.4.2 2007/05/01 12:50:24 amosjeffries Exp $ + * $Id: HttpHeader.cc,v 1.40.4.3 2007/05/01 16:09:26 amosjeffries Exp $ * * DEBUG: section 55 HTTP Header * AUTHOR: Alex Rousskov @@ -256,7 +256,7 @@ #define assert_eid(id) assert((id) >= 0 && (id) < HDR_ENUM_END) -static void httpHeaderNoteParsedEntry(http_hdr_type id, String const &value, int error); +static void httpHeaderNoteParsedEntry(http_hdr_type id, string const &value, int error); static void httpHeaderStatInit(HttpHeaderStat * hs, const char *label); static void httpHeaderStatDump(const HttpHeaderStat * hs, StoreEntry * e); @@ -455,7 +455,7 @@ debugs(55, 7, "Updating header '" << HeadersAttrs[e->id].name << "' in cached entry"); - delByName(e->name.buf()); + delByName(e->name.c_str()); addEntry(e->clone()); } @@ -562,7 +562,7 @@ } if (e->id == HDR_CONTENT_LENGTH && (e2 = findEntry(e->id)) != NULL) { - if (e->value.cmp(e2->value.buf()) != 0) { + if (e->value.compare(e2->value) != 0) { ssize_t l1, l2; debugs(55, Config.onoff.relaxed_header_parser <= 0 ? 1 : 2, "WARNING: found two conflicting content-length headers in {" << getStringPrefix(header_start, header_end) << "}"); @@ -572,12 +572,12 @@ goto reset; } - if (!httpHeaderParseSize(e->value.buf(), &l1)) { - debugs(55, 1, "WARNING: Unparseable content-length '" << e->value.buf() << "'"); + if (!httpHeaderParseSize(e->value.c_str(), &l1)) { + debugs(55, 1, "WARNING: Unparseable content-length '" << e->value << "'"); delete e; continue; - } else if (!httpHeaderParseSize(e2->value.buf(), &l2)) { - debugs(55, 1, "WARNING: Unparseable content-length '" << e2->value.buf() << "'"); + } else if (!httpHeaderParseSize(e2->value.c_str(), &l2)) { + debugs(55, 1, "WARNING: Unparseable content-length '" << e2->value << "'"); delById(e2->id); } else if (l1 > l2) { delById(e2->id); @@ -599,7 +599,7 @@ } } - if (e->id == HDR_OTHER && stringHasWhitespace(e->name.buf())) { + if (e->id == HDR_OTHER && stringHasWhitespace(e->name.c_str())) { debugs(55, Config.onoff.relaxed_header_parser <= 0 ? 1 : 2, "WARNING: found whitespace in HTTP header name {" << getStringPrefix(field_start, field_end) << "}"); @@ -722,7 +722,7 @@ debugs(55, 9, "deleting '" << name << "' fields in hdr " << this); while ((e = getEntry(&pos))) { - if (!e->name.caseCmp(name)) { + if (!strcasecmp(e->name.c_str(),name)) { delAt(pos); count++; } else @@ -824,7 +824,7 @@ } bool -HttpHeader::getList(http_hdr_type id, String *s) const +HttpHeader::getList(http_hdr_type id, string *s) const { HttpHeaderEntry *e; HttpHeaderPos pos = HttpHeaderInitPos; @@ -837,7 +837,7 @@ while ((e = getEntry(&pos))) { if (e->id == id) - strListAdd(s, e->value.buf(), ','); + strListAdd(s, e->value.c_str(), ','); } /* @@ -855,7 +855,7 @@ } /* return a list of entries with the same id separated by ',' and ws */ -String +string HttpHeader::getList(http_hdr_type id) const { HttpHeaderEntry *e; @@ -865,13 +865,13 @@ assert(CBIT_TEST(ListHeadersMask, id)); if (!CBIT_TEST(mask, id)) - return String(); + return ""; - String s; + string s; while ((e = getEntry(&pos))) { if (e->id == id) - strListAdd(&s, e->value.buf(), ','); + strListAdd(&s, e->value.c_str(), ','); } /* @@ -889,7 +889,7 @@ } /* return a string or list of entries with the same id separated by ',' and ws */ -String +string HttpHeader::getStrOrList(http_hdr_type id) const { HttpHeaderEntry *e; @@ -900,13 +900,13 @@ if ((e = findEntry(id))) return e->value; - return String(); + return ""; } /* * Returns the value of the specified header. */ -String +string HttpHeader::getByName(const char *name) const { http_hdr_type id; @@ -921,12 +921,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.c_str(),name) == 0) { + strListAdd(&result, e->value.c_str(), ','); } } @@ -936,10 +936,10 @@ /* * Returns a the value of the specified list member, if any. */ -String +string HttpHeader::getByNameListMember(const char *name, const char *member, const char separator) const { - String header; + string header; const char *pos = NULL; const char *item; int ilen; @@ -949,7 +949,7 @@ header = getByName(name); - String result; + string result; while (strListGetItem(&header, separator, &item, &ilen, &pos)) { if (strncmp(item, member, mlen) == 0 && item[mlen] == '=') { @@ -964,10 +964,10 @@ /* * returns a the value of the specified list member, if any. */ -String +string HttpHeader::getListMember(http_hdr_type id, const char *member, const char separator) const { - String header; + string header; const char *pos = NULL; const char *item; int ilen; @@ -976,7 +976,7 @@ assert(id >= 0); header = getStrOrList(id); - String result; + string result; while (strListGetItem(&header, separator, &item, &ilen, &pos)) { if (strncmp(item, member, mlen) == 0 && item[mlen] == '=') { @@ -985,7 +985,6 @@ } } - header.clean(); return result; } @@ -1149,7 +1148,7 @@ assert(Headers[id].type == ftDate_1123); /* must be of an appropriate type */ if ((e = findEntry(id))) { - value = parse_rfc1123(e->value.buf()); + value = parse_rfc1123(e->value.c_str()); httpHeaderNoteParsedEntry(e->id, e->value, value < 0); } @@ -1166,7 +1165,7 @@ if ((e = findEntry(id))) { httpHeaderNoteParsedEntry(e->id, e->value, 0); /* no errors are possible */ - return e->value.buf(); + return e->value.c_str(); } return NULL; @@ -1182,7 +1181,7 @@ if ((e = findLastEntry(id))) { httpHeaderNoteParsedEntry(e->id, e->value, 0); /* no errors are possible */ - return e->value.buf(); + return e->value.c_str(); } return NULL; @@ -1192,7 +1191,7 @@ HttpHeader::getCc() const { HttpHdrCc *cc; - String s; + string s; if (!CBIT_TEST(mask, HDR_CACHE_CONTROL)) return NULL; @@ -1239,7 +1238,7 @@ if (!CBIT_TEST(mask, HDR_SURROGATE_CONTROL)) return NULL; - String s; + string s; (void) getList(HDR_SURROGATE_CONTROL, &s); @@ -1262,7 +1261,7 @@ HttpHeaderEntry *e; if ((e = findEntry(HDR_CONTENT_RANGE))) { - cr = httpHdrContRangeParseCreate(e->value.buf()); + cr = httpHdrContRangeParseCreate(e->value.c_str()); httpHeaderNoteParsedEntry(e->id, e->value, !cr); } @@ -1308,7 +1307,7 @@ assert(Headers[id].type == ftETag); /* must be of an appropriate type */ if ((e = findEntry(id))) - etagParseInit(&etag, e->value.buf()); + etagParseInit(&etag, e->value.c_str()); return etag; } @@ -1322,7 +1321,7 @@ memset(&tot, 0, sizeof(tot)); if ((e = findEntry(id))) { - const char *str = e->value.buf(); + const char *str = e->value.c_str(); /* try as an ETag */ if (etagParseInit(&tot.tag, str)) { @@ -1358,19 +1357,13 @@ Headers[id].stat.aliveCount++; - debugs(55, 9, "created HttpHeaderEntry " << this << ": '" << name.buf() << " : " << value.buf()); + debugs(55, 9, "created HttpHeaderEntry " << this << ": '" << name << " : " << value); } HttpHeaderEntry::~HttpHeaderEntry() { assert_eid(id); - debugs(55, 9, "destroying entry " << this << ": '" << name.buf() << ": " << value.buf() << "'"); - /* clean name if needed */ - - if (id == HDR_OTHER) - name.clean(); - - value.clean(); + debugs(55, 9, "destroying entry " << this << ": '" << name << ": " << value << "'"); assert(Headers[id].stat.aliveCount); @@ -1420,9 +1413,9 @@ /* is it a "known" field? */ http_hdr_type id = httpHeaderIdByName(field_start, name_len, Headers, HDR_ENUM_END); - String name; + string name; - String value; + string value; if (id < 0) id = HDR_OTHER; @@ -1430,8 +1423,10 @@ assert_eid(id); /* set field name */ - if (id == HDR_OTHER) - name.limitInit(field_start, name_len); + if (id == HDR_OTHER) { + name = field_start; + name[name_len] = '\0'; + } else name = Headers[id].name; @@ -1444,39 +1439,40 @@ if (field_end - value_start > 65534) { /* String must be LESS THAN 64K and it adds a terminating NULL */ - debugs(55, 1, "WARNING: ignoring '" << name.buf() << "' header of " << (field_end - value_start) << " bytes"); + debugs(55, 1, "WARNING: ignoring '" << name << "' header of " << (field_end - value_start) << " bytes"); if (id == HDR_OTHER) - name.clean(); + name = ""; return NULL; } /* set field value */ - value.limitInit(value_start, field_end - value_start); + value = value_start; + value[field_end - value_start] = '\0'; Headers[id].stat.seenCount++; Headers[id].stat.aliveCount++; - debugs(55, 9, "parsed HttpHeaderEntry: '" << name.buf() << ": " << value.buf() << "'"); + debugs(55, 9, "parsed HttpHeaderEntry: '" << name << ": " << value << "'"); - return new HttpHeaderEntry(id, name.buf(), value.buf()); + return new HttpHeaderEntry(id, name.c_str(), value.c_str()); } HttpHeaderEntry * HttpHeaderEntry::clone() const { - return new HttpHeaderEntry(id, name.buf(), value.buf()); + return new HttpHeaderEntry(id, name.c_str(), value.c_str()); } void HttpHeaderEntry::packInto(Packer * p) const { assert(p); - packerAppend(p, name.buf(), name.size()); + packerAppend(p, name.c_str(), name.size()); packerAppend(p, ": ", 2); - packerAppend(p, value.buf(), value.size()); + packerAppend(p, value.c_str(), value.size()); packerAppend(p, "\r\n", 2); } @@ -1486,7 +1482,7 @@ assert_eid (id); assert (Headers[id].type == ftInt); int val = -1; - int ok = httpHeaderParseInt(value.buf(), &val); + int ok = httpHeaderParseInt(value.c_str(), &val); httpHeaderNoteParsedEntry(id, value, !ok); /* XXX: Should we check ok - ie * return ok ? -1 : value; @@ -1495,13 +1491,13 @@ } static void -httpHeaderNoteParsedEntry(http_hdr_type id, String const &context, int error) +httpHeaderNoteParsedEntry(http_hdr_type id, string const &context, int error) { Headers[id].stat.parsCount++; if (error) { Headers[id].stat.errCount++; - debugs(55, 2, "cannot parse hdr field: '" << Headers[id].name.buf() << ": " << context.buf() << "'"); + debugs(55, 2, "cannot parse hdr field: '" << Headers[id].name << ": " << context << "'"); } } @@ -1518,7 +1514,7 @@ { const int id = (int) val; const int valid_id = id >= 0 && id < HDR_ENUM_END; - const char *name = valid_id ? Headers[id].name.buf() : "INVALID"; + const char *name = valid_id ? Headers[id].name.c_str() : "INVALID"; int visible = count > 0; /* for entries with zero count, list only those that belong to current type of message */ @@ -1596,7 +1592,7 @@ for (ht = (http_hdr_type)0; ht < HDR_ENUM_END; ++ht) { HttpHeaderFieldInfo *f = Headers + ht; storeAppendPrintf(e, "%2d\t %-20s\t %5d\t %6.3f\t %6.3f\n", - f->id, f->name.buf(), f->stat.aliveCount, + f->id, f->name.c_str(), f->stat.aliveCount, xpercent(f->stat.errCount, f->stat.parsCount), xpercent(f->stat.repCount, f->stat.seenCount)); } @@ -1609,7 +1605,7 @@ } 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; @@ -1617,7 +1613,7 @@ if (name_len >= 0 && name_len != info[i].name.size()) continue; - if (!strncasecmp(name, info[i].name.buf(), + if (!strncasecmp(name, info[i].name.c_str(), name_len < 0 ? info[i].name.size() + 1 : name_len)) return info[i].id; } @@ -1642,7 +1638,7 @@ assert(id >= 0 && id < HDR_ENUM_END); - return Headers[id].name.buf(); + return Headers[id].name.c_str(); } int @@ -1656,7 +1652,7 @@ assert(id >= 0); - String header (getStrOrList(id)); + string header (getStrOrList(id)); while (strListGetItem(&header, separator, &item, &ilen, &pos)) { if (strncmp(item, member, mlen) == 0 @@ -1680,7 +1676,7 @@ assert(name); - String header (getByName(name)); + string header (getByName(name)); while (strListGetItem(&header, separator, &item, &ilen, &pos)) { if (strncmp(item, member, mlen) == 0 @@ -1698,9 +1694,9 @@ { if (has(HDR_CONNECTION)) { /* anything that matches Connection list member will be deleted */ - String strConnection; - - (void) getList(HDR_CONNECTION, &strConnection); + string strConnection; + + (void) getList(HDR_CONNECTION, &strConnection); const HttpHeaderEntry *e; HttpHeaderPos pos = HttpHeaderInitPos; /* @@ -1713,7 +1709,7 @@ */ while ((e = getEntry(&pos))) { - if (strListIsMember(&strConnection, e->name.buf(), ',')) + if (strListIsMember(&strConnection, e->name.c_str(), ',')) delAt(pos); } Index: squid3/src/HttpHeader.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/HttpHeader.h,v retrieving revision 1.18 retrieving revision 1.18.4.1 diff -u -r1.18 -r1.18.4.1 --- squid3/src/HttpHeader.h 2 Oct 2006 10:52:36 -0000 1.18 +++ squid3/src/HttpHeader.h 1 May 2007 16:09:26 -0000 1.18.4.1 @@ -1,6 +1,6 @@ /* - * $Id: HttpHeader.h,v 1.18 2006/10/02 10:52:36 squidadm Exp $ + * $Id: HttpHeader.h,v 1.18.4.1 2007/05/01 16:09:26 amosjeffries Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -183,8 +183,8 @@ int getInt() const; MEMPROXY_CLASS(HttpHeaderEntry); http_hdr_type id; - String name; - String value; + string name; + string value; }; MEMPROXY_CLASS_INLINE(HttpHeaderEntry) @@ -210,12 +210,12 @@ void delAt(HttpHeaderPos pos); void addEntry(HttpHeaderEntry * e); void insertEntry(HttpHeaderEntry * e); - String getList(http_hdr_type id) const; - bool getList(http_hdr_type id, String *s) const; - String getStrOrList(http_hdr_type id) const; - String getByName(const char *name) const; - String getByNameListMember(const char *name, const char *member, const char separator) const; - String getListMember(http_hdr_type id, const char *member, const char separator) const; + string getList(http_hdr_type id) const; + bool getList(http_hdr_type id, string *s) const; + string getStrOrList(http_hdr_type id) const; + string getByName(const char *name) const; + string getByNameListMember(const char *name, const char *member, const char separator) const; + string getListMember(http_hdr_type id, const char *member, const char separator) const; int has(http_hdr_type id) const; void putInt(http_hdr_type id, int number); void putTime(http_hdr_type id, time_t htime); @@ -257,7 +257,7 @@ extern void httpHeaderRegisterWithCacheManager(CacheManager & manager); -extern int httpHeaderParseQuotedString (const char *start, String *val); +extern int httpHeaderParseQuotedString (const char *start, string *val); SQUIDCEXTERN int httpHeaderHasByNameListMember(const HttpHeader * hdr, const char *name, const char *member, const char separator); SQUIDCEXTERN void httpHeaderUpdate(HttpHeader * old, const HttpHeader * fresh, const HttpHeaderMask * denied_mask); int httpMsgIsPersistent(HttpVersion const &http_ver, const HttpHeader * hdr); Index: squid3/src/HttpHeaderRange.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/HttpHeaderRange.h,v retrieving revision 1.9 retrieving revision 1.9.8.1 diff -u -r1.9 -r1.9.8.1 --- squid3/src/HttpHeaderRange.h 6 Jun 2006 19:50:39 -0000 1.9 +++ squid3/src/HttpHeaderRange.h 1 May 2007 16:09:26 -0000 1.9.8.1 @@ -1,6 +1,6 @@ /* - * $Id: HttpHeaderRange.h,v 1.9 2006/06/06 19:50:39 squidadm Exp $ + * $Id: HttpHeaderRange.h,v 1.9.8.1 2007/05/01 16:09:26 amosjeffries Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -38,7 +38,7 @@ #include "Range.h" #include "Array.h" #include "Packer.h" -#include "SquidString.h" +#include class HttpReply; /* http byte-range-spec */ @@ -78,7 +78,7 @@ static size_t ParsedCount; /* Http Range Header Field */ - static HttpHdrRange *ParseCreate(const String * range_spec); + static HttpHdrRange *ParseCreate(const string * range_spec); HttpHdrRange(); HttpHdrRange(HttpHdrRange const &); @@ -96,7 +96,7 @@ int canonize(size_t); int canonize(HttpReply *rep); /* returns true if ranges are valid; inits HttpHdrRange */ - bool parseInit(const String * range_spec); + bool parseInit(const string * range_spec); void packInto(Packer * p) const; /* other */ bool isComplex() const; @@ -127,7 +127,7 @@ ssize_t debt() const; void debt(ssize_t); ssize_t debt_size; /* bytes left to send from the current spec */ - String boundary; /* boundary for multipart responses */ + string boundary; /* boundary for multipart responses */ bool valid; }; Index: squid3/src/HttpHeaderTools.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/HttpHeaderTools.cc,v retrieving revision 1.21.4.2 retrieving revision 1.21.4.3 diff -u -r1.21.4.2 -r1.21.4.3 --- squid3/src/HttpHeaderTools.cc 1 May 2007 12:50:24 -0000 1.21.4.2 +++ squid3/src/HttpHeaderTools.cc 1 May 2007 16:09:26 -0000 1.21.4.3 @@ -1,6 +1,6 @@ /* - * $Id: HttpHeaderTools.cc,v 1.21.4.2 2007/05/01 12:50:24 amosjeffries Exp $ + * $Id: HttpHeaderTools.cc,v 1.21.4.3 2007/05/01 16:09:26 amosjeffries Exp $ * * DEBUG: section 66 HTTP Header Tools * AUTHOR: Alex Rousskov @@ -75,7 +75,7 @@ int i; for (i = 0; i < count; ++i) - table[i].name.clean(); + table[i].name.clear(); delete [] table; } @@ -161,7 +161,7 @@ int httpHeaderHasConnDir(const HttpHeader * hdr, const char *directive) { - String list; + string list; http_hdr_type ht; int res; /* what type of header do we have? */ @@ -177,14 +177,12 @@ res = strListIsMember(&list, directive, ','); - list.clean(); - return res; } /* returns true iff "m" is a member of the list */ int -strListIsMember(const String * list, const char *m, char del) +strListIsMember(const string * list, const char *m, char del) { const char *pos = NULL; const char *item; @@ -203,10 +201,10 @@ /* returns true iff "s" is a substring of a member of the list */ int -strListIsSubstr(const String * list, const char *s, char del) +strListIsSubstr(const string * list, const char *s, char del) { assert(list && del); - return list->pos(s) != 0; + return list->find(s) != 0; /* * Note: the original code with a loop is broken because it uses strstr() @@ -219,7 +217,7 @@ /* appends an item to the list */ void -strListAdd(String * str, const char *item, char del) +strListAdd(string * str, const char *item, char del) { assert(str && item); @@ -243,7 +241,7 @@ * init pos with NULL to start iteration. */ int -strListGetItem(const String * str, char del, const char **item, int *ilen, const char **pos) +strListGetItem(const string * str, char del, const char **item, int *ilen, const char **pos) { size_t len; static char delim[2][3] = { @@ -260,7 +258,7 @@ else (*pos)++; } else { - *pos = str->buf(); + *pos = str->c_str(); if (!*pos) return 0; @@ -349,10 +347,10 @@ * RC TODO: This is too looose. We should honour the BNF and exclude CTL's */ int -httpHeaderParseQuotedString (const char *start, String *val) +httpHeaderParseQuotedString (const char *start, string *val) { const char *end, *pos; - val->clean(); + val->clear(); assert (*start == '"'); pos = start + 1; Index: squid3/src/HttpReply.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/HttpReply.cc,v retrieving revision 1.38.4.1 retrieving revision 1.38.4.2 diff -u -r1.38.4.1 -r1.38.4.2 --- squid3/src/HttpReply.cc 22 Apr 2007 09:56:49 -0000 1.38.4.1 +++ squid3/src/HttpReply.cc 1 May 2007 16:09:26 -0000 1.38.4.2 @@ -1,6 +1,6 @@ /* - * $Id: HttpReply.cc,v 1.38.4.1 2007/04/22 09:56:49 amosjeffries Exp $ + * $Id: HttpReply.cc,v 1.38.4.2 2007/05/01 16:09:26 amosjeffries Exp $ * * DEBUG: section 58 HTTP Reply (Response) * AUTHOR: Alex Rousskov @@ -105,7 +105,7 @@ // virtual function instead, but it is not clear whether virtual methods // are allowed with MEMPROXY_CLASS() and whether some cbdata void* // conversions are not going to kill virtual tables - const String pfx = protoPrefix; + const string pfx = protoPrefix; clean(); init(); protoPrefix = pfx; @@ -220,7 +220,7 @@ hdr->putStr(HDR_CONTENT_TYPE, ctype); content_type = ctype; } else - content_type = String(); + content_type = ""; if (clen >= 0) hdr->putInt(HDR_CONTENT_LENGTH, clen); @@ -262,7 +262,7 @@ int HttpReply::validatorsMatch(HttpReply const * otherRep) const { - String one,two; + string one,two; assert (otherRep); /* Numbers first - easiest to check */ /* Content-Length */ @@ -278,9 +278,9 @@ two = otherRep->header.getStrOrList(HDR_ETAG); - if (!one.buf() || !two.buf() || strcasecmp (one.buf(), two.buf())) { - one.clean(); - two.clean(); + if (!one.c_str() || !two.c_str() || strcasecmp (one.c_str(), two.c_str())) { + one.clear(); + two.clear(); return 0; } @@ -292,9 +292,9 @@ two = otherRep->header.getStrOrList(HDR_CONTENT_MD5); - if (!one.buf() || !two.buf() || strcasecmp (one.buf(), two.buf())) { - one.clean(); - two.clean(); + if (!one.c_str() || !two.c_str() || strcasecmp (one.c_str(), two.c_str())) { + one.clear(); + two.clear(); return 0; } @@ -380,10 +380,12 @@ keep_alive = httpMsgIsPersistent(sline.version, &header); const char *str = header.getStr(HDR_CONTENT_TYPE); - if (str) - content_type.limitInit(str, strcspn(str, ";\t ")); + if (str) { + content_type = str; + content_type[strcspn(str, ";\t ")] = '\0'; + } else - content_type = String(); + content_type = ""; /* be sure to set expires after date and cache-control */ expires = hdrExpirationTime(); @@ -393,7 +395,7 @@ void HttpReply::hdrCacheClean() { - content_type.clean(); + content_type.clear(); if (cache_control) { httpHdrCcDestroy(cache_control); @@ -435,8 +437,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 ((unsigned int)buf->contentSize() >= protoPrefix.size() && strncmp(protoPrefix.c_str(), 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/HttpReply.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/HttpReply.h,v retrieving revision 1.18 retrieving revision 1.18.8.1 diff -u -r1.18 -r1.18.8.1 --- squid3/src/HttpReply.h 23 Apr 2006 11:27:37 -0000 1.18 +++ squid3/src/HttpReply.h 1 May 2007 16:09:26 -0000 1.18.8.1 @@ -1,6 +1,6 @@ /* - * $Id: HttpReply.h,v 1.18 2006/04/23 11:27:37 squidadm Exp $ + * $Id: HttpReply.h,v 1.18.8.1 2007/05/01 16:09:26 amosjeffries Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -77,7 +77,7 @@ time_t expires; - String content_type; + string content_type; HttpHdrSc *surrogate_control; @@ -90,7 +90,7 @@ HttpBody body; /* for small constant memory-resident text bodies only */ - String protoPrefix; // e.g., "HTTP/" + string protoPrefix; // e.g., "HTTP/" bool do_clean; Index: squid3/src/HttpRequest.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/HttpRequest.h,v retrieving revision 1.25.4.1 retrieving revision 1.25.4.2 diff -u -r1.25.4.1 -r1.25.4.2 --- squid3/src/HttpRequest.h 22 Apr 2007 09:56:50 -0000 1.25.4.1 +++ squid3/src/HttpRequest.h 1 May 2007 16:09:26 -0000 1.25.4.2 @@ -1,6 +1,6 @@ /* - * $Id: HttpRequest.h,v 1.25.4.1 2007/04/22 09:56:50 amosjeffries Exp $ + * $Id: HttpRequest.h,v 1.25.4.2 2007/05/01 16:09:26 amosjeffries Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -34,13 +34,14 @@ #ifndef SQUID_HTTPREQUEST_H #define SQUID_HTTPREQUEST_H +#include #include "HttpMsg.h" #include "client_side.h" #include "HierarchyLogEntry.h" #include "HttpRequestMethod.h" /* Http Request */ -extern int httpRequestHdrAllowed(const HttpHeaderEntry * e, String * strConnection); +extern int httpRequestHdrAllowed(const HttpHeaderEntry * e, string * strConnection); extern int httpRequestHdrAllowedByName(http_hdr_type id); extern void httpRequestPack(void *obj, Packer *p); @@ -84,7 +85,7 @@ u_short port; - String urlpath; + string urlpath; char *canonical; @@ -120,13 +121,13 @@ char *peer_domain; /* Configured peer forceddomain */ - String tag; /* Internal tag for this request */ + string tag; /* Internal tag for this request */ - String extacl_user; /* User name returned by extacl lookup */ + string extacl_user; /* User name returned by extacl lookup */ - String extacl_passwd; /* Password returned by extacl lookup */ + string extacl_passwd; /* Password returned by extacl lookup */ - String extacl_log; /* String to be used for access.log purposes */ + string extacl_log; /* String to be used for access.log purposes */ public: bool multipartRangeRequest() const; Index: squid3/src/HttpStatusLine.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/HttpStatusLine.cc,v retrieving revision 1.5.12.1 retrieving revision 1.5.12.2 diff -u -r1.5.12.1 -r1.5.12.2 --- squid3/src/HttpStatusLine.cc 1 May 2007 12:50:24 -0000 1.5.12.1 +++ squid3/src/HttpStatusLine.cc 1 May 2007 16:09:26 -0000 1.5.12.2 @@ -1,6 +1,6 @@ /* - * $Id: HttpStatusLine.cc,v 1.5.12.1 2007/05/01 12:50:24 amosjeffries Exp $ + * $Id: HttpStatusLine.cc,v 1.5.12.2 2007/05/01 16:09:26 amosjeffries Exp $ * * DEBUG: section 57 HTTP Status-line * AUTHOR: Alex Rousskov @@ -82,7 +82,7 @@ * so NULL-termination assumed. */ int -httpStatusLineParse(HttpStatusLine * sline, const String &protoPrefix, const char *start, const char *end) +httpStatusLineParse(HttpStatusLine * sline, const string &protoPrefix, const char *start, const char *end) { assert(sline); sline->status = HTTP_INVALID_HEADER; /* Squid header parsing error */ @@ -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.c_str(),start, protoPrefix.size()) != 0) return 0; start += protoPrefix.size(); Index: squid3/src/HttpStatusLine.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/HttpStatusLine.h,v retrieving revision 1.2 retrieving revision 1.2.12.1 diff -u -r1.2 -r1.2.12.1 --- squid3/src/HttpStatusLine.h 13 Sep 2005 02:12:43 -0000 1.2 +++ squid3/src/HttpStatusLine.h 1 May 2007 16:09:26 -0000 1.2.12.1 @@ -1,6 +1,6 @@ /* - * $Id: HttpStatusLine.h,v 1.2 2005/09/13 02:12:43 squidadm Exp $ + * $Id: HttpStatusLine.h,v 1.2.12.1 2007/05/01 16:09:26 amosjeffries Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -56,7 +56,7 @@ SQUIDCEXTERN const char *httpStatusLineReason(const HttpStatusLine * sline); /* parse/pack */ /* parse a 0-terminating buffer and fill internal structires; returns true on success */ -SQUIDCEXTERN int httpStatusLineParse(HttpStatusLine * sline, const String &protoPrefix, +SQUIDCEXTERN int httpStatusLineParse(HttpStatusLine * sline, const string &protoPrefix, const char *start, const char *end); /* pack fields using Packer */ SQUIDCEXTERN void httpStatusLinePackInto(const HttpStatusLine * sline, Packer * p); Index: squid3/src/Makefile.am =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/Makefile.am,v retrieving revision 1.116.2.1 retrieving revision 1.116.2.2 diff -u -r1.116.2.1 -r1.116.2.2 --- squid3/src/Makefile.am 25 Apr 2007 08:43:10 -0000 1.116.2.1 +++ squid3/src/Makefile.am 1 May 2007 16:09:26 -0000 1.116.2.2 @@ -1,7 +1,7 @@ # # Makefile for the Squid Object Cache server # -# $Id: Makefile.am,v 1.116.2.1 2007/04/25 08:43:10 amosjeffries Exp $ +# $Id: Makefile.am,v 1.116.2.2 2007/05/01 16:09:26 amosjeffries Exp $ # # Uncomment and customize the following to suit your needs: # @@ -556,7 +556,6 @@ $(SSL_SOURCE) \ stat.cc \ StatHist.cc \ - String.cc \ stmem.cc \ stmem.h \ store.cc \ @@ -626,8 +625,6 @@ MemBuf.h \ Store.cci \ StoreEntryStream.h \ - String.cci \ - SquidString.h \ SquidTime.h nodist_squid_SOURCES = \ @@ -727,7 +724,6 @@ StoreMetaUnpacker.cc \ StoreMetaURL.cc \ StoreMetaVary.cc \ - String.cc \ time.cc \ ufsdump.cc \ url.cc \ @@ -1108,7 +1104,7 @@ authenticate.cc \ ConfigParser.cc \ tests/stub_acl.cc tests/stub_cache_cf.cc \ - tests/stub_helper.cc cbdata.cc String.cc \ + tests/stub_helper.cc cbdata.cc \ tests/stub_store.cc HttpHeaderTools.cc HttpHeader.cc acl.cc event.cc mem.cc \ MemBuf.cc HttpHdrContRange.cc Packer.cc ACLChecklist.cc HttpHdrCc.cc HttpHdrSc.cc \ HttpHdrScTarget.cc url.cc ACLProxyAuth.cc ACLRegexData.cc ACLUserData.cc \ @@ -1126,7 +1122,7 @@ URLScheme.cc \ wordlist.cc ## acl.cc cache_cf.cc tools.cc \ -## helper.cc String.cc cbdata.cc HttpHeaderTools.cc store.cc cache_manager.cc \ +## helper.cc cbdata.cc HttpHeaderTools.cc store.cc cache_manager.cc \ ## HttpHeader.cc url.cc mem.cc HttpRequest.cc Packer.cc access_log.cc \ ## MemBuf.cc StatHist.cc logfile.cc @@ -1162,7 +1158,6 @@ ## HttpHdrScTarget.cc \ ## Packer.cc \ ## StatHist.cc \ -## String.cc \ tests_testACLMaxUserIP_SOURCES= \ acl.cc \ ACLChecklist.cc \ @@ -1187,7 +1182,6 @@ Parsing.cc \ StatHist.cc \ stmem.cc \ - String.cc \ tests/stub_cache_cf.cc \ tests/stub_comm.cc \ tests/stub_DelayId.cc \ @@ -1235,7 +1229,6 @@ HttpRequest.cc \ HttpRequestMethod.cc \ mem.cc \ - String.cc \ tests/testCacheManager.cc \ tests/testCacheManager.h \ tests/testMain.cc \ @@ -1399,7 +1392,6 @@ HttpRequestMethod.cc \ mem.cc \ RemovalPolicy.cc \ - String.cc \ tests/CapturingStoreEntry.h \ tests/testEvent.cc \ tests/testEvent.h \ @@ -1551,7 +1543,6 @@ HttpRequestMethod.cc \ mem.cc \ RemovalPolicy.cc \ - String.cc \ tests/testEventLoop.cc \ tests/testEventLoop.h \ tests/testMain.cc \ @@ -1839,7 +1830,6 @@ StoreMetaURL.cc \ StoreMetaVary.cc \ StoreSwapLogData.cc \ - String.cc \ SwapDir.cc \ time.cc \ tools.cc \ @@ -1881,7 +1871,6 @@ HttpRequest.cc \ HttpRequestMethod.cc \ mem.cc \ - String.cc \ tests/testHttpRequest.h \ tests/testHttpRequest.cc \ tests/testHttpRequestMethod.h \ @@ -2048,7 +2037,7 @@ SwapDir.cc \ authenticate.cc \ tests/stub_acl.cc tests/stub_cache_cf.cc \ - tests/stub_helper.cc cbdata.cc String.cc \ + tests/stub_helper.cc cbdata.cc \ tests/stub_comm.cc \ tests/stub_client_side_request.cc \ tests/stub_http.cc \ @@ -2102,25 +2091,6 @@ tests_testStore_DEPENDENCIES = $(top_builddir)/lib/libmiscutil.a \ @SQUID_CPPUNIT_LA@ -# string needs mem.cc. -tests_testString_SOURCES= \ - mem.cc \ - String.cc \ - tests/testMain.cc \ - tests/testString.cc \ - tests/testString.h \ - $(TESTSOURCES) \ - time.cc - -tests_testString_LDADD= \ - -L../lib -lmiscutil \ - @REGEXLIB@ \ - @SQUID_CPPUNIT_LIBS@ \ - @SSLLIB@ -tests_testString_LDFLAGS = $(LIBADD_DL) -tests_testString_DEPENDENCIES = $(top_builddir)/lib/libmiscutil.a \ - @SQUID_CPPUNIT_LA@ - SWAP_TEST_SOURCES = \ tests/stub_store_rebuild.cc \ tests/stub_internal.cc \ @@ -2217,7 +2187,6 @@ HttpRequestMethod.cc \ mem.cc \ RemovalPolicy.cc \ - String.cc \ tests/testURL.cc \ tests/testURL.h \ tests/testURLScheme.cc \ Index: squid3/src/Store.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/Store.h,v retrieving revision 1.25.4.1 retrieving revision 1.25.4.2 diff -u -r1.25.4.1 -r1.25.4.2 --- squid3/src/Store.h 22 Apr 2007 09:56:50 -0000 1.25.4.1 +++ squid3/src/Store.h 1 May 2007 16:09:27 -0000 1.25.4.2 @@ -1,6 +1,6 @@ /* - * $Id: Store.h,v 1.25.4.1 2007/04/22 09:56:50 amosjeffries Exp $ + * $Id: Store.h,v 1.25.4.2 2007/05/01 16:09:27 amosjeffries Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -258,7 +258,7 @@ /* TODO: imeplement the async version */ virtual void get - (String const key , STOREGETCLIENT callback, void *cbdata) = 0; + (string const key , STOREGETCLIENT callback, void *cbdata) = 0; /* prepare the store for use. The store need not be usable immediately, * it should respond to readable() and writable() with true as soon @@ -282,7 +282,7 @@ virtual void unlink (StoreEntry &); /* search in the store */ - virtual StoreSearch *search(String const url, HttpRequest *) = 0; + virtual StoreSearch *search(string const url, HttpRequest *) = 0; /* pulled up from SwapDir for migration.... probably do not belong here */ virtual void reference(StoreEntry &) = 0; /* Reference this object */ Index: squid3/src/SwapDir.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/SwapDir.h,v retrieving revision 1.12 retrieving revision 1.12.8.1 diff -u -r1.12 -r1.12.8.1 --- squid3/src/SwapDir.h 21 Aug 2006 01:51:49 -0000 1.12 +++ squid3/src/SwapDir.h 1 May 2007 16:09:27 -0000 1.12.8.1 @@ -1,6 +1,6 @@ /* - * $Id: SwapDir.h,v 1.12 2006/08/21 01:51:49 squidadm Exp $ + * $Id: SwapDir.h,v 1.12.8.1 2007/05/01 16:09:27 amosjeffries Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -60,7 +60,7 @@ (const cache_key *); virtual void get - (String const, STOREGETCLIENT, void * cbdata); + (string const, STOREGETCLIENT, void * cbdata); virtual void init(); @@ -74,7 +74,7 @@ virtual void sync(); /* Sync the store prior to shutdown */ - virtual StoreSearch *search(String const url, HttpRequest *); + virtual StoreSearch *search(string const url, HttpRequest *); virtual void reference(StoreEntry &); /* Reference this object */ @@ -134,13 +134,13 @@ (const cache_key *); virtual void get - (String const, STOREGETCLIENT, void * cbdata); + (string const, STOREGETCLIENT, void * cbdata); virtual size_t maxSize() const { return max_size;} virtual size_t minSize() const; virtual void stat (StoreEntry &anEntry) const; - virtual StoreSearch *search(String const url, HttpRequest *) = 0; + virtual StoreSearch *search(string const url, HttpRequest *) = 0; virtual void updateSize(size_t size, int sign); Index: squid3/src/access_log.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/access_log.cc,v retrieving revision 1.41.4.3 retrieving revision 1.41.4.4 diff -u -r1.41.4.3 -r1.41.4.4 --- squid3/src/access_log.cc 1 May 2007 12:50:25 -0000 1.41.4.3 +++ squid3/src/access_log.cc 1 May 2007 16:09:27 -0000 1.41.4.4 @@ -1,6 +1,6 @@ /* - * $Id: access_log.cc,v 1.41.4.3 2007/05/01 12:50:25 amosjeffries Exp $ + * $Id: access_log.cc,v 1.41.4.4 2007/05/01 16:09:27 amosjeffries Exp $ * * DEBUG: section 46 Access Log * AUTHOR: Duane Wessels @@ -516,7 +516,7 @@ logformat_token *fmt; static MemBuf mb; char tmp[1024]; - String sb; + string sb; mb.reset(); @@ -626,7 +626,7 @@ if (al->request) sb = al->request->header.getByName(fmt->data.header.header); - out = sb.buf(); + out = sb.c_str(); quote = 1; @@ -636,7 +636,7 @@ if (al->reply) sb = al->request->header.getByName(fmt->data.header.header); - out = sb.buf(); + out = sb.c_str(); quote = 1; @@ -646,7 +646,7 @@ if (al->request) sb = al->request->header.getByNameListMember(fmt->data.header.header, fmt->data.header.element, fmt->data.header.separator); - out = sb.buf(); + out = sb.c_str(); quote = 1; @@ -656,7 +656,7 @@ if (al->reply) sb = al->request->header.getByNameListMember(fmt->data.header.header, fmt->data.header.element, fmt->data.header.separator); - out = sb.buf(); + out = sb.c_str(); quote = 1; @@ -804,7 +804,7 @@ case LFT_TAG: if (al->request) - out = al->request->tag.buf(); + out = al->request->tag.c_str(); quote = 1; @@ -812,7 +812,7 @@ case LFT_EXT_LOG: if (al->request) - out = al->request->extacl_log.buf(); + out = al->request->extacl_log.c_str(); quote = 1; @@ -882,7 +882,7 @@ if (fmt->space) mb.append(" ", 1); - sb.clean(); + sb = ""; if (dofree) safe_free(out); Index: squid3/src/cache_cf.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/cache_cf.cc,v retrieving revision 1.79.2.2 retrieving revision 1.79.2.3 diff -u -r1.79.2.2 -r1.79.2.3 --- squid3/src/cache_cf.cc 1 May 2007 12:50:25 -0000 1.79.2.2 +++ squid3/src/cache_cf.cc 1 May 2007 16:09:27 -0000 1.79.2.3 @@ -1,6 +1,6 @@ /* - * $Id: cache_cf.cc,v 1.79.2.2 2007/05/01 12:50:25 amosjeffries Exp $ + * $Id: cache_cf.cc,v 1.79.2.3 2007/05/01 16:09:27 amosjeffries Exp $ * * DEBUG: section 3 Configuration File Parsing * AUTHOR: Harvest Derived @@ -2201,14 +2201,14 @@ } void -ConfigParser::ParseString(String *var) +ConfigParser::ParseString(string &var) { char *token = strtok(NULL, w_space); if (token == NULL) self_destruct(); - var->reset(token); + var = token; } static void Index: squid3/src/client_side.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/client_side.cc,v retrieving revision 1.119.2.2 retrieving revision 1.119.2.3 diff -u -r1.119.2.2 -r1.119.2.3 --- squid3/src/client_side.cc 1 May 2007 12:50:25 -0000 1.119.2.2 +++ squid3/src/client_side.cc 1 May 2007 16:09:27 -0000 1.119.2.3 @@ -1,6 +1,6 @@ /* - * $Id: client_side.cc,v 1.119.2.2 2007/05/01 12:50:25 amosjeffries Exp $ + * $Id: client_side.cc,v 1.119.2.3 2007/05/01 16:09:27 amosjeffries Exp $ * * DEBUG: section 33 Client-side Routines * AUTHOR: Duane Wessels @@ -459,7 +459,7 @@ aLogEntry->http.version = request->http_ver; aLogEntry->hier = request->hier; - aLogEntry->cache.extuser = request->extacl_user.buf(); + aLogEntry->cache.extuser = request->extacl_user.c_str(); if (request->auth_user_request) { @@ -483,10 +483,10 @@ if (al.reply) { al.http.code = al.reply->sline.status; - al.http.content_type = al.reply->content_type.buf(); + al.http.content_type = al.reply->content_type.c_str(); } else if (loggingEntry() && loggingEntry()->mem_obj) { al.http.code = loggingEntry()->mem_obj->getReply()->sline.status; - al.http.content_type = loggingEntry()->mem_obj->getReply()->content_type.buf(); + al.http.content_type = loggingEntry()->mem_obj->getReply()->content_type.c_str(); } debugs(33, 9, "clientLogRequest: http.code='" << al.http.code << "'"); @@ -543,7 +543,7 @@ safe_free(uri); safe_free(log_uri); safe_free(redirect.location); - range_iter.boundary.clean(); + range_iter.boundary = ""; HTTPMSGUNLOCK(request); if (client_stream.tail) @@ -828,15 +828,15 @@ /* put terminating boundary for multiparts */ static void -clientPackTermBound(String boundary, MemBuf * mb) +clientPackTermBound(string boundary, MemBuf * mb) { - mb->Printf("\r\n--%s--\r\n", boundary.buf()); + mb->Printf("\r\n--%s--\r\n", boundary.c_str()); debugs(33, 6, "clientPackTermBound: buf offset: " << mb->size); } /* appends a "part" HTTP header (as in a multi-part/range reply) to the buffer */ static void -clientPackRangeHdr(const HttpReply * rep, const HttpHdrRangeSpec * spec, String boundary, MemBuf * mb) +clientPackRangeHdr(const HttpReply * rep, const HttpHdrRangeSpec * spec, string boundary, MemBuf * mb) { HttpHeader hdr(hoReply); Packer p; @@ -844,10 +844,9 @@ assert(spec); /* put boundary */ - debugs(33, 5, "clientPackRangeHdr: appending boundary: " << - boundary.buf()); + debugs(33, 5, "clientPackRangeHdr: appending boundary: " << boundary); /* rfc2046 requires to _prepend_ boundary with ! */ - mb->Printf("\r\n--%s\r\n", boundary.buf()); + mb->Printf("\r\n--%s\r\n", boundary.c_str()); /* stuff the header with required entries and pack it */ @@ -1039,12 +1038,12 @@ /* generates a "unique" boundary string for multipart responses * the caller is responsible for cleaning the string */ -String +string ClientHttpRequest::rangeBoundaryStr() const { assert(this); const char *key; - String b (full_appname_string); + string b (full_appname_string); b.append (":",1); key = storeEntry()->getMD5Text(); b.append(key, strlen(key)); @@ -1156,7 +1155,7 @@ hdr->delById(HDR_CONTENT_TYPE); httpHeaderPutStrf(hdr, HDR_CONTENT_TYPE, "multipart/byteranges; boundary=\"%s\"", - http->range_iter.boundary.buf()); + http->range_iter.boundary.c_str()); /* Content-Length is not required in multipart responses * but it is always nice to have one */ actual_clen = http->mRangeCLen(); @@ -2189,11 +2188,11 @@ request->flags.tproxy = conn->port->tproxy; #endif - if (internalCheck(request->urlpath.buf())) { + if (internalCheck(request->urlpath.c_str())) { if (internalHostnameIs(request->host) && request->port == getMyPort()) { http->flags.internal = 1; - } else if (Config.onoff.global_internal_static && internalStaticCheck(request->urlpath.buf())) { + } else if (Config.onoff.global_internal_static && internalStaticCheck(request->urlpath.c_str())) { xstrncpy(request->host, internalHostname(), SQUIDHOSTNAMELEN); request->port = getMyPort(); Index: squid3/src/client_side_reply.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/client_side_reply.cc,v retrieving revision 1.90.4.2 retrieving revision 1.90.4.3 diff -u -r1.90.4.2 -r1.90.4.3 --- squid3/src/client_side_reply.cc 1 May 2007 12:50:25 -0000 1.90.4.2 +++ squid3/src/client_side_reply.cc 1 May 2007 16:09:27 -0000 1.90.4.3 @@ -1,6 +1,6 @@ /* - * $Id: client_side_reply.cc,v 1.90.4.2 2007/05/01 12:50:25 amosjeffries Exp $ + * $Id: client_side_reply.cc,v 1.90.4.3 2007/05/01 16:09:27 amosjeffries Exp $ * * DEBUG: section 88 Client-side Reply Routines * AUTHOR: Robert Collins (Originally Duane Wessels in client_side.c) @@ -1263,7 +1263,7 @@ while ((e = hdr->getEntry(&pos))) { if (e->id == HDR_WWW_AUTHENTICATE || e->id == HDR_PROXY_AUTHENTICATE) { - const char *value = e->value.buf(); + const char *value = e->value.c_str(); if ((strncasecmp(value, "NTLM", 4) == 0 && (value[4] == '\0' || value[4] == ' ')) @@ -1313,7 +1313,7 @@ /* Append VIA */ { LOCAL_ARRAY(char, bbuf, MAX_URL + 32); - String strVia; + string strVia; hdr->getList(HDR_VIA, &strVia); snprintf(bbuf, sizeof(bbuf), "%d.%d %s", reply->sline.version.major, @@ -1321,7 +1321,7 @@ ThisCache); strListAdd(&strVia, bbuf, ','); hdr->delById(HDR_VIA); - hdr->putStr(HDR_VIA, strVia.buf()); + hdr->putStr(HDR_VIA, strVia.c_str()); } /* Signal keep-alive if needed */ hdr->putStr(http->flags.accel ? HDR_CONNECTION : HDR_PROXY_CONNECTION, Index: squid3/src/client_side_request.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/client_side_request.cc,v retrieving revision 1.66.4.2 retrieving revision 1.66.4.3 diff -u -r1.66.4.2 -r1.66.4.3 --- squid3/src/client_side_request.cc 1 May 2007 12:50:25 -0000 1.66.4.2 +++ squid3/src/client_side_request.cc 1 May 2007 16:09:27 -0000 1.66.4.3 @@ -1,6 +1,6 @@ /* - * $Id: client_side_request.cc,v 1.66.4.2 2007/05/01 12:50:25 amosjeffries Exp $ + * $Id: client_side_request.cc,v 1.66.4.3 2007/05/01 16:09:27 amosjeffries Exp $ * * DEBUG: section 85 Client-side Request Routines * AUTHOR: Robert Collins (Originally Duane Wessels in client_side.c) @@ -630,12 +630,10 @@ #else if (req_hdr->has(HDR_PRAGMA)) { - String s = req_hdr->getList(HDR_PRAGMA); + string s = req_hdr->getList(HDR_PRAGMA); if (strListIsMember(&s, "no-cache", ',')) no_cache++; - - s.clean(); } if (request->cache_control) @@ -714,7 +712,7 @@ request->flags.auth = 1; if (req_hdr->has(HDR_VIA)) { - String s = req_hdr->getList(HDR_VIA); + string s = req_hdr->getList(HDR_VIA); /* * ThisCache cannot be a member of Via header, "1.0 ThisCache" can. * Note ThisCache2 has a space prepended to the hostname so we don't @@ -731,8 +729,6 @@ fvdbCountVia(s.buf()); #endif - - s.clean(); } #if USE_USERAGENT_LOG Index: squid3/src/client_side_request.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/client_side_request.h,v retrieving revision 1.25 retrieving revision 1.25.4.1 diff -u -r1.25 -r1.25.4.1 --- squid3/src/client_side_request.h 6 Apr 2007 05:52:36 -0000 1.25 +++ squid3/src/client_side_request.h 1 May 2007 16:09:27 -0000 1.25.4.1 @@ -1,6 +1,6 @@ /* - * $Id: client_side_request.h,v 1.25 2007/04/06 05:52:36 squidadm Exp $ + * $Id: client_side_request.h,v 1.25.4.1 2007/05/01 16:09:27 amosjeffries Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -76,7 +76,7 @@ ClientHttpRequest(ClientHttpRequest const &); ClientHttpRequest& operator=(ClientHttpRequest const &); - String rangeBoundaryStr() const; + string rangeBoundaryStr() const; void freeResources(); void updateCounters(); void logRequest(); Index: squid3/src/delay_pools.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/delay_pools.cc,v retrieving revision 1.20.8.1 retrieving revision 1.20.8.2 diff -u -r1.20.8.1 -r1.20.8.2 --- squid3/src/delay_pools.cc 1 May 2007 12:50:27 -0000 1.20.8.1 +++ squid3/src/delay_pools.cc 1 May 2007 16:09:27 -0000 1.20.8.2 @@ -1,6 +1,6 @@ /* - * $Id: delay_pools.cc,v 1.20.8.1 2007/05/01 12:50:27 amosjeffries Exp $ + * $Id: delay_pools.cc,v 1.20.8.2 2007/05/01 16:09:27 amosjeffries Exp $ * * DEBUG: section 77 Delay Pools * AUTHOR: Robert Collins @@ -52,7 +52,7 @@ #include "ConfigParser.h" #include "DelayId.h" #include "Array.h" -#include "SquidString.h" +#include #include "SquidTime.h" #include "CommonPool.h" #include "CompositePoolNode.h" Index: squid3/src/errorpage.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/errorpage.cc,v retrieving revision 1.41.4.2 retrieving revision 1.41.4.3 diff -u -r1.41.4.2 -r1.41.4.3 --- squid3/src/errorpage.cc 1 May 2007 12:50:27 -0000 1.41.4.2 +++ squid3/src/errorpage.cc 1 May 2007 16:09:27 -0000 1.41.4.3 @@ -1,6 +1,6 @@ /* - * $Id: errorpage.cc,v 1.41.4.2 2007/05/01 12:50:27 amosjeffries Exp $ + * $Id: errorpage.cc,v 1.41.4.3 2007/05/01 16:09:27 amosjeffries Exp $ * * DEBUG: section 4 Error Generation * AUTHOR: Duane Wessels @@ -540,7 +540,7 @@ Packer p; str.Printf("%s %s HTTP/%d.%d\n", RequestMethodStr[r->method], - r->urlpath.size() ? r->urlpath.buf() : "/", + r->urlpath.size() ? r->urlpath.c_str() : "/", r->http_ver.major, r->http_ver.minor); packerToMemInit(&p, &str); r->header.packInto(&p); @@ -745,7 +745,7 @@ Packer p; mb.Printf("%s %s HTTP/%d.%d\n", RequestMethodStr[r->method], - r->urlpath.size() ? r->urlpath.buf() : "/", + r->urlpath.size() ? r->urlpath.c_str() : "/", r->http_ver.major, r->http_ver.minor); packerToMemInit(&p, &mb); r->header.packInto(&p); Index: squid3/src/external_acl.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/external_acl.cc,v retrieving revision 1.52.4.2 retrieving revision 1.52.4.3 diff -u -r1.52.4.2 -r1.52.4.3 --- squid3/src/external_acl.cc 1 May 2007 12:50:27 -0000 1.52.4.2 +++ squid3/src/external_acl.cc 1 May 2007 16:09:27 -0000 1.52.4.3 @@ -1,6 +1,6 @@ /* - * $Id: external_acl.cc,v 1.52.4.2 2007/05/01 12:50:27 amosjeffries Exp $ + * $Id: external_acl.cc,v 1.52.4.3 2007/05/01 16:09:27 amosjeffries Exp $ * * DEBUG: section 82 External ACL * AUTHOR: Henrik Nordstrom, MARA Systems AB @@ -689,7 +689,7 @@ external_acl_cache_touch(acl->def, entry); result = entry->result; - external_acl_message = entry->message.buf(); + external_acl_message = entry->message.c_str(); debugs(82, 2, "aclMatchExternal: " << acl->def->name << " = " << result); @@ -759,7 +759,7 @@ for (format = acl_data->def->format; format; format = format->next) { const char *str = NULL; - String sb; + string sb; switch (format->type) { @@ -812,7 +812,7 @@ break; case _external_acl_format::EXT_ACL_PATH: - str = request->urlpath.buf(); + str = request->urlpath.c_str(); break; case _external_acl_format::EXT_ACL_METHOD: @@ -821,22 +821,22 @@ case _external_acl_format::EXT_ACL_HEADER: sb = request->header.getByName(format->header); - str = sb.buf(); + str = sb.c_str(); break; case _external_acl_format::EXT_ACL_HEADER_ID: sb = request->header.getStrOrList(format->header_id); - str = sb.buf(); + str = sb.c_str(); break; case _external_acl_format::EXT_ACL_HEADER_MEMBER: sb = request->header.getByNameListMember(format->header, format->member, format->separator); - str = sb.buf(); + str = sb.c_str(); break; case _external_acl_format::EXT_ACL_HEADER_ID_MEMBER: sb = request->header.getListMember(format->header_id, format->member, format->separator); - str = sb.buf(); + str = sb.c_str(); break; #if USE_SSL @@ -886,7 +886,7 @@ #endif case _external_acl_format::EXT_ACL_EXT_USER: - str = request->extacl_user.buf(); + str = request->extacl_user.c_str(); break; case _external_acl_format::EXT_ACL_UNKNOWN: @@ -913,7 +913,7 @@ strwordquote(&mb, str); } - sb.clean(); + sb = ""; first = 0; } @@ -1236,8 +1236,8 @@ if (entry != NULL) { 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() << " }"); + entry->result << ", user=" << entry->user << " tag=" << + entry->tag << " log=" << entry->log << " }"); } Index: squid3/src/ftp.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/ftp.cc,v retrieving revision 1.62.4.4 retrieving revision 1.62.4.5 diff -u -r1.62.4.4 -r1.62.4.5 --- squid3/src/ftp.cc 1 May 2007 12:50:27 -0000 1.62.4.4 +++ squid3/src/ftp.cc 1 May 2007 16:09:28 -0000 1.62.4.5 @@ -1,6 +1,6 @@ /* - * $Id: ftp.cc,v 1.62.4.4 2007/05/01 12:50:27 amosjeffries Exp $ + * $Id: ftp.cc,v 1.62.4.5 2007/05/01 16:09:28 amosjeffries Exp $ * * DEBUG: section 9 File Transfer Protocol (FTP) * AUTHOR: Harvest Derived @@ -126,9 +126,9 @@ int password_url; char *reply_hdr; int reply_hdr_state; - String clean_url; - String title_url; - String base_href; + string clean_url; + string title_url; + string base_href; int conn_att; int login_att; ftp_state_t state; @@ -443,9 +443,9 @@ safe_free(old_filepath); - title_url.clean(); + title_url = ""; - base_href.clean(); + base_href = ""; safe_free(filepath); @@ -509,7 +509,7 @@ wordlist *w; char *dirup; int i, j, k; - const char *title = title_url.buf(); + const char *title = title_url.c_str(); flags.listing_started = true; printfReplyBody("\n"); printfReplyBody("\n", @@ -528,7 +528,7 @@ if (flags.need_base_href) printfReplyBody("\n", - html_quote(base_href.buf())); + html_quote(base_href.c_str())); printfReplyBody("\n"); @@ -957,7 +957,7 @@ if (flags.dir_slash) { url = xstrdup("./"); } else { - const char *title = title_url.buf(); + const char *title = title_url.c_str(); int k = 6 + strcspn(&title[6], "/"); char *t; url = xstrdup(title + k); @@ -1422,12 +1422,12 @@ FtpStateData::checkUrlpath() { int l; - const char *t; - if ((t = request->urlpath.rpos(';')) != NULL) { - if (strncasecmp(t + 1, "type=", 5) == 0) { - typecode = (char) xtoupper(*(t + 6)); - request->urlpath.cutPointer(t); + size_t t = request->urlpath.rfind(';'); + if (t != string::npos) { + if (strncasecmp(request->urlpath.substr(t+1).c_str(), "type=", 5) == 0) { + typecode = (char) xtoupper(request->urlpath.at(t+6)); + request->urlpath[t] = '\0'; } } @@ -1438,11 +1438,11 @@ flags.isdir = 1; flags.root_dir = 1; flags.need_base_href = 1; /* Work around broken browsers */ - } else if (!request->urlpath.cmp("/%2f/")) { + } else if (request->urlpath != "/%2f/") { /* UNIX root directory */ flags.isdir = 1; flags.root_dir = 1; - } else if ((l >= 1) && (*(request->urlpath.buf() + l - 1) == '/')) { + } else if ((l >= 1) && (*(request->urlpath.c_str() + l - 1) == '/')) { /* Directory URL, ending in / */ flags.isdir = 1; @@ -1530,7 +1530,7 @@ checkUrlpath(); buildTitleUrl(); debugs(9, 5, "ftpStart: host=" << request->host << ", path=" << - request->urlpath.buf() << ", user=" << user << ", passwd=" << + request->urlpath << ", user=" << user << ", passwd=" << password); state = BEGIN; @@ -1930,7 +1930,6 @@ static void ftpSendType(FtpStateData * ftpState) { - const char *t; const char *filename; char mode; /* @@ -1954,8 +1953,8 @@ if (ftpState->flags.isdir) { mode = 'A'; } else { - t = ftpState->request->urlpath.rpos('/'); - filename = t ? t + 1 : ftpState->request->urlpath.buf(); + const size_t t = ftpState->request->urlpath.rfind('/'); + filename = t ? ftpState->request->urlpath.substr(t+1).c_str() : ftpState->request->urlpath.c_str(); mode = mimeGetTransferMode(filename); } @@ -1983,7 +1982,7 @@ debugs(9, 3, "This is ftpReadType"); if (code == 200) { - p = path = xstrdup(ftpState->request->urlpath.buf()); + p = path = xstrdup(ftpState->request->urlpath.c_str()); if (*p == '/') p++; @@ -2204,7 +2203,7 @@ if (ftpState->size == 0) { debugs(9, 2, "ftpReadSize: SIZE reported " << ftpState->ctrl.last_reply << " on " << - ftpState->title_url.buf()); + ftpState->title_url); ftpState->size = -1; } @@ -2906,7 +2905,7 @@ safe_free(ftpState->filepath); /* Build the new path (urlpath begins with /) */ - path = xstrdup(ftpState->request->urlpath.buf()); + path = xstrdup(ftpState->request->urlpath.c_str()); rfc1738_unescape(path); @@ -2957,7 +2956,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.c_str(),"/%2f", 4) != 0) { /* No slash encoded */ switch (ftpState->state) { @@ -3116,9 +3115,9 @@ { const char *mime_type = NULL; const char *mime_enc = NULL; - String urlpath = request->urlpath; + string urlpath = request->urlpath; const char *filename = NULL; - const char *t = NULL; + size_t t = 0; StoreEntry *e = entry; HttpReply *newrep = new HttpReply; @@ -3137,7 +3136,7 @@ e->buffer(); /* released when done processing current data payload */ - filename = (t = urlpath.rpos('/')) ? t + 1 : urlpath.buf(); + filename = (t = urlpath.rfind('/')) != urlpath.size()? urlpath.substr(t+1).c_str() : urlpath.c_str(); if (flags.isdir) { mime_type = "text/html"; @@ -3258,7 +3257,7 @@ request->host, portbuf, "/%2f", - request->urlpath.buf()); + request->urlpath.c_str()); if ((t = strchr(buf, '?'))) *t = '\0'; Index: squid3/src/gopher.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/gopher.cc,v retrieving revision 1.23.4.2 retrieving revision 1.23.4.3 diff -u -r1.23.4.2 -r1.23.4.3 --- squid3/src/gopher.cc 1 May 2007 12:50:27 -0000 1.23.4.2 +++ squid3/src/gopher.cc 1 May 2007 16:09:28 -0000 1.23.4.3 @@ -1,6 +1,6 @@ /* - * $Id: gopher.cc,v 1.23.4.2 2007/05/01 12:50:27 amosjeffries Exp $ + * $Id: gopher.cc,v 1.23.4.3 2007/05/01 16:09:28 amosjeffries Exp $ * * DEBUG: section 10 Gopher * AUTHOR: Harvest Derived @@ -230,7 +230,7 @@ static void gopher_request_parse(const HttpRequest * req, char *type_id, char *request) { - const char *path = req->urlpath.buf(); + const char *path = req->urlpath.c_str(); if (request) request[0] = '\0'; @@ -377,7 +377,7 @@ } inbuf[len] = '\0'; - String outbuf; + string outbuf; if (!gopherState->HTML_header_added) { if (gopherState->conversion == gopher_ds::HTML_CSO_RESULT) @@ -691,12 +691,12 @@ } /* while loop */ if (outbuf.size() > 0) { - entry->append(outbuf.buf(), outbuf.size()); + entry->append(outbuf.c_str(), outbuf.size()); /* now let start sending stuff to client */ entry->flush(); } - outbuf.clean(); + outbuf = ""; return; } Index: squid3/src/http.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/http.cc,v retrieving revision 1.99.2.3 retrieving revision 1.99.2.4 diff -u -r1.99.2.3 -r1.99.2.4 --- squid3/src/http.cc 1 May 2007 12:50:27 -0000 1.99.2.3 +++ squid3/src/http.cc 1 May 2007 16:09:28 -0000 1.99.2.4 @@ -1,6 +1,6 @@ /* - * $Id: http.cc,v 1.99.2.3 2007/05/01 12:50:27 amosjeffries Exp $ + * $Id: http.cc,v 1.99.2.4 2007/05/01 16:09:28 amosjeffries Exp $ * * DEBUG: section 11 Hypertext Transfer Protocol (HTTP) * AUTHOR: Harvest Derived @@ -68,7 +68,7 @@ static PF httpStateFree; static PF httpTimeout; static void httpMaybeRemovePublic(StoreEntry *, http_status); -static void copyOneHeaderFromClientsideRequestToUpstreamRequest(const HttpHeaderEntry *e, String strConnection, HttpRequest * request, HttpRequest * orig_request, +static void copyOneHeaderFromClientsideRequestToUpstreamRequest(const HttpHeaderEntry *e, string strConnection, HttpRequest * request, HttpRequest * orig_request, HttpHeader * hdr_out, int we_do_ranges, http_state_flags); #if ICAP_CLIENT static void icapAclCheckDoneWrapper(ICAPServiceRep::Pointer service, void *data); @@ -92,7 +92,7 @@ const char *url; if (_peer->options.originserver) - url = orig_request->urlpath.buf(); + url = orig_request->urlpath.c_str(); else url = entry->url(); @@ -430,9 +430,8 @@ /* Pragma: no-cache in _replies_ is not documented in HTTP, * but servers like "Active Imaging Webcast/2.0" sure do use it */ if (hdr->has(HDR_PRAGMA)) { - String s = hdr->getList(HDR_PRAGMA); + string s = hdr->getList(HDR_PRAGMA); const int no_cache = strListIsMember(&s, "no-cache", ','); - s.clean(); if (no_cache) { if (!REFRESH_OVERRIDE(ignore_no_cache)) @@ -581,14 +580,14 @@ const char * httpMakeVaryMark(HttpRequest * request, HttpReply const * reply) { - String vary, hdr; + string vary, hdr; const char *pos = NULL; const char *item; const char *value; int ilen; - static String vstr; + static string vstr; - vstr.clean(); + vstr = ""; vary = reply->header.getList(HDR_VARY); while (strListGetItem(&vary, ',', &item, &ilen, &pos)) { @@ -599,14 +598,14 @@ if (strcmp(name, "*") == 0) { /* Can not handle "Vary: *" withtout ETag support */ safe_free(name); - vstr.clean(); + vstr = ""; break; } strListAdd(&vstr, name, ','); hdr = request->header.getByName(name); safe_free(name); - value = hdr.buf(); + value = hdr.c_str(); if (value) { value = rfc1738_escape_part(value); @@ -615,10 +614,10 @@ vstr.append("\"", 1); } - hdr.clean(); + hdr = ""; } - vary.clean(); + vary = ""; #if X_ACCELERATOR_VARY pos = NULL; @@ -631,7 +630,7 @@ strListAdd(&vstr, name, ','); hdr = request->header.getByName(name); safe_free(name); - value = hdr.buf(); + value = hdr.c_str(); if (value) { value = rfc1738_escape_part(value); @@ -640,14 +639,14 @@ vstr.append("\"", 1); } - hdr.clean(); + hdr = ""; } - vary.clean(); + vary = ""; #endif - debugs(11, 3, "httpMakeVaryMark: " << vstr.buf()); - return vstr.buf(); + debugs(11, 3, "httpMakeVaryMark: " << vstr); + return vstr.c_str(); } void @@ -1359,7 +1358,7 @@ LOCAL_ARRAY(char, bbuf, BBUF_SZ); const HttpHeader *hdr_in = &orig_request->header; const HttpHeaderEntry *e; - String strFwd; + string strFwd; HttpHeaderPos pos = HttpHeaderInitPos; assert (hdr_out->owner == hoRequest); /* append our IMS header */ @@ -1369,7 +1368,7 @@ bool we_do_ranges = decideIfWeDoRanges (orig_request); - String strConnection (hdr_in->getList(HDR_CONNECTION)); + string strConnection (hdr_in->getList(HDR_CONNECTION)); while ((e = hdr_in->getEntry(&pos))) copyOneHeaderFromClientsideRequestToUpstreamRequest(e, strConnection, request, orig_request, hdr_out, we_do_ranges, flags); @@ -1388,24 +1387,23 @@ /* append Via */ if (Config.onoff.via) { - String strVia; + string strVia; strVia = hdr_in->getList(HDR_VIA); snprintf(bbuf, BBUF_SZ, "%d.%d %s", orig_request->http_ver.major, orig_request->http_ver.minor, ThisCache); strListAdd(&strVia, bbuf, ','); - hdr_out->putStr(HDR_VIA, strVia.buf()); - strVia.clean(); + hdr_out->putStr(HDR_VIA, strVia.c_str()); } #if ESI { /* Append Surrogate-Capabilities */ - String strSurrogate (hdr_in->getList(HDR_SURROGATE_CAPABILITY)); + string strSurrogate (hdr_in->getList(HDR_SURROGATE_CAPABILITY)); snprintf(bbuf, BBUF_SZ, "%s=\"Surrogate/1.0 ESI/1.0\"", Config.Accel.surrogate_id); strListAdd(&strSurrogate, bbuf, ','); - hdr_out->putStr(HDR_SURROGATE_CAPABILITY, strSurrogate.buf()); + hdr_out->putStr(HDR_SURROGATE_CAPABILITY, strSurrogate.c_str()); } #endif @@ -1417,9 +1415,9 @@ else strListAdd(&strFwd, "unknown", ','); - hdr_out->putStr(HDR_X_FORWARDED_FOR, strFwd.buf()); + hdr_out->putStr(HDR_X_FORWARDED_FOR, strFwd.c_str()); - strFwd.clean(); + strFwd = ""; /* append Host if not there already */ if (!hdr_out->has(HDR_HOST)) { @@ -1453,7 +1451,7 @@ if (orig_request->auth_user_request) username = orig_request->auth_user_request->username(); else if (orig_request->extacl_user.size()) - username = orig_request->extacl_user.buf(); + username = orig_request->extacl_user.c_str(); snprintf(loginbuf, sizeof(loginbuf), "%s%s", username, orig_request->peer_login + 1); @@ -1462,7 +1460,7 @@ } else if (strcmp(orig_request->peer_login, "PASS") == 0) { if (orig_request->extacl_user.size() && orig_request->extacl_passwd.size()) { char loginbuf[256]; - snprintf(loginbuf, sizeof(loginbuf), "%s:%s", orig_request->extacl_user.buf(), orig_request->extacl_passwd.buf()); + snprintf(loginbuf, sizeof(loginbuf), "%s:%s", orig_request->extacl_user.c_str(), orig_request->extacl_passwd.c_str()); httpHeaderPutStrf(hdr_out, HDR_PROXY_AUTHORIZATION, "Basic %s", base64_encode(loginbuf)); } @@ -1489,7 +1487,7 @@ hdr_out->putStr(HDR_AUTHORIZATION, auth); } else if (orig_request->extacl_user.size() && orig_request->extacl_passwd.size()) { char loginbuf[256]; - snprintf(loginbuf, sizeof(loginbuf), "%s:%s", orig_request->extacl_user.buf(), orig_request->extacl_passwd.buf()); + snprintf(loginbuf, sizeof(loginbuf), "%s:%s", orig_request->extacl_user.c_str(), orig_request->extacl_passwd.c_str()); httpHeaderPutStrf(hdr_out, HDR_AUTHORIZATION, "Basic %s", base64_encode(loginbuf)); } @@ -1501,7 +1499,7 @@ if (orig_request->auth_user_request) username = orig_request->auth_user_request->username(); else if (orig_request->extacl_user.size()) - username = orig_request->extacl_user.buf(); + username = orig_request->extacl_user.c_str(); snprintf(loginbuf, sizeof(loginbuf), "%s%s", username, orig_request->peer_login + 1); @@ -1526,7 +1524,7 @@ httpHdrCcSetMaxAge(cc, getMaxAge(url)); if (request->urlpath.size()) - assert(strstr(url, request->urlpath.buf())); + assert(strstr(url, request->urlpath.c_str())); } /* Set no-cache if determined needed but not found */ @@ -1561,16 +1559,16 @@ if (Config2.onoff.mangle_request_headers) httpHdrMangleList(hdr_out, request, ROR_REQUEST); - strConnection.clean(); + strConnection = ""; } void -copyOneHeaderFromClientsideRequestToUpstreamRequest(const HttpHeaderEntry *e, String strConnection, HttpRequest * request, HttpRequest * orig_request, HttpHeader * hdr_out, int we_do_ranges, http_state_flags flags) +copyOneHeaderFromClientsideRequestToUpstreamRequest(const HttpHeaderEntry *e, string strConnection, HttpRequest * request, HttpRequest * orig_request, HttpHeader * hdr_out, int we_do_ranges, http_state_flags flags) { - debugs(11, 5, "httpBuildRequestHeader: " << e->name.buf() << ": " << e->value.buf()); + debugs(11, 5, "httpBuildRequestHeader: " << e->name << ": " << e->value); if (!httpRequestHdrAllowed(e, &strConnection)) { - debugs(11, 2, "'" << e->name.buf() << "' header denied by anonymize_headers configuration"); + debugs(11, 2, "'" << e->name << "' header denied by anonymize_headers configuration"); return; } @@ -1729,7 +1727,7 @@ HttpVersion httpver(1, 0); mb->Printf("%s %s HTTP/%d.%d\r\n", RequestMethodStr[request->method], - request->urlpath.size() ? request->urlpath.buf() : "/", + request->urlpath.size() ? request->urlpath.c_str() : "/", httpver.major,httpver.minor); /* build and pack headers */ { Index: squid3/src/protos.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/protos.h,v retrieving revision 1.80.2.1 retrieving revision 1.80.2.2 diff -u -r1.80.2.1 -r1.80.2.2 --- squid3/src/protos.h 22 Apr 2007 09:56:54 -0000 1.80.2.1 +++ squid3/src/protos.h 1 May 2007 16:09:28 -0000 1.80.2.2 @@ -1,6 +1,6 @@ /* - * $Id: protos.h,v 1.80.2.1 2007/04/22 09:56:54 amosjeffries Exp $ + * $Id: protos.h,v 1.80.2.2 2007/05/01 16:09:28 amosjeffries Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -222,7 +222,7 @@ SQUIDCEXTERN void httpHdrCcInitModule(void); SQUIDCEXTERN void httpHdrCcCleanModule(void); SQUIDCEXTERN HttpHdrCc *httpHdrCcCreate(void); -SQUIDCEXTERN HttpHdrCc *httpHdrCcParseCreate(const String * str); +SQUIDCEXTERN HttpHdrCc *httpHdrCcParseCreate(const string * str); SQUIDCEXTERN void httpHdrCcDestroy(HttpHdrCc * cc); SQUIDCEXTERN HttpHdrCc *httpHdrCcDup(const HttpHdrCc * cc); SQUIDCEXTERN void httpHdrCcPackInto(const HttpHdrCc * cc, Packer * p); @@ -238,10 +238,10 @@ SQUIDCEXTERN http_hdr_type httpHeaderIdByNameDef(const char *name, int name_len); SQUIDCEXTERN const char *httpHeaderNameById(int id); SQUIDCEXTERN int httpHeaderHasConnDir(const HttpHeader * hdr, const char *directive); -SQUIDCEXTERN void strListAdd(String * str, const char *item, char del); -SQUIDCEXTERN int strListIsMember(const String * str, const char *item, char del); -SQUIDCEXTERN int strListIsSubstr(const String * list, const char *s, char del); -SQUIDCEXTERN int strListGetItem(const String * str, char del, const char **item, int *ilen, const char **pos); +SQUIDCEXTERN void strListAdd(string * str, const char *item, char del); +SQUIDCEXTERN int strListIsMember(const string * str, const char *item, char del); +SQUIDCEXTERN int strListIsSubstr(const string * list, const char *s, char del); +SQUIDCEXTERN int strListGetItem(const string * str, char del, const char **item, int *ilen, const char **pos); SQUIDCEXTERN const char *getStringPrefix(const char *str, const char *end); SQUIDCEXTERN int httpHeaderParseInt(const char *start, int *val); SQUIDCEXTERN int httpHeaderParseSize(const char *start, ssize_t * sz); Index: squid3/src/store.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/store.cc,v retrieving revision 1.51.4.2 retrieving revision 1.51.4.3 diff -u -r1.51.4.2 -r1.51.4.3 --- squid3/src/store.cc 1 May 2007 12:50:29 -0000 1.51.4.2 +++ squid3/src/store.cc 1 May 2007 16:09:28 -0000 1.51.4.3 @@ -1,6 +1,6 @@ /* - * $Id: store.cc,v 1.51.4.2 2007/05/01 12:50:29 amosjeffries Exp $ + * $Id: store.cc,v 1.51.4.3 2007/05/01 16:09:28 amosjeffries Exp $ * * DEBUG: section 20 Storage Manager * AUTHOR: Harvest Derived @@ -685,7 +685,7 @@ if (mem_obj->vary_headers && !storeGetPublic(mem_obj->url, mem_obj->method)) { /* Create "vary" base object */ - String vary; + string vary; StoreEntry *pe = storeCreateEntry(mem_obj->url, mem_obj->log_url, request->flags, request->method); HttpVersion version(1, 0); /* We are allowed to do this typecast */ @@ -695,17 +695,17 @@ if (vary.size()) { /* Again, we own this structure layout */ - rep->header.putStr(HDR_VARY, vary.buf()); - vary.clean(); + rep->header.putStr(HDR_VARY, vary.c_str()); + vary = ""; } #if X_ACCELERATOR_VARY vary = mem_obj->getReply()->header.getList(HDR_X_ACCELERATOR_VARY); - if (vary.buf()) { + if (vary.c_str()) { /* Again, we own this structure layout */ - rep->header.putStr(HDR_X_ACCELERATOR_VARY, vary.buf()); - vary.clean(); + rep->header.putStr(HDR_X_ACCELERATOR_VARY, vary.c_str()); + vary = ""; } #endif Index: squid3/src/structs.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/structs.h,v retrieving revision 1.105.2.1 retrieving revision 1.105.2.2 diff -u -r1.105.2.1 -r1.105.2.2 --- squid3/src/structs.h 22 Apr 2007 09:56:56 -0000 1.105.2.1 +++ squid3/src/structs.h 1 May 2007 16:09:28 -0000 1.105.2.2 @@ -1,6 +1,6 @@ /* - * $Id: structs.h,v 1.105.2.1 2007/04/22 09:56:56 amosjeffries Exp $ + * $Id: structs.h,v 1.105.2.2 2007/05/01 16:09:28 amosjeffries Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -837,13 +837,12 @@ MemBuf *mb; }; -#include "SquidString.h" /* http header extention field */ class HttpHdrExtField { - String name; /* field-name from HTTP/1.1 (no column after name) */ - String value; /* field-value from HTTP/1.1 */ + string name; /* field-name from HTTP/1.1 (no column after name) */ + string value; /* field-value from HTTP/1.1 */ }; /* http cache control header field */ @@ -856,7 +855,7 @@ int max_age; int s_maxage; int max_stale; - String other; + string other; }; /* some fields can hold either time or etag specs (e.g. If-Range) */ @@ -892,7 +891,7 @@ HttpHeaderFieldInfo() : id (HDR_ACCEPT), type (ftInvalid){} http_hdr_type id; - String name; + string name; field_type type; HttpHeaderFieldStat stat; }; Index: squid3/src/typedefs.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/typedefs.h,v retrieving revision 1.44 retrieving revision 1.44.8.1 diff -u -r1.44 -r1.44.8.1 --- squid3/src/typedefs.h 21 Aug 2006 01:51:50 -0000 1.44 +++ squid3/src/typedefs.h 1 May 2007 16:09:28 -0000 1.44.8.1 @@ -1,6 +1,6 @@ /* - * $Id: typedefs.h,v 1.44 2006/08/21 01:51:50 squidadm Exp $ + * $Id: typedefs.h,v 1.44.8.1 2007/05/01 16:09:28 amosjeffries Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -36,6 +36,9 @@ #ifndef SQUID_TYPEDEFS_H #define SQUID_TYPEDEFS_H +#include +typedef std::string string; + typedef unsigned int store_status_t; typedef unsigned int ping_status_t; typedef unsigned int swap_status_t; Index: squid3/src/url.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/url.cc,v retrieving revision 1.17.4.1 retrieving revision 1.17.4.2 diff -u -r1.17.4.1 -r1.17.4.2 --- squid3/src/url.cc 1 May 2007 12:50:29 -0000 1.17.4.1 +++ squid3/src/url.cc 1 May 2007 16:09:28 -0000 1.17.4.2 @@ -1,6 +1,6 @@ /* - * $Id: url.cc,v 1.17.4.1 2007/05/01 12:50:29 amosjeffries Exp $ + * $Id: url.cc,v 1.17.4.2 2007/05/01 16:09:28 amosjeffries Exp $ * * DEBUG: section 23 URL Parsing * AUTHOR: Duane Wessels @@ -381,7 +381,7 @@ return request->canonical; if (request->protocol == PROTO_URN) { - snprintf(urlbuf, MAX_URL, "urn:%s", request->urlpath.buf()); + snprintf(urlbuf, MAX_URL, "urn:%s", request->urlpath.c_str()); } else { switch (request->method) { @@ -401,7 +401,7 @@ *request->login ? "@" : null_string, request->host, portbuf, - request->urlpath.buf()); + request->urlpath.c_str()); break; } @@ -419,7 +419,7 @@ char *t; if (request->protocol == PROTO_URN) { - snprintf(buf, MAX_URL, "urn:%s", request->urlpath.buf()); + snprintf(buf, MAX_URL, "urn:%s", request->urlpath.c_str()); } else { switch (request->method) { @@ -449,7 +449,7 @@ loginbuf, request->host, portbuf, - request->urlpath.buf()); + request->urlpath.c_str()); /* * strip arguments AFTER a question-mark */ Index: squid3/src/auth/digest/auth_digest.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/auth/digest/auth_digest.cc,v retrieving revision 1.29.4.1 retrieving revision 1.29.4.2 diff -u -r1.29.4.1 -r1.29.4.2 --- squid3/src/auth/digest/auth_digest.cc 1 May 2007 12:50:31 -0000 1.29.4.1 +++ squid3/src/auth/digest/auth_digest.cc 1 May 2007 16:09:29 -0000 1.29.4.2 @@ -1,6 +1,6 @@ /* - * $Id: auth_digest.cc,v 1.29.4.1 2007/05/01 12:50:31 amosjeffries Exp $ + * $Id: auth_digest.cc,v 1.29.4.2 2007/05/01 16:09:29 amosjeffries Exp $ * * DEBUG: section 29 Authenticator * AUTHOR: Robert Collins @@ -1092,7 +1092,7 @@ while (xisspace(*proxy_auth)) proxy_auth++; - String temp(proxy_auth); + string temp(proxy_auth); while (strListGetItem(&temp, ',', &item, &ilen, &pos)) { if ((p = strchr(item, '=')) && (p - item < ilen)) @@ -1208,7 +1208,7 @@ } } - temp.clean(); + temp = ""; /* now we validate the data given to us */ Index: squid3/src/fs/ufs/store_dir_ufs.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/fs/ufs/store_dir_ufs.cc,v retrieving revision 1.28.4.2 retrieving revision 1.28.4.3 diff -u -r1.28.4.2 -r1.28.4.3 --- squid3/src/fs/ufs/store_dir_ufs.cc 1 May 2007 12:50:32 -0000 1.28.4.2 +++ squid3/src/fs/ufs/store_dir_ufs.cc 1 May 2007 16:09:29 -0000 1.28.4.3 @@ -1,6 +1,6 @@ /* - * $Id: store_dir_ufs.cc,v 1.28.4.2 2007/05/01 12:50:32 amosjeffries Exp $ + * $Id: store_dir_ufs.cc,v 1.28.4.3 2007/05/01 16:09:29 amosjeffries Exp $ * * DEBUG: section 47 Store Directory Routines * AUTHOR: Duane Wessels @@ -1348,7 +1348,7 @@ } StoreSearch * -UFSSwapDir::search(String const url, HttpRequest *request) +UFSSwapDir::search(string const url, HttpRequest *request) { if (url.size()) fatal ("Cannot search by url yet\n"); Index: squid3/src/fs/ufs/ufscommon.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/fs/ufs/ufscommon.h,v retrieving revision 1.9 retrieving revision 1.9.4.1 diff -u -r1.9 -r1.9.4.1 --- squid3/src/fs/ufs/ufscommon.h 14 Sep 2006 01:50:33 -0000 1.9 +++ squid3/src/fs/ufs/ufscommon.h 1 May 2007 16:09:29 -0000 1.9.4.1 @@ -1,6 +1,6 @@ /* - * $Id: ufscommon.h,v 1.9 2006/09/14 01:50:33 squidadm Exp $ + * $Id: ufscommon.h,v 1.9.4.1 2007/05/01 16:09:29 amosjeffries Exp $ * * SQUID Web Proxy Cache http://www.squid-cache.org/ * ---------------------------------------------------------- @@ -63,7 +63,7 @@ virtual void create(); virtual void dump(StoreEntry &) const; ~UFSSwapDir(); - virtual StoreSearch *search(String const url, HttpRequest *); + virtual StoreSearch *search(string const url, HttpRequest *); virtual bool doubleCheck(StoreEntry &); virtual void unlink(StoreEntry &); virtual void statfs(StoreEntry &)const;