/*
- * Copyright (C) 1996-2015 The Squid Software Foundation and contributors
+ * Copyright (C) 1996-2017 The Squid Software Foundation and contributors
*
* Squid software is distributed under GPLv2+ license and includes
* contributions from numerous individuals and organizations.
#include "format/Token.h"
#include "helper.h"
#include "helper/Reply.h"
+#include "http/Stream.h"
#include "HttpHeaderTools.h"
#include "HttpReply.h"
#include "HttpRequest.h"
void
parse_externalAclHelper(external_acl ** list)
{
- external_acl *a = new external_acl;
char *token = ConfigParser::NextToken();
- if (!token)
+ if (!token) {
self_destruct();
+ return;
+ }
+ external_acl *a = new external_acl;
a->name = xstrdup(token);
// Allow supported %macros inside quoted tokens
}
/* There must be at least one format token */
- if (!a->format.format)
+ if (!a->format.format) {
+ delete a;
self_destruct();
+ return;
+ }
// format has implicit %DATA on the end if not used explicitly
if (!data_used) {
*fmt = new Format::Token;
(*fmt)->type = Format::LFT_EXT_ACL_DATA;
- (*fmt)->quote = Format::LOG_QUOTE_URL;
+ (*fmt)->quote = Format::LOG_QUOTE_NONE;
}
/* helper */
- if (!token)
+ if (!token) {
+ delete a;
self_destruct();
+ return;
+ }
wordlistAdd(&a->cmdline, token);
if (node->children.n_max != DEFAULT_EXTERNAL_ACL_CHILDREN)
storeAppendPrintf(sentry, " children-max=%d", node->children.n_max);
- if (node->children.n_startup != 1)
+ if (node->children.n_startup != 0) // sync with helper/ChildConfig.cc default
storeAppendPrintf(sentry, " children-startup=%d", node->children.n_startup);
- if (node->children.n_idle != (node->children.n_max + node->children.n_startup) )
+ if (node->children.n_idle != 1) // sync with helper/ChildConfig.cc default
storeAppendPrintf(sentry, " children-idle=%d", node->children.n_idle);
- if (node->children.concurrency)
+ if (node->children.concurrency != 0)
storeAppendPrintf(sentry, " concurrency=%d", node->children.concurrency);
if (node->cache)
void
ACLExternal::parse()
{
- if (data)
+ if (data) {
self_destruct();
+ return;
+ }
char *token = ConfigParser::strtokFile();
- if (!token)
+ if (!token) {
self_destruct();
+ return;
+ }
data = new external_acl_data(find_externalAclHelper(token));
- if (!data->def)
+ if (!data->def) {
+ delete data;
self_destruct();
+ return;
+ }
// def->name is the name of the external_acl_type.
// this is the name of the 'acl' directive being tested
if (!entry) {
debugs(82, 2, HERE << acl->def->name << "(\"" << key << "\") = lookup needed");
- if (!acl->def->theHelper->queueFull()) {
+ // TODO: All other helpers allow temporary overload. Should not we?
+ if (!acl->def->theHelper->willOverload()) {
debugs(82, 2, HERE << "\"" << key << "\": queueing a call.");
if (!ch->goAsync(ExternalACLLookup::Instance()))
debugs(82, 2, "\"" << key << "\": no async support!");
} else {
if (!staleEntry) {
debugs(82, DBG_IMPORTANT, "WARNING: external ACL '" << acl->def->name <<
- "' queue overload. Request rejected '" << key << "'.");
+ "' queue full. Request rejected '" << key << "'.");
external_acl_message = "SYSTEM TOO BUSY, TRY AGAIN LATER";
return ACCESS_DUNNO;
} else {
debugs(82, DBG_IMPORTANT, "WARNING: external ACL '" << acl->def->name <<
- "' queue overload. Using stale result. '" << key << "'.");
+ "' queue full. Using stale result. '" << key << "'.");
entry = staleEntry;
/* Fall thru to processing below */
}
}
}
- ch->al->lastAclData = xstrdup(sb.c_str());
+ ch->al->lastAclData = sb;
}
#if USE_IDENT