ACLExtUser::match(ACLChecklist *checklist)
{
if (checklist->request->extacl_user.size()) {
- return data->match(checklist->request->extacl_user.unsafeBuf());
+ return data->match(checklist->request->extacl_user.termedBuf());
} else {
return -1;
}
{
/* Simulate async calls */
#ifdef _SQUID_WIN32_
- fd = aio_open(path.unsafeBuf(), flags);
+ fd = aio_open(path.termedBuf(), flags);
#else
-
- fd = file_open(path.unsafeBuf() , flags);
+ fd = file_open(path.termedBuf() , flags);
#endif
ioRequestor = callback;
}
size_t openESITags (0);
- char const *currentPos = content.unsafeBuf();
+ //erring on the safe side. Probably rawBuf would be ok too
+ char const *currentPos = content.termedBuf();
size_t remainingCount = content.size();
char const *tag = NULL;
ESICustomParser::errorString() const
{
if (error.size())
- return error.unsafeBuf();
+ return error.termedBuf();
else
return "Parsing error strings not implemented";
}
if (!method_found) {
debugs(93,1, "WARNING: Squid is configured to use ICAP method " <<
cfg().methodStr() <<
- " for service " << cfg().uri.unsafeBuf() <<
+ " for service " << cfg().uri <<
" but OPTIONS response declares the methods are " << method_list);
}
}
// TODO: If skew is negative, the option will be considered down
// because of stale options. We should probably change this.
debugs(93, 1, "ICAP service's clock is skewed by " << skew <<
- " seconds: " << cfg().uri.unsafeBuf());
+ " seconds: " << cfg().uri);
}
}
disableRetries(); // this will also safely drain pconn pool
// TODO: check whether NULL domain is appropriate here
- connection = icapPconnPool->pop(s.cfg().host.unsafeBuf(), s.cfg().port, NULL, client_addr, isRetriable);
+ connection = icapPconnPool->pop(s.cfg().host.termedBuf(), s.cfg().port, NULL, client_addr, isRetriable);
if (connection >= 0) {
debugs(93,3, HERE << "reused pconn FD " << connection);
IpAddress outgoing;
connection = comm_open(SOCK_STREAM, 0, outgoing,
- COMM_NONBLOCKING, s.cfg().uri.unsafeBuf());
+ COMM_NONBLOCKING, s.cfg().uri.termedBuf());
if (connection < 0)
dieOnConnectionFailure(); // throws
- debugs(93,3, typeName << " opens connection to " << s.cfg().host.unsafeBuf() << ":" << s.cfg().port);
+ debugs(93,3, typeName << " opens connection to " << s.cfg().host << ":" << s.cfg().port);
// TODO: service bypass status may differ from that of a transaction
typedef CommCbMemFunT<ICAPXaction, CommTimeoutCbParams> TimeoutDialer;
typedef CommCbMemFunT<ICAPXaction, CommConnectCbParams> ConnectDialer;
connector = asyncCall(93,3, "ICAPXaction::noteCommConnected",
ConnectDialer(this, &ICAPXaction::noteCommConnected));
- commConnectStart(connection, s.cfg().host.unsafeBuf(), s.cfg().port, connector);
+ commConnectStart(connection, s.cfg().host.termedBuf(), s.cfg().port, connector);
}
/*
debugs(93,3, HERE << "pushing pconn" << status());
AsyncCall::Pointer call = NULL;
commSetTimeout(connection, -1, call);
- icapPconnPool->push(connection, theService->cfg().host.unsafeBuf(),
+ icapPconnPool->push(connection, theService->cfg().host.termedBuf(),
theService->cfg().port, NULL, client_addr);
disableRetries();
} else {
{
debugs(93, 2, HERE << typeName << " failed: timeout with " <<
theService->cfg().methodStr() << " " <<
- theService->cfg().uri.unsafeBuf() << status());
+ theService->cfg().uri << status());
reuseConnection = false;
service().noteFailure();
String (String const &);
~String();
+ typedef unsigned int size_type; //storage size intentionally unspecified
+
String &operator =(char const *);
String &operator =(String const &);
bool operator ==(String const &) const;
*/
_SQUID_INLINE_ char operator [](unsigned int pos) const;
- _SQUID_INLINE_ size_t size() const;
+ _SQUID_INLINE_ size_type size() const;
/// variant of size() suited to be used for printf-alikes.
/// throws when size() > MAXINT
_SQUID_INLINE_ int psize() const;
_SQUID_INLINE_ const char * pos(char const ch) const;
///offset from string start of the first occurrence of ch
/// returns std::string::npos if ch is not found
- _SQUID_INLINE_ size_t find(char const ch) const;
+ _SQUID_INLINE_ size_type find(char const ch) const;
_SQUID_INLINE_ const char * rpos(char const ch) const;
- _SQUID_INLINE_ size_t rfind(char const ch) const;
+ _SQUID_INLINE_ size_type rfind(char const ch) const;
_SQUID_INLINE_ int cmp (char const *) const;
- _SQUID_INLINE_ int cmp (char const *, size_t count) const;
+ _SQUID_INLINE_ int cmp (char const *, size_type count) const;
_SQUID_INLINE_ int cmp (String const &) const;
_SQUID_INLINE_ int caseCmp (char const *) const;
- _SQUID_INLINE_ int caseCmp (char const *, size_t count) const;
+ _SQUID_INLINE_ int caseCmp (char const *, size_type count) const;
_SQUID_INLINE_ int caseCmp (String const &) const;
- String substr(size_t from, size_t to) const;
+ String substr(size_type from, size_type to) const;
/** \deprecated Use assignment to [] position instead.
* ie str[newLength] = '\0';
*/
- _SQUID_INLINE_ void cut(size_t newLength);
+ _SQUID_INLINE_ void cut(size_type newLength);
#if DEBUGSTRINGS
private:
void allocAndFill(const char *str, int len);
- void allocBuffer(size_t sz);
- void setBuffer(char *buf, size_t sz);
+ void allocBuffer(size_type sz);
+ void setBuffer(char *buf, size_type sz);
/* never reference these directly! */
- size_t size_; /* buffer size; 64K limit */
+ size_type size_; /* buffer size; 64K limit */
- size_t len_; /* current length */
+ size_type len_; /* current length */
char *buf_;
// low-level buffer allocation,
// does not free old buffer and does not adjust or look at len_
void
-String::allocBuffer(size_t sz)
+String::allocBuffer(String::size_type sz)
{
PROF_start(StringInitBuf);
assert (undefined());
// low-level buffer assignment
// does not free old buffer and does not adjust or look at len_
void
-String::setBuffer(char *aBuf, size_t aSize)
+String::setBuffer(char *aBuf, String::size_type aSize)
{
assert(undefined());
assert(aSize < 65536);
}
String
-String::substr(size_t from, size_t to) const
+String::substr(String::size_type from, String::size_type to) const
{
Must(from >= 0 && from < size());
Must(to > 0 && to <= size());
StringRegistry StringRegistry::Instance_;
-extern size_t memStringCount();
+extern String::size_type memStringCount();
void
StringRegistry::Stat(StoreEntry *entry)
#endif
}
-size_t
+String::size_type
String::size() const
{
return len_;
return strchr(termedBuf(), ch);
}
-size_t
+String::size_type
String::find(char const ch) const
{
const char *c;
return strrchr(termedBuf(), (ch));
}
-size_t
+String::size_type
String::rfind(char const ch) const
{
const char *c;
}
int
-String::cmp (char const *aString, size_t count) const
+String::cmp (char const *aString, String::size_type count) const
{
/* always the same at length 0 */
}
int
-String::caseCmp(char const *aString, size_t count) const
+String::caseCmp(char const *aString, String::size_type count) const
{
return strncasecmp(termedBuf(), aString, count);
}
}
void
-String::cut(size_t newLength)
+String::cut(String::size_type newLength)
{
if (newLength < 0 || newLength > len_) return;
{
typedef Groups::iterator GI;
for (GI i = AllGroups().begin(); i != AllGroups().end(); ++i)
- storeAppendPrintf(entry, "%s %s\n", name, (*i)->id.unsafeBuf());
+ storeAppendPrintf(entry, "%s %.*s\n", name, (*i)->id.psize(), (*i)->id.rawBuf());
}
void
typedef AccessRules::iterator CI;
for (CI i = AllRules().begin(); i != AllRules().end(); ++i) {
- snprintf(nom, 64, "%s %s", name, (*i)->groupId.unsafeBuf());
+ snprintf(nom, 64, "%s %.*s", name, (*i)->groupId.psize(), (*i)->groupId.rawBuf());
dump_acl_access(entry, nom, (*i)->acl);
}
}
/* delete old Content-Type, add ours */
hdr->delById(HDR_CONTENT_TYPE);
httpHeaderPutStrf(hdr, HDR_CONTENT_TYPE,
- "multipart/byteranges; boundary=\"%s\"",
- http->range_iter.boundary.unsafeBuf());
+ "multipart/byteranges; boundary=\"%.*s\"",
+ http->range_iter.boundary.psize(),
+ http->range_iter.boundary.rawBuf());
/* Content-Length is not required in multipart responses
* but it is always nice to have one */
actual_clen = http->mRangeCLen();
external_acl_cache_touch(acl->def, entry);
result = entry->result;
- external_acl_message = entry->message.unsafeBuf();
+ external_acl_message = entry->message.termedBuf();
debugs(82, 2, "aclMatchExternal: " << acl->def->name << " = " << result);
* pass on all other header fields
* which are NOT listed by the special Connection: header. */
- if (strConnection.size()>0 && strListIsMember(&strConnection, e->name.unsafeBuf(), ',')) {
+ if (strConnection.size()>0 && strListIsMember(&strConnection, e->name.termedBuf(), ',')) {
debugs(11, 2, "'" << e->name << "' header cropped by Connection: definition");
return;
}