Detected by Coverity. CID
1616162: Performance inefficiencies
(AUTO_CAUSES_COPY). Using the 'auto' keyword without an '&' causes the
copy of an object of type Acl::Answer.
for (const auto &v: values) {
assert(v->aclList);
- const auto ret = ch.fastCheck(v->aclList);
+ const auto &ret = ch.fastCheck(v->aclList);
debugs(93, 5, "Check for header name: " << theKey << ": " << v->value() <<
", HttpRequest: " << request << " HttpReply: " << reply << " matched: " << ret);
if (ret.allowed()) {
if (!Auth::TheConfig.schemeLists.empty() && Auth::TheConfig.schemeAccess) {
ACLFilledChecklist ch(nullptr, request);
ch.updateReply(rep);
- const auto answer = ch.fastCheck(Auth::TheConfig.schemeAccess);
+ const auto &answer = ch.fastCheck(Auth::TheConfig.schemeAccess);
if (answer.allowed())
return Auth::TheConfig.schemeLists.at(answer.kind).authConfigs;
}
ACLFilledChecklist checklist(Config.accessList.on_unsupported_protocol, nullptr);
checklist.requestErrorType = requestError;
fillChecklist(checklist);
- auto answer = checklist.fastCheck();
+ const auto &answer = checklist.fastCheck();
if (answer.allowed() && answer.kind == 1) {
debugs(33, 3, "Request will be tunneled to server");
const auto context = pipeline.front();
/* pools require explicit 'allow' to assign a client into them */
if (pools[pool]->access) {
ch.changeAcl(pools[pool]->access);
- auto answer = ch.fastCheck();
+ const auto &answer = ch.fastCheck();
if (answer.allowed()) {
/* request client information from db after we did all checks
Config.http_upgrade_request_protocols->forApplicable(offeredProto, [&ch, offeredStr, offeredStrLen, &upgradeOut] (const SBuf &cfgProto, const acl_access *guard) {
debugs(11, 5, "checks " << cfgProto << " rule(s)");
ch.changeAcl(guard);
- const auto answer = ch.fastCheck();
+ const auto &answer = ch.fastCheck();
if (answer.implicit)
return false; // keep looking for an explicit rule match
if (answer.allowed())
ACLFilledChecklist chl(pool->access, nullptr);
clientAclChecklistFill(chl, http);
chl.updateReply(rep);
- const auto answer = chl.fastCheck();
+ const auto &answer = chl.fastCheck();
if (answer.allowed()) {
writeQuotaHandler = pool->createBucket();
fd_table[clientConnection->fd].writeQuotaHandler = writeQuotaHandler;