void *operator new(size_t);
void operator delete (void *);
static CommonPool *Factory (unsigned char _class, CompositePoolNode::Pointer&);
- char const* theClassTypeLabel() const {return typeLabel.unsafeBuf();}
+ char const* theClassTypeLabel() const {return typeLabel.termedBuf();}
protected:
CommonPool();
DelayTaggedCmp(DelayTaggedBucket::Pointer const &left, DelayTaggedBucket::Pointer const &right)
{
/* for rate limiting, case insensitive */
- return left->tag.caseCmp(right->tag.unsafeBuf());
+ return left->tag.caseCmp(right->tag);
}
void
void
DelayTaggedBucket::stats (StoreEntry *entry) const
{
- storeAppendPrintf(entry, " %s:", tag.unsafeBuf());
+ storeAppendPrintf(entry, " " SQUIDSTRINGPH , SQUIDSTRINGPRINT(tag));
theBucket.stats (entry);
}
fatal("Aiee! out of aiocb slots! - FIXME and wrap file_read\n");
debugs(79, 1, "WARNING: out of aiocb slots!");
/* fall back to blocking method */
- // file_read(fd, request->unsafeBuf, request->len, request->offset, callback, data);
+ // file_read(fd, request->buf, request->len, request->offset, callback, data);
return;
}
fatalf("Aiee! aio_read() returned error (%d) FIXME and wrap file_read !\n", errno);
debugs(79, 1, "WARNING: aio_read() returned error: " << xstrerror());
/* fall back to blocking method */
- // file_read(fd, request->unsafeBuf, request->len, request->offset, callback, data);
+ // file_read(fd, request->buf, request->len, request->offset, callback, data);
}
}
fatal("Aiee! out of aiocb slots FIXME and wrap file_write !\n");
debugs(79, 1, "WARNING: out of aiocb slots!");
/* fall back to blocking method */
- // file_write(fd, offset, unsafeBuf, len, callback, data, freefunc);
+ // file_write(fd, offset, buf, len, callback, data, freefunc);
return;
}
fatalf("Aiee! aio_write() returned error (%d) FIXME and wrap file_write !\n", errno);
debugs(79, 1, "WARNING: aio_write() returned error: " << xstrerror());
/* fall back to blocking method */
- // file_write(fd, offset, unsafeBuf, len, callback, data, freefunc);
+ // file_write(fd, offset, buf, len, callback, data, freefunc);
}
}
*/
return 0;
- if (strstr (sctusable->content.unsafeBuf(), "ESI/1.0"))
+ if (sctusable->content.pos("ESI/1.0") != NULL)
rv = 1;
httpHdrScTargetDestroy (sctusable);
variable = NULL;
if (unevaluatedVariable.size()) {
- varState->feedData(unevaluatedVariable.unsafeBuf(), unevaluatedVariable.size());
+ varState->feedData(unevaluatedVariable.rawBuf(), unevaluatedVariable.size());
char const *result = varState->extractChar ();
/* Consider activating this, when we want to evaluate variables to a
if (!value)
return ESI_PROCESS_COMPLETE;
- varState->addVariable (name.unsafeBuf(), name.size(), value);
+ varState->addVariable (name.rawBuf(), name.size(), value);
value = NULL;
ESIVariableExpression::eval (ESIVarState &state, char const *subref, char const *defaultOnEmpty) const
{
/* XXX: Implement evaluation of the expression */
- ESISegment::ListAppend (state.getOutput(), expression.unsafeBuf(), expression.size());
+ ESISegment::ListAppend (state.getOutput(), expression.rawBuf(), expression.size());
}
#endif /* USE_SQUID_ESI == 1 */
if (TheICAPConfig.send_client_username && request)
makeUsernameHeader(request, buf);
- // fprintf(stderr, "%s\n", unsafeBuf.content());
+ // fprintf(stderr, "%s\n", buf.content());
buf.append(ICAP::crlf, 2); // terminate ICAP header
Must(!preview.ad());
// do not add last-chunk because our Encapsulated header says null-body
- // addLastRequestChunk(unsafeBuf);
+ // addLastRequestChunk(buf);
preview.wrote(0, true);
Must(preview.done());
/*
* See comments in ICAPXaction.h about why we use commBuf
- * here instead of reading directly into readBuf.unsafeBuf.
+ * here instead of reading directly into readBuf.buf.
*/
typedef CommCbMemFunT<ICAPXaction, CommIoCbParams> Dialer;
reader = asyncCall(93,3, "ICAPXaction::noteCommRead",
/*
* See comments in ICAPXaction.h about why we use commBuf
- * here instead of reading directly into readBuf.unsafeBuf.
+ * here instead of reading directly into readBuf.buf.
*/
if (io.size > 0) {
/** todo checks to wrap this include properly */
#include <ostream>
+/* squid string placeholder (for printf) */
+#ifndef SQUIDSTRINGPH
+#define SQUIDSTRINGPH "%.*s"
+#define SQUIDSTRINGPRINT(s) s.psize(),s.rawBuf()
+#endif /* SQUIDSTRINGPH */
+
#define DEBUGSTRINGS 0
#if DEBUGSTRINGS
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();
+ al.http.content_type = loggingEntry()->mem_obj->getReply()->content_type.termedBuf();
}
debugs(33, 9, "clientLogRequest: http.code='" << al.http.code << "'");
}
/**
- * extracts a "range" from *unsafeBuf and appends them to mb, updating
+ * extracts a "range" from *buf and appends them to mb, updating
* all offsets and such.
*/
void
req_sz = HttpParserReqSz(hp);
}
- /* We know the whole request is in hp->unsafeBuf now */
+ /* We know the whole request is in hp->buf now */
assert(req_sz <= (size_t) hp->bufsiz);
}
/**
- * called when new request body data has been buffered in in.unsafeBuf
+ * called when new request body data has been buffered in in.buf
* may close the connection if we were closing and piped everything out
*/
void
}
/*
- * accepts chunk of a http message in unsafeBuf, parses prefix, filters headers and
+ * accepts chunk of a http message in buf, parses prefix, filters headers and
* such, writes processed message to the message recipient
*/
void
const char *asciiaddr;
int l;
struct in_addr addr;
- p = request->x_forwarded_for_iterator.unsafeBuf();
+ p = request->x_forwarded_for_iterator.termedBuf();
l = request->x_forwarded_for_iterator.size();
/*
}
#if FORW_VIA_DB
- fvdbCountVia(s.unsafeBuf());
+ fvdbCountVia(s.termedBuf());
#endif
if (req_hdr->has(HDR_X_FORWARDED_FOR)) {
String s = req_hdr->getList(HDR_X_FORWARDED_FOR);
- fvdbCountForw(s.unsafeBuf());
+ fvdbCountForw(s.termedBuf());
s.clean();
}
Ecap::RequestLineRep::Area
Ecap::RequestLineRep::uri() const
{
- return Area::FromTempBuffer(theMessage.urlpath.unsafeBuf(),
+ return Area::FromTempBuffer(theMessage.urlpath.rawBuf(),
theMessage.urlpath.size());
}
if (NULL != request) {
Packer p;
- str.Printf("%s %s HTTP/%d.%d\n",
+ String urlpath_or_slash;
+
+ if (request->urlpath.size() != 0)
+ urlpath_or_slash = request->urlpath;
+ else
+ urlpath_or_slash = "/";
+
+ str.Printf("%s " SQUIDSTRINGPH " HTTP/%d.%d\n",
RequestMethodStr(request->method),
- request->urlpath.size() ? request->urlpath.unsafeBuf() : "/",
+ SQUIDSTRINGPRINT(urlpath_or_slash),
request->http_ver.major, request->http_ver.minor);
packerToMemInit(&p, &str);
request->header.packInto(&p);
if (NULL != request) {
Packer p;
- mb.Printf("%s %s HTTP/%d.%d\n",
+ String urlpath_or_slash;
+
+ if (request->urlpath.size() != 0)
+ urlpath_or_slash = request->urlpath;
+ else
+ urlpath_or_slash = "/";
+
+ mb.Printf("%s " SQUIDSTRINGPH " HTTP/%d.%d\n",
RequestMethodStr(request->method),
- request->urlpath.size() ? request->urlpath.unsafeBuf() : "/",
+ SQUIDSTRINGPRINT(urlpath_or_slash),
request->http_ver.major, request->http_ver.minor);
packerToMemInit(&p, &mb);
request->header.packInto(&p);
*/
if (!Config.errorDirectory && request && request->header.getList(HDR_ACCEPT_LANGUAGE, &hdr) ) {
- const char *unsafeBuf = hdr.unsafeBuf(); // raw header string for parsing
+ const char *raw_hdr = hdr.termedBuf(); // raw header string for parsing
size_t pos = 0; // current parsing position in header string
char *reset = NULL; // where to reset the p pointer for each new tag file
char *dt = NULL;
* - IFF a tag contains only two characters we can wildcard ANY translations matching: <it> '-'? .*
* with preference given to an exact match.
*/
- while (pos < hdr.size() && unsafeBuf[pos] != ';' && unsafeBuf[pos] != ',' && !xisspace(unsafeBuf[pos]) && dt < (dir+256) ) {
- *dt++ = xtolower(unsafeBuf[pos++]);
+ while (pos < hdr.size() && raw_hdr[pos] != ';' && raw_hdr[pos] != ',' && !xisspace(raw_hdr[pos]) && dt < (dir+256) ) {
+ *dt++ = xtolower(raw_hdr[pos++]);
}
*dt++ = '\0'; // nul-terminated the filename content string before system use.
- debugs(4, 9, HERE << "STATE: dt='" << dt << "', reset='" << reset << "', reset[1]='" << reset[1] << "', pos=" << pos << ", buf='" << &unsafeBuf[pos] << "'");
+ debugs(4, 9, HERE << "STATE: dt='" << dt << "', reset='" << reset << "', reset[1]='" << reset[1] << "', pos=" << pos << ", buf='" << &raw_hdr[pos] << "'");
/* if we found anything we might use, try it. */
if (*reset != '\0') {
dt = reset; // reset for next tag testing. we replace the failed name instead of cloning.
// IFF we terminated the tag on ';' we need to skip the 'q=' bit to the next ',' or end.
- while (pos < hdr.size() && unsafeBuf[pos] != ',') pos++;
- if (unsafeBuf[pos] == ',') pos++;
+ while (pos < hdr.size() && raw_hdr[pos] != ',') pos++;
+ if (raw_hdr[pos] == ',') pos++;
}
}
#endif /* USE_ERR_LOCALES */
do_next_read = 0;
} else if (len == 0) {
/* Connection closed; retrieval done. */
- /* flush the rest of data in temp unsafeBuf if there is one. */
+ /* flush the rest of data in temp buf if there is one. */
if (gopherState->conversion != gopher_ds::NORMAL)
gopherEndHTML(gopherState);
{
eventAdd("peerDigestCheck", peerDigestCheck, pd, (double) delay, 1);
pd->times.next_check = squid_curtime + delay;
- debugs(72, 3, "peerDigestSetCheck: will check peer " << pd->host.unsafeBuf() << " in " << delay << " secs");
+ debugs(72, 3, "peerDigestSetCheck: will check peer " << pd->host << " in " << delay << " secs");
}
/*
peerDigestNotePeerGone(PeerDigest * pd)
{
if (pd->flags.requested) {
- debugs(72, 2, "peerDigest: peer " << pd->host.unsafeBuf() << " gone, will destroy after fetch.");
+ debugs(72, 2, "peerDigest: peer " << pd->host << " gone, will destroy after fetch.");
/* do nothing now, the fetching chain will notice and take action */
} else {
- debugs(72, 2, "peerDigest: peer " << pd->host.unsafeBuf() << " is gone, destroying now.");
+ debugs(72, 2, "peerDigest: peer " << pd->host << " is gone, destroying now.");
peerDigestDestroy(pd);
}
}