]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Verified and converted more String users.
authorFrancesco Chemolli <kinkie@squid-cache.org>
Fri, 30 Jan 2009 14:55:22 +0000 (15:55 +0100)
committerFrancesco Chemolli <kinkie@squid-cache.org>
Fri, 30 Jan 2009 14:55:22 +0000 (15:55 +0100)
src/ACLHTTPHeaderData.cc
src/ACLUrlPath.cc
src/ICAP/ICAPOptXact.cc
src/ICAP/ICAPOptions.cc
src/ICAP/ICAPServiceRep.cc
src/client_side.cc
src/client_side_reply.cc
src/client_side_request.cc
src/tests/testEvent.cc
src/tests/testStoreController.cc
src/tests/testStoreHashIndex.cc

index 3bfd75d12244d662c09a112d6f622d3f296427a4..a73f6dcbd0f8c300efea5e863ebfd85095df71f0 100644 (file)
@@ -63,18 +63,18 @@ ACLHTTPHeaderData::match(HttpHeader* hdr)
     if (hdr == NULL)
         return false;
 
-    debugs(28, 3, "aclHeaderData::match: checking '" << hdrName.unsafeBuf() << "'");
+    debugs(28, 3, "aclHeaderData::match: checking '" << hdrName << "'");
 
-    String value = hdrId != HDR_BAD_HDR ? hdr->getStrOrList(hdrId) : hdr->getByName(hdrName.unsafeBuf());
+    String value = hdrId != HDR_BAD_HDR ? hdr->getStrOrList(hdrId) : hdr->getByName(hdrName.termedBuf());
 
-    return regex_rule->match(value.unsafeBuf());
+    return regex_rule->match(value.termedBuf());
 }
 
 wordlist *
 ACLHTTPHeaderData::dump()
 {
     wordlist *W = NULL;
-    wordlistAdd(&W, hdrName.unsafeBuf());
+    wordlistAdd(&W, hdrName.termedBuf());
     wordlist * regex_dump = regex_rule->dump();
     wordlistAddWl(&W, regex_dump);
     wordlistDestroy(&regex_dump);
@@ -87,14 +87,14 @@ ACLHTTPHeaderData::parse()
     char* t = strtokFile();
     assert (t != NULL);
     hdrName = t;
-    hdrId = httpHeaderIdByNameDef(hdrName.unsafeBuf(), strlen(hdrName.unsafeBuf()));
+    hdrId = httpHeaderIdByNameDef(hdrName.rawBuf(), hdrName.size());
     regex_rule->parse();
 }
 
 bool
 ACLHTTPHeaderData::empty() const
 {
-    return (hdrId == HDR_BAD_HDR && !hdrName.unsafeBuf()) || regex_rule->empty();
+    return (hdrId == HDR_BAD_HDR && hdrName.undefined()) || regex_rule->empty();
 }
 
 ACLData<HttpHeader*> *
index a712d007b21d023781dce27d946511f365bbafbe..02b8ecfd193607f64d1a12dfa3943996188c7263 100644 (file)
@@ -47,7 +47,7 @@ ACLStrategised<char const *> ACLUrlPath::RegistryEntry_(new ACLRegexData, ACLUrl
 int
 ACLUrlPathStrategy::match (ACLData<char const *> * &data, ACLChecklist *checklist)
 {
-    char *esc_buf = xstrdup(checklist->request->urlpath.unsafeBuf());
+    char *esc_buf = xstrdup(checklist->request->urlpath.termedBuf());
     rfc1738_unescape(esc_buf);
     int result = data->match(esc_buf);
     safe_free(esc_buf);
index a462f99792de4239c6453584043854b83e8ec134..d377d5f97b60b99717700f7abea153a96d7437c2 100644 (file)
@@ -43,8 +43,10 @@ void ICAPOptXact::handleCommConnected()
 void ICAPOptXact::makeRequest(MemBuf &buf)
 {
     const Adaptation::Service &s = service();
-    buf.Printf("OPTIONS %s ICAP/1.0\r\n", s.cfg().uri.buf());
-    buf.Printf("Host: %s:%d\r\n", s.cfg().host.buf(), s.cfg().port);
+    const String uri = s.cfg().uri;
+    buf.Printf("OPTIONS %.*s ICAP/1.0\r\n", uri.size(), uri.rawBuf());
+    const String host = s.cfg().host;
+    buf.Printf("Host: %.*s:%d\r\n", host.size(), host.rawBuf(), s.cfg().port);
     buf.append(ICAP::crlf, 2);
 }
 
index 5f30c245ee7fce237be4938dbae682bd23d892dd..4d4ff1029f439aab053c93e9ceef101c07ae6b7f 100644 (file)
@@ -124,8 +124,8 @@ void ICAPOptions::cfgIntHeader(const HttpHeader *h, const char *fname, int &valu
 {
     const String s = h->getByName(fname);
 
-    if (s.size() && xisdigit(*s.unsafeBuf()))
-        value = atoi(s.unsafeBuf());
+    if (s.size() && xisdigit(*s.termedBuf()))
+        value = atoi(s.termedBuf());
     else
         value = -1;
 
@@ -176,8 +176,8 @@ bool ICAPOptions::TransferList::matches(const String &urlPath) const
         if (eLen < urlLen) {
             const int eOff = urlLen - eLen;
             // RFC 3507 examples imply that extensions come without leading '.'
-            if (urlPath.unsafeBuf()[eOff-1] == '.' &&
-                    strcmp(urlPath.unsafeBuf() + eOff, e->key) == 0) {
+            if (urlPath[eOff-1] == '.' &&
+                    strcmp(urlPath.termedBuf() + eOff, e->key) == 0) {
                 debugs(93,7, "ICAPOptions url " << urlPath << " matches " <<
                        name << " extension " << e->key);
                 return true;
index b02276d86e98f3babbf23a412eeae35de0b00814..5bc39d8c2b326f765752534150337f2945282ca7 100644 (file)
@@ -280,7 +280,7 @@ void ICAPServiceRep::checkOptions()
             debugs(93,1, "WARNING: Squid is configured to use ICAP method " <<
                    cfg().methodStr() <<
                    " for service " << cfg().uri.unsafeBuf() <<
-                   " but OPTIONS response declares the methods are " << method_list.unsafeBuf());
+                   " but OPTIONS response declares the methods are " << method_list);
         }
     }
 
index 4b3d870dfd66eb41728ba89a5d0ba28c7671891b..a7a3bc3468f429fe6602d4dbecd4f145ce568eab 100644 (file)
@@ -464,7 +464,7 @@ clientPrepareLogWithRequestDetails(HttpRequest * request, AccessLogEntry * aLogE
     aLogEntry->http.version = request->http_ver;
     aLogEntry->hier = request->hier;
     aLogEntry->cache.requestSize += request->content_length;
-    aLogEntry->cache.extuser = request->extacl_user.unsafeBuf();
+    aLogEntry->cache.extuser = request->extacl_user.termedBuf();
 
     if (request->auth_user_request) {
 
@@ -486,7 +486,7 @@ ClientHttpRequest::logRequest()
 
         if (al.reply) {
             al.http.code = al.reply->sline.status;
-            al.http.content_type = al.reply->content_type.unsafeBuf();
+            al.http.content_type = al.reply->content_type.termedBuf();
         } 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.unsafeBuf();
@@ -852,7 +852,7 @@ ClientSocketContext::sendBody(HttpReply * rep, StoreIOBuffer bodyData)
 static void
 clientPackTermBound(String boundary, MemBuf * mb)
 {
-    mb->Printf("\r\n--%s--\r\n", boundary.unsafeBuf());
+    mb->Printf("\r\n--%.*s--\r\n", boundary.size(), boundary.rawBuf());
     debugs(33, 6, "clientPackTermBound: buf offset: " << mb->size);
 }
 
@@ -866,10 +866,9 @@ clientPackRangeHdr(const HttpReply * rep, const HttpHdrRangeSpec * spec, String
     assert(spec);
 
     /* put boundary */
-    debugs(33, 5, "clientPackRangeHdr: appending boundary: " <<
-           boundary.unsafeBuf());
+    debugs(33, 5, "clientPackRangeHdr: appending boundary: " << boundary);
     /* rfc2046 requires to _prepend_ boundary with <crlf>! */
-    mb->Printf("\r\n--%s\r\n", boundary.unsafeBuf());
+    mb->Printf("\r\n--%.*s\r\n", boundary.size(), boundary.rawBuf());
 
     /* stuff the header with required entries and pack it */
 
@@ -2271,7 +2270,7 @@ clientProcessRequest(ConnStateData *conn, HttpParser *hp, ClientSocketContext *c
         request->flags.spoof_client_ip = conn->port->spoof_client_ip;
     }
 
-    if (internalCheck(request->urlpath.unsafeBuf())) {
+    if (internalCheck(request->urlpath.termedBuf())) {
         if (internalHostnameIs(request->GetHost()) &&
                 request->port == getMyPort()) {
             http->flags.internal = 1;
index 1d8f9b57f4b36ca3d97ab55f2e165cba8407743c..4450b3f88634266561bb21fd1afef35699d8c118 100644 (file)
@@ -1291,7 +1291,7 @@ clientReplyContext::buildReplyHeader()
         int connection_auth_blocked = 0;
         while ((e = hdr->getEntry(&pos))) {
             if (e->id == HDR_WWW_AUTHENTICATE) {
-                const char *value = e->value.unsafeBuf();
+                const char *value = e->value.rawBuf();
 
                 if ((strncasecmp(value, "NTLM", 4) == 0 &&
                         (value[4] == '\0' || value[4] == ' '))
@@ -1391,7 +1391,7 @@ clientReplyContext::buildReplyHeader()
                  ThisCache);
         strListAdd(&strVia, bbuf, ',');
         hdr->delById(HDR_VIA);
-        hdr->putStr(HDR_VIA, strVia.unsafeBuf());
+        hdr->putStr(HDR_VIA, strVia.termedBuf());
     }
     /* Signal keep-alive if needed */
     hdr->putStr(http->flags.accel ? HDR_CONNECTION : HDR_PROXY_CONNECTION,
index 7b5a8556a3dcc84f6c284ab3c2aa9d96bab0a601..fa131a2591ae882364f2f6bf0bec24e1f62561d4 100644 (file)
@@ -851,7 +851,7 @@ clientInterpretRequestHeaders(ClientHttpRequest * http)
             int may_pin = 0;
             while ((e = req_hdr->getEntry(&pos))) {
                 if (e->id == HDR_AUTHORIZATION || e->id == HDR_PROXY_AUTHORIZATION) {
-                    const char *value = e->value.unsafeBuf();
+                    const char *value = e->value.rawBuf();
                     if (strncasecmp(value, "NTLM ", 5) == 0
                             ||
                             strncasecmp(value, "Negotiate ", 10) == 0
index c15b0dc458c36291bf67cf0d66742b9aa3f088df..fa03c48075b31510989bd6aa756ba7b5dc75607d 100644 (file)
@@ -110,7 +110,7 @@ testEvent::testDump()
             printf("%c", anEntry->_appended_text[i] );
         }
         /* make this an int comparison, so that we can see the ASCII code at failure */
-        CPPUNIT_ASSERT_EQUAL( (int)expect.unsafeBuf()[i], (int)anEntry->_appended_text.unsafeBuf()[i] );
+        CPPUNIT_ASSERT_EQUAL( (int)(expect[i]), (int)anEntry->_appended_text[i] );
     }
     printf("\n");
     CPPUNIT_ASSERT_EQUAL( expect, anEntry->_appended_text);
index d9eb41f1065c9167ae937a9778e3b4e82b048b61..8d7c976e309e6619dd57a5b5b3ab0509f94c3cc7 100644 (file)
@@ -111,7 +111,7 @@ addedEntry(StorePointer hashStore,
     EBIT_CLR(e->flags, KEY_PRIVATE);
     e->ping_status = PING_NONE;
     EBIT_CLR(e->flags, ENTRY_VALIDATED);
-    e->hashInsert((const cache_key *)name.unsafeBuf());        /* do it after we clear KEY_PRIVATE */
+    e->hashInsert((const cache_key *)name.termedBuf());        /* do it after we clear KEY_PRIVATE */
     return e;
 }
 
index 9ab7597999d0a0c8a5a81e70927262c8c1b70389..56c97639b5e15f1d9225fb3a260cdf611f9e280e 100644 (file)
@@ -92,7 +92,7 @@ addedEntry(StorePointer hashStore,
     EBIT_CLR(e->flags, KEY_PRIVATE);
     e->ping_status = PING_NONE;
     EBIT_CLR(e->flags, ENTRY_VALIDATED);
-    e->hashInsert((const cache_key *)name.unsafeBuf());        /* do it after we clear KEY_PRIVATE */
+    e->hashInsert((const cache_key *)name.termedBuf());        /* do it after we clear KEY_PRIVATE */
     return e;
 }