From: Francesco Chemolli Date: Sat, 31 Jan 2009 17:04:05 +0000 (+0100) Subject: Verified and converted more String users. X-Git-Tag: SQUID_3_2_0_1~1212^2~10 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e8466ea9541f6c0fd6216d2c3d9ebee7e66ac3a8;p=thirdparty%2Fsquid.git Verified and converted more String users. --- diff --git a/src/HttpHdrCc.cc b/src/HttpHdrCc.cc index c489af347e..6e860a59a3 100644 --- a/src/HttpHdrCc.cc +++ b/src/HttpHdrCc.cc @@ -134,13 +134,13 @@ httpHdrCcParseInit(HttpHdrCc * cc, const String * str) CcFieldsInfo, CC_ENUM_END); if (type < 0) { - debugs(65, 2, "hdr cc: unknown cache-directive: near '" << item << "' in '" << str->unsafeBuf() << "'"); + 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->unsafeBuf() << "'"); + debugs(65, 2, "hdr cc: ignoring duplicate cache-directive: near '" << item << "' in '" << str << "'"); CcFieldsInfo[type].stat.repCount++; @@ -205,7 +205,7 @@ httpHdrCcDestroy(HttpHdrCc * cc) { assert(cc); - if (cc->other.unsafeBuf()) + if (cc->other.defined()) cc->other.clean(); memFree(cc, MEM_HTTP_HDR_CC); @@ -235,7 +235,9 @@ httpHdrCcPackInto(const HttpHdrCc * cc, Packer * p) if (EBIT_TEST(cc->mask, flag) && flag != CC_OTHER) { /* print option name */ - packerPrintf(p, (pcount ? ", %s" : "%s"), CcFieldsInfo[flag].name.unsafeBuf()); + packerPrintf(p, (pcount ? ", %.*s" : "%.*s"), + CcFieldsInfo[flag].name.size(), + CcFieldsInfo[flag].name.rawBuf()); /* handle options with values */ @@ -253,7 +255,8 @@ httpHdrCcPackInto(const HttpHdrCc * cc, Packer * p) } if (cc->other.size()) - packerPrintf(p, (pcount ? ", %s" : "%s"), cc->other.unsafeBuf()); + packerPrintf(p, (pcount ? ", %.*s" : "%.*s"), + cc->other.size(), cc->other.rawBuf()); } /* negative max_age will clean old max_Age setting */ @@ -299,7 +302,7 @@ httpHdrCcStatDumper(StoreEntry * sentry, int idx, double val, double size, int c 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.unsafeBuf() : "INVALID"; + const char *name = valid_id ? CcFieldsInfo[id].name.termedBuf() : "INVALID"; if (count || valid_id) storeAppendPrintf(sentry, "%2d\t %-20s\t %5d\t %6.2f\n", diff --git a/src/http.cc b/src/http.cc index 77259157bf..d2224092f2 100644 --- a/src/http.cc +++ b/src/http.cc @@ -1589,7 +1589,7 @@ HttpStateData::httpBuildRequestHeader(HttpRequest * request, 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.unsafeBuf(); + username = orig_request->extacl_user.termedBuf(); snprintf(loginbuf, sizeof(loginbuf), "%s%s", username, orig_request->peer_login + 1); @@ -1621,7 +1621,7 @@ HttpStateData::httpBuildRequestHeader(HttpRequest * request, httpHdrCcSetMaxAge(cc, getMaxAge(url)); if (request->urlpath.size()) - assert(strstr(url, request->urlpath.unsafeBuf())); + assert(strstr(url, request->urlpath.termedBuf())); } /* Enforce sibling relations */ @@ -1658,10 +1658,10 @@ HttpStateData::httpBuildRequestHeader(HttpRequest * request, void copyOneHeaderFromClientsideRequestToUpstreamRequest(const HttpHeaderEntry *e, String strConnection, HttpRequest * request, HttpRequest * orig_request, HttpHeader * hdr_out, int we_do_ranges, http_state_flags flags) { - debugs(11, 5, "httpBuildRequestHeader: " << e->name.unsafeBuf() << ": " << e->value.unsafeBuf()); + debugs(11, 5, "httpBuildRequestHeader: " << e->name << ": " << e->value ); if (!httpRequestHdrAllowed(e, &strConnection)) { - debugs(11, 2, "'" << e->name.unsafeBuf() << "' header denied by anonymize_headers configuration"); + debugs(11, 2, "'" << e->name << "' header denied by anonymize_headers configuration"); return; } @@ -1822,7 +1822,7 @@ HttpStateData::buildRequestPrefix(HttpRequest * request, HttpVersion httpver(1, 0); mb->Printf("%s %s HTTP/%d.%d\r\n", RequestMethodStr(request->method), - request->urlpath.size() ? request->urlpath.unsafeBuf() : "/", + request->urlpath.size() ? request->urlpath.termedBuf() : "/", httpver.major,httpver.minor); /* build and pack headers */ {