--------------------- PatchSet 4438 Date: 2007/05/02 00:09:50 Author: amosjeffries Branch: ayjwork Tag: (none) Log: Part 2 of String replacement. Members: src/ACLHTTPHeaderData.cc:1.2.14.1->1.2.14.2 src/ACLHTTPHeaderData.h:1.2->1.2.14.1 src/HttpHdrCc.cc:1.6.12.2->1.6.12.3 src/HttpHdrSc.cc:1.5.8.2->1.5.8.3 src/HttpHeader.cc:1.40.4.3->1.40.4.4 src/HttpRequest.cc:1.37.4.2->1.37.4.3 src/MemObject.cc:1.22.4.1->1.22.4.2 src/StoreHashIndex.h:1.2->1.2.14.1 src/SwapDir.cc:1.7.18.3->1.7.18.4 src/internal.cc:1.15.8.2->1.15.8.3 src/redirect.cc:1.21.8.2->1.21.8.3 src/stat.cc:1.36.2.2->1.36.2.3 src/store_dir.cc:1.20.4.2->1.20.4.3 src/store_log.cc:1.6.2.2->1.6.2.3 src/tools.cc:1.43.2.1->1.43.2.2 src/url.cc:1.17.4.2->1.17.4.3 src/urn.cc:1.25.8.2->1.25.8.3 src/whois.cc:1.17.4.2->1.17.4.3 Index: squid3/src/ACLHTTPHeaderData.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/ACLHTTPHeaderData.cc,v retrieving revision 1.2.14.1 retrieving revision 1.2.14.2 diff -u -r1.2.14.1 -r1.2.14.2 --- squid3/src/ACLHTTPHeaderData.cc 1 May 2007 12:50:22 -0000 1.2.14.1 +++ squid3/src/ACLHTTPHeaderData.cc 2 May 2007 00:09:50 -0000 1.2.14.2 @@ -1,5 +1,5 @@ /* - * $Id: ACLHTTPHeaderData.cc,v 1.2.14.1 2007/05/01 12:50:22 amosjeffries Exp $ + * $Id: ACLHTTPHeaderData.cc,v 1.2.14.2 2007/05/02 00:09:50 amosjeffries Exp $ * * DEBUG: section 28 Access Control * AUTHOR: Duane Wessels @@ -63,11 +63,11 @@ if (hdr == NULL) return false; - debugs(28, 3, "aclHeaderData::match: checking '" << hdrName.buf() << "'"); + debugs(28, 3, "aclHeaderData::match: checking '" << hdrName << "'"); - String value = hdrId != HDR_BAD_HDR ? hdr->getStrOrList(hdrId) : hdr->getByName(hdrName.buf()); + String value = hdrId != HDR_BAD_HDR ? hdr->getStrOrList(hdrId) : hdr->getByName(hdrName.c_str()); - return regex_rule->match(value.buf()); + return regex_rule->match(value.c_str()); } wordlist * @@ -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(); } bool ACLHTTPHeaderData::empty() const { - return (hdrId == HDR_BAD_HDR && !hdrName.buf()) || regex_rule->empty(); + return (hdrId == HDR_BAD_HDR && !hdrName.c_str()) || regex_rule->empty(); } ACLData * Index: squid3/src/ACLHTTPHeaderData.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/ACLHTTPHeaderData.h,v retrieving revision 1.2 retrieving revision 1.2.14.1 diff -u -r1.2 -r1.2.14.1 --- squid3/src/ACLHTTPHeaderData.h 5 Aug 2006 12:51:07 -0000 1.2 +++ squid3/src/ACLHTTPHeaderData.h 2 May 2007 00:09:50 -0000 1.2.14.1 @@ -1,6 +1,6 @@ /* - * $Id: ACLHTTPHeaderData.h,v 1.2 2006/08/05 12:51:07 squidadm Exp $ + * $Id: ACLHTTPHeaderData.h,v 1.2.14.1 2007/05/02 00:09:50 amosjeffries Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -53,7 +53,7 @@ private: http_hdr_type hdrId; // set if header is known - String hdrName; // always set + string hdrName; // always set ACLData * regex_rule; }; Index: squid3/src/HttpHdrCc.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/HttpHdrCc.cc,v retrieving revision 1.6.12.2 retrieving revision 1.6.12.3 diff -u -r1.6.12.2 -r1.6.12.3 --- squid3/src/HttpHdrCc.cc 1 May 2007 16:09:26 -0000 1.6.12.2 +++ squid3/src/HttpHdrCc.cc 2 May 2007 00:09:50 -0000 1.6.12.3 @@ -1,6 +1,6 @@ /* - * $Id: HttpHdrCc.cc,v 1.6.12.2 2007/05/01 16:09:26 amosjeffries Exp $ + * $Id: HttpHdrCc.cc,v 1.6.12.3 2007/05/02 00:09:50 amosjeffries Exp $ * * DEBUG: section 65 HTTP Cache Control Header * AUTHOR: Alex Rousskov @@ -131,8 +131,7 @@ nlen = ilen; /* find type */ - type = (http_hdr_cc_type ) httpHeaderIdByName(item, nlen, - CcFieldsInfo, CC_ENUM_END); + type = (http_hdr_cc_type ) httpHeaderIdByName(item, nlen, CcFieldsInfo, CC_ENUM_END); if (type < 0) { debugs(65, 2, "hdr cc: unknown cache-directive: near '" << item << "' in '" << *str << "'"); Index: squid3/src/HttpHdrSc.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/HttpHdrSc.cc,v retrieving revision 1.5.8.2 retrieving revision 1.5.8.3 diff -u -r1.5.8.2 -r1.5.8.3 --- squid3/src/HttpHdrSc.cc 1 May 2007 16:09:26 -0000 1.5.8.2 +++ squid3/src/HttpHdrSc.cc 2 May 2007 00:09:50 -0000 1.5.8.3 @@ -1,6 +1,6 @@ /* - * $Id: HttpHdrSc.cc,v 1.5.8.2 2007/05/01 16:09:26 amosjeffries Exp $ + * $Id: HttpHdrSc.cc,v 1.5.8.3 2007/05/02 00:09:50 amosjeffries Exp $ * * DEBUG: section 90 HTTP Cache Control Header * AUTHOR: Alex Rousskov @@ -135,8 +135,7 @@ ilen = p++ - item; /* find type */ - type = httpHeaderIdByName(item, ilen, - ScFieldsInfo, SC_ENUM_END); + type = httpHeaderIdByName(item, ilen, ScFieldsInfo, SC_ENUM_END); if (type < 0) { debugs(90, 2, "hdr sc: unknown control-directive: near '" << item << "' in '" << *str << "'"); Index: squid3/src/HttpHeader.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/HttpHeader.cc,v retrieving revision 1.40.4.3 retrieving revision 1.40.4.4 diff -u -r1.40.4.3 -r1.40.4.4 --- squid3/src/HttpHeader.cc 1 May 2007 16:09:26 -0000 1.40.4.3 +++ squid3/src/HttpHeader.cc 2 May 2007 00:09:50 -0000 1.40.4.4 @@ -1,6 +1,6 @@ /* - * $Id: HttpHeader.cc,v 1.40.4.3 2007/05/01 16:09:26 amosjeffries Exp $ + * $Id: HttpHeader.cc,v 1.40.4.4 2007/05/02 00:09:50 amosjeffries Exp $ * * DEBUG: section 55 HTTP Header * AUTHOR: Alex Rousskov @@ -599,7 +599,7 @@ } } - if (e->id == HDR_OTHER && stringHasWhitespace(e->name.c_str())) { + if (e->id == HDR_OTHER && strpbrk(e->name.c_str(), 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) << "}"); Index: squid3/src/HttpRequest.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/HttpRequest.cc,v retrieving revision 1.37.4.2 retrieving revision 1.37.4.3 diff -u -r1.37.4.2 -r1.37.4.3 --- squid3/src/HttpRequest.cc 1 May 2007 12:50:24 -0000 1.37.4.2 +++ squid3/src/HttpRequest.cc 2 May 2007 00:09:50 -0000 1.37.4.3 @@ -1,6 +1,6 @@ /* - * $Id: HttpRequest.cc,v 1.37.4.2 2007/05/01 12:50:24 amosjeffries Exp $ + * $Id: HttpRequest.cc,v 1.37.4.3 2007/05/02 00:09:50 amosjeffries Exp $ * * DEBUG: section 73 HTTP Request * AUTHOR: Duane Wessels @@ -70,7 +70,7 @@ { method = METHOD_NONE; protocol = PROTO_NONE; - urlpath = NULL; + urlpath.clear(); login[0] = '\0'; host[0] = '\0'; auth_user_request = NULL; @@ -115,7 +115,7 @@ safe_free(vary_headers); - urlpath.clean(); + urlpath.clear(); header.clean(); @@ -129,13 +129,13 @@ range = NULL; } - tag.clean(); + tag.clear(); - extacl_user.clean(); + extacl_user.clear(); - extacl_passwd.clean(); + extacl_passwd.clear(); - extacl_log.clean(); + extacl_log.clear(); } void @@ -243,7 +243,7 @@ assert(p); /* pack request-line */ packerPrintf(p, "%s %s HTTP/1.0\r\n", - RequestMethodStr[method], urlpath.buf()); + RequestMethodStr[method], urlpath.c_str()); /* headers */ header.packInto(p); /* trailer */ @@ -275,12 +275,12 @@ * check anonymizer (aka header_access) configuration. */ int -httpRequestHdrAllowed(const HttpHeaderEntry * e, String * strConn) +httpRequestHdrAllowed(const HttpHeaderEntry * e, string * strConn) { assert(e); /* check connection header */ - if (strConn && strListIsMember(strConn, e->name.buf(), ',')) + if (strConn && strListIsMember(strConn, e->name.c_str(), ',')) return 0; return 1; @@ -354,7 +354,7 @@ return urlCanonical((HttpRequest*)this); if (urlpath.size()) - return urlpath.buf(); + return urlpath.c_str(); return "/"; } Index: squid3/src/MemObject.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/MemObject.cc,v retrieving revision 1.22.4.1 retrieving revision 1.22.4.2 diff -u -r1.22.4.1 -r1.22.4.2 --- squid3/src/MemObject.cc 1 May 2007 12:50:24 -0000 1.22.4.1 +++ squid3/src/MemObject.cc 2 May 2007 00:09:50 -0000 1.22.4.2 @@ -1,6 +1,6 @@ /* - * $Id: MemObject.cc,v 1.22.4.1 2007/05/01 12:50:24 amosjeffries Exp $ + * $Id: MemObject.cc,v 1.22.4.2 2007/05/02 00:09:50 amosjeffries Exp $ * * DEBUG: section 19 Store Memory Primitives * AUTHOR: Robert Collins @@ -168,7 +168,7 @@ debugs(20, 1, "MemObject->nclients: " << nclients); debugs(20, 1, "MemObject->reply: " << _reply); debugs(20, 1, "MemObject->request: " << request); - debugs(20, 1, "MemObject->log_url: " << log_url << " " << checkNullString(log_url)); + debugs(20, 1, "MemObject->log_url: " << (log_url ? log_url : "(NULL)") ); } HttpReply const * Index: squid3/src/StoreHashIndex.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/StoreHashIndex.h,v retrieving revision 1.2 retrieving revision 1.2.14.1 diff -u -r1.2 -r1.2.14.1 --- squid3/src/StoreHashIndex.h 4 Jul 2005 02:14:11 -0000 1.2 +++ squid3/src/StoreHashIndex.h 2 May 2007 00:09:51 -0000 1.2.14.1 @@ -1,6 +1,6 @@ /* - * $Id: StoreHashIndex.h,v 1.2 2005/07/04 02:14:11 squidadm Exp $ + * $Id: StoreHashIndex.h,v 1.2.14.1 2007/05/02 00:09:51 amosjeffries Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -57,7 +57,7 @@ (const cache_key *); virtual void get - (String const, STOREGETCLIENT, void * cbdata); + (string const, STOREGETCLIENT, void * cbdata); virtual void init(); @@ -77,7 +77,7 @@ virtual void updateSize(size_t, int); - virtual StoreSearch *search(String const url, HttpRequest *); + virtual StoreSearch *search(string const url, HttpRequest *); private: /* migration logic */ Index: squid3/src/SwapDir.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/SwapDir.cc,v retrieving revision 1.7.18.3 retrieving revision 1.7.18.4 diff -u -r1.7.18.3 -r1.7.18.4 --- squid3/src/SwapDir.cc 1 May 2007 12:50:25 -0000 1.7.18.3 +++ squid3/src/SwapDir.cc 2 May 2007 00:09:51 -0000 1.7.18.4 @@ -1,6 +1,6 @@ /* - * $Id: SwapDir.cc,v 1.7.18.3 2007/05/01 12:50:25 amosjeffries Exp $ + * $Id: SwapDir.cc,v 1.7.18.4 2007/05/02 00:09:51 amosjeffries Exp $ * * DEBUG: section 20 Swap Dir base object * AUTHOR: Robert Collins @@ -276,7 +276,7 @@ void SwapDir::get - (String const key, STOREGETCLIENT callback, void *cbdata) + (string const key, STOREGETCLIENT callback, void *cbdata) { fatal("not implemented"); } Index: squid3/src/internal.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/internal.cc,v retrieving revision 1.15.8.2 retrieving revision 1.15.8.3 diff -u -r1.15.8.2 -r1.15.8.3 --- squid3/src/internal.cc 1 May 2007 12:50:27 -0000 1.15.8.2 +++ squid3/src/internal.cc 2 May 2007 00:09:51 -0000 1.15.8.3 @@ -1,6 +1,6 @@ /* - * $Id: internal.cc,v 1.15.8.2 2007/05/01 12:50:27 amosjeffries Exp $ + * $Id: internal.cc,v 1.15.8.3 2007/05/02 00:09:51 amosjeffries Exp $ * * DEBUG: section 76 Internal Squid Object handling * AUTHOR: Duane, Alex, Henrik @@ -50,7 +50,7 @@ internalStart(HttpRequest * request, StoreEntry * entry) { ErrorState *err; - const char *upath = request->urlpath.buf(); + const char *upath = request->urlpath.c_str(); debugs(76, 3, "internalStart: " << inet_ntoa(request->client_addr) << " requesting '" << upath << "'"); if (0 == strcmp(upath, "/squid-internal-dynamic/netdb")) { Index: squid3/src/redirect.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/redirect.cc,v retrieving revision 1.21.8.2 retrieving revision 1.21.8.3 diff -u -r1.21.8.2 -r1.21.8.3 --- squid3/src/redirect.cc 1 May 2007 12:50:29 -0000 1.21.8.2 +++ squid3/src/redirect.cc 2 May 2007 00:09:51 -0000 1.21.8.3 @@ -1,6 +1,6 @@ /* - * $Id: redirect.cc,v 1.21.8.2 2007/05/01 12:50:29 amosjeffries Exp $ + * $Id: redirect.cc,v 1.21.8.3 2007/05/02 00:09:51 amosjeffries Exp $ * * DEBUG: section 61 Redirector * AUTHOR: Duane Wessels @@ -136,8 +136,8 @@ if (http->request->auth_user_request) r->client_ident = http->request->auth_user_request->username(); - else if (http->request->extacl_user.buf() != NULL) { - r->client_ident = http->request->extacl_user.buf(); + else if (http->request->extacl_user.c_str() != NULL) { + r->client_ident = http->request->extacl_user.c_str(); } if (!r->client_ident && (conn != NULL && conn->rfc931[0])) Index: squid3/src/stat.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/stat.cc,v retrieving revision 1.36.2.2 retrieving revision 1.36.2.3 diff -u -r1.36.2.2 -r1.36.2.3 --- squid3/src/stat.cc 1 May 2007 12:50:29 -0000 1.36.2.2 +++ squid3/src/stat.cc 2 May 2007 00:09:51 -0000 1.36.2.3 @@ -1,5 +1,5 @@ /* - * $Id: stat.cc,v 1.36.2.2 2007/05/01 12:50:29 amosjeffries Exp $ + * $Id: stat.cc,v 1.36.2.3 2007/05/02 00:09:51 amosjeffries Exp $ * * DEBUG: section 18 Cache Manager Statistics * AUTHOR: Harvest Derived @@ -1692,8 +1692,8 @@ if (http->request->auth_user_request) p = http->request->auth_user_request->username(); - else if (http->request->extacl_user.buf() != NULL) { - p = http->request->extacl_user.buf(); + else if (http->request->extacl_user.c_str() != NULL) { + p = http->request->extacl_user.c_str(); } if (!p && (conn != NULL && conn->rfc931[0])) Index: squid3/src/store_dir.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/store_dir.cc,v retrieving revision 1.20.4.2 retrieving revision 1.20.4.3 diff -u -r1.20.4.2 -r1.20.4.3 --- squid3/src/store_dir.cc 1 May 2007 12:50:29 -0000 1.20.4.2 +++ squid3/src/store_dir.cc 2 May 2007 00:09:51 -0000 1.20.4.3 @@ -1,6 +1,6 @@ /* - * $Id: store_dir.cc,v 1.20.4.2 2007/05/01 12:50:29 amosjeffries Exp $ + * $Id: store_dir.cc,v 1.20.4.3 2007/05/02 00:09:51 amosjeffries Exp $ * * DEBUG: section 47 Store Directory Routines * AUTHOR: Duane Wessels @@ -502,7 +502,7 @@ } StoreSearch * -StoreController::search(String const url, HttpRequest *request) +StoreController::search(string const url, HttpRequest *request) { /* cheat, for now you can't search the memory hot cache */ return swapDir->search(url, request); @@ -700,7 +700,7 @@ void StoreController::get - (String const key, STOREGETCLIENT callback, void *cbdata) + (string const key, STOREGETCLIENT callback, void *cbdata) { fatal("not implemented"); } @@ -775,7 +775,7 @@ void StoreHashIndex::get - (String const key, STOREGETCLIENT callback, void *cbdata) + (string const key, STOREGETCLIENT callback, void *cbdata) { fatal("not implemented"); } @@ -891,7 +891,7 @@ } StoreSearch * -StoreHashIndex::search(String const url, HttpRequest *) +StoreHashIndex::search(string const url, HttpRequest *) { if (url.size()) fatal ("Cannot search by url yet\n"); Index: squid3/src/store_log.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/store_log.cc,v retrieving revision 1.6.2.2 retrieving revision 1.6.2.3 diff -u -r1.6.2.2 -r1.6.2.3 --- squid3/src/store_log.cc 1 May 2007 12:50:29 -0000 1.6.2.2 +++ squid3/src/store_log.cc 2 May 2007 00:09:51 -0000 1.6.2.3 @@ -1,6 +1,6 @@ /* - * $Id: store_log.cc,v 1.6.2.2 2007/05/01 12:50:29 amosjeffries Exp $ + * $Id: store_log.cc,v 1.6.2.3 2007/05/02 00:09:51 amosjeffries Exp $ * * DEBUG: section 20 Storage Manager Logging Functions * AUTHOR: Duane Wessels @@ -87,7 +87,7 @@ (int) reply->date, (int) reply->last_modified, (int) reply->expires, - reply->content_type.size() ? reply->content_type.buf() : "unknown", + reply->content_type.size() ? reply->content_type.c_str() : "unknown", reply->content_length, e->contentLen(), RequestMethodStr[mem->method], Index: squid3/src/tools.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/tools.cc,v retrieving revision 1.43.2.1 retrieving revision 1.43.2.2 diff -u -r1.43.2.1 -r1.43.2.2 --- squid3/src/tools.cc 1 May 2007 12:50:29 -0000 1.43.2.1 +++ squid3/src/tools.cc 2 May 2007 00:09:51 -0000 1.43.2.2 @@ -1,6 +1,6 @@ /* - * $Id: tools.cc,v 1.43.2.1 2007/05/01 12:50:29 amosjeffries Exp $ + * $Id: tools.cc,v 1.43.2.2 2007/05/02 00:09:51 amosjeffries Exp $ * * DEBUG: section 21 Misc Functions * AUTHOR: Harvest Derived @@ -1273,6 +1273,90 @@ return 0; /* NOT REACHED */ } +/* + * Similar to strtok, but has some rudimentary knowledge + * of quoting + */ +char * +strwordtok(char *buf, char **t) +{ + unsigned char *word = NULL; + unsigned char *p = (unsigned char *) buf; + unsigned char *d; + unsigned char ch; + int quoted = 0; + + if (!p) + p = (unsigned char *) *t; + + if (!p) + goto error; + + while (*p && xisspace(*p)) + p++; + + if (!*p) + goto error; + + word = d = p; + + while ((ch = *p)) { + switch (ch) { + + case '\\': + p++; + + switch (*p) { + + case 'n': + ch = '\n'; + + break; + + case 'r': + ch = '\r'; + + break; + + default: + ch = *p; + + break; + + } + + *d++ = ch; + + if (ch) + p++; + + break; + + case '"': + quoted = !quoted; + + p++; + + break; + + default: + if (!quoted && xisspace(*p)) { + p++; + goto done; + } + + *d++ = *p++; + break; + } + } + +done: + *d++ = '\0'; + +error: + *t = (char *) p; + return (char *) word; +} /* * Inverse of strwordtok. Quotes a word if needed Index: squid3/src/url.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/url.cc,v retrieving revision 1.17.4.2 retrieving revision 1.17.4.3 diff -u -r1.17.4.2 -r1.17.4.3 --- squid3/src/url.cc 1 May 2007 16:09:28 -0000 1.17.4.2 +++ squid3/src/url.cc 2 May 2007 00:09:51 -0000 1.17.4.3 @@ -1,6 +1,6 @@ /* - * $Id: url.cc,v 1.17.4.2 2007/05/01 16:09:28 amosjeffries Exp $ + * $Id: url.cc,v 1.17.4.3 2007/05/02 00:09:51 amosjeffries Exp $ * * DEBUG: section 23 URL Parsing * AUTHOR: Duane Wessels @@ -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 =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/urn.cc,v retrieving revision 1.25.8.2 retrieving revision 1.25.8.3 diff -u -r1.25.8.2 -r1.25.8.3 --- squid3/src/urn.cc 1 May 2007 12:50:29 -0000 1.25.8.2 +++ squid3/src/urn.cc 2 May 2007 00:09:51 -0000 1.25.8.3 @@ -1,6 +1,6 @@ /* - * $Id: urn.cc,v 1.25.8.2 2007/05/01 12:50:29 amosjeffries Exp $ + * $Id: urn.cc,v 1.25.8.3 2007/05/02 00:09:51 amosjeffries Exp $ * * DEBUG: section 52 URN Parsing * AUTHOR: Kostas Anagnostakis @@ -53,11 +53,11 @@ void *operator new (size_t byteCount); void operator delete (void *address); void start (HttpRequest *, StoreEntry *); - char *getHost (String &urlpath); + char *getHost (string &urlpath); void setUriResFromRequest(HttpRequest *); bool RequestNeedsMenu(HttpRequest *r); void updateRequestURL(HttpRequest *r, char const *newPath); - void createUriResRequest (String &uri); + void createUriResRequest (string &uri); virtual ~UrnState(); @@ -174,17 +174,17 @@ } char * -UrnState::getHost (String &urlpath) +UrnState::getHost (string &urlpath) { char * result; - char const *t; + size_t t; - if ((t = urlpath.pos(':')) != NULL) { - urlpath.set(t, '\0'); - result = xstrdup(urlpath.buf()); - urlpath.set(t, ':'); + if ((t = urlpath.find(':')) != urlpath.size() ) { + urlpath[t] = '\0'; + result = xstrdup(urlpath.c_str()); + urlpath[t] = ':'; } else { - result = xstrdup(urlpath.buf()); + result = xstrdup(urlpath.c_str()); } return result; @@ -193,7 +193,7 @@ bool UrnState::RequestNeedsMenu(HttpRequest *r) { - return strncasecmp(r->urlpath.buf(), "menu.", 5) == 0; + return strncasecmp(r->urlpath.c_str(), "menu.", 5) == 0; } void @@ -205,11 +205,11 @@ } void -UrnState::createUriResRequest (String &uri) +UrnState::createUriResRequest (string &uri) { LOCAL_ARRAY(char, local_urlres, 4096); char *host = getHost (uri); - snprintf(local_urlres, 4096, "http://%s/uri-res/N2L?urn:%s", host, uri.buf()); + snprintf(local_urlres, 4096, "http://%s/uri-res/N2L?urn:%s", host, uri.c_str()); safe_free (host); safe_free (urlres); urlres = xstrdup (local_urlres); @@ -220,7 +220,7 @@ UrnState::setUriResFromRequest(HttpRequest *r) { if (RequestNeedsMenu(r)) { - updateRequestURL(r, r->urlpath.buf() + 5); + updateRequestURL(r, r->urlpath.c_str() + 5); flags.force_menu = 1; } Index: squid3/src/whois.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/whois.cc,v retrieving revision 1.17.4.2 retrieving revision 1.17.4.3 diff -u -r1.17.4.2 -r1.17.4.3 --- squid3/src/whois.cc 1 May 2007 12:50:30 -0000 1.17.4.2 +++ squid3/src/whois.cc 2 May 2007 00:09:52 -0000 1.17.4.3 @@ -1,6 +1,6 @@ /* - * $Id: whois.cc,v 1.17.4.2 2007/05/01 12:50:30 amosjeffries Exp $ + * $Id: whois.cc,v 1.17.4.3 2007/05/02 00:09:52 amosjeffries Exp $ * * DEBUG: section 75 WHOIS protocol * AUTHOR: Duane Wessels, Kostas Anagnostakis @@ -100,7 +100,7 @@ buf = (char *)xmalloc(l); - snprintf(buf, l, "%s\r\n", p->request->urlpath.buf() + 1); + snprintf(buf, l, "%s\r\n", p->request->urlpath.c_str() + 1); comm_write(fd, buf, strlen(buf), whoisWriteComplete, p, NULL); comm_read(fd, p->buf, BUFSIZ, whoisReadReply, p);