From: Alex Rousskov Date: Mon, 13 May 2013 23:32:23 +0000 (-0600) Subject: Merged from trunk (r12813). X-Git-Tag: SQUID_3_4_0_1~102^2~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0a003ce5350c51984b085d5ebeeee8a906fd7218;p=thirdparty%2Fsquid.git Merged from trunk (r12813). --- 0a003ce5350c51984b085d5ebeeee8a906fd7218 diff --cc src/ClientDelayConfig.h index f3fa2d4eb0,9acfc140cf..d9e3c69707 --- a/src/ClientDelayConfig.h +++ b/src/ClientDelayConfig.h @@@ -1,9 -1,10 +1,10 @@@ #ifndef SQUID_CLIENTDELAYCONFIG_H #define SQUID_CLIENTDELAYCONFIG_H - #include "Array.h" +#include "acl/forward.h" + #include "base/Vector.h" + class StoreEntry; -class acl_access; class ConfigParser; /// \ingroup DelayPoolsAPI diff --cc src/Notes.h index a595ad03f0,daa576864b..177c74ae97 --- a/src/Notes.h +++ b/src/Notes.h @@@ -1,8 -1,7 +1,8 @@@ #ifndef SQUID_NOTES_H #define SQUID_NOTES_H +#include "acl/forward.h" - #include "Array.h" + #include "base/Vector.h" #include "base/RefCount.h" #include "CbDataList.h" #include "MemPool.h" diff --cc src/acl/Acl.h index 0b233267de,a7dc67f18c..f370563c8f --- a/src/acl/Acl.h +++ b/src/acl/Acl.h @@@ -33,8 -33,7 +33,8 @@@ #ifndef SQUID_ACL_H #define SQUID_ACL_H +#include "acl/forward.h" - #include "Array.h" + #include "base/Vector.h" #include "cbdata.h" #include "defines.h" #include "dlink.h" diff --cc src/cache_cf.cc index ccb64d54d4,6d15433564..28c3859943 --- a/src/cache_cf.cc +++ b/src/cache_cf.cc @@@ -4046,12 -4063,72 +4064,72 @@@ parse_access_log(CustomLog ** logs return; } - if ((logdef_name = strtok(NULL, w_space)) == NULL) - logdef_name = "squid"; + cl->filename = xstrdup(filename); + cl->type = Log::Format::CLF_UNKNOWN; + + const char *token = ConfigParser::strtokFile(); + if (!token) { // style #1 + // no options to deal with + } else if (!strchr(token, '=')) { // style #3 + // if logformat name is not recognized, + // put back the token; it must be an ACL name + if (!setLogformat(cl, token, false)) + ConfigParser::strtokFileUndo(); + } else { // style #4 + do { + if (strncasecmp(token, "on-error=", 9) == 0) { + if (strncasecmp(token+9, "die", 3) == 0) { + cl->fatal = true; + } else if (strncasecmp(token+9, "drop", 4) == 0) { + cl->fatal = false; + } else { + debugs(3, DBG_CRITICAL, "Unknown value for on-error '" << + token << "' expected 'drop' or 'die'"); + self_destruct(); + } + } else if (strncasecmp(token, "buffer-size=", 12) == 0) { + parseBytesOptionValue(&cl->bufferSize, B_BYTES_STR, token+12); + } else if (strncasecmp(token, "logformat=", 10) == 0) { + setLogformat(cl, token+10, true); + } else if (!strchr(token, '=')) { + // put back the token; it must be an ACL name + ConfigParser::strtokFileUndo(); + break; // done with name=value options, now to ACLs + } else { + debugs(3, DBG_CRITICAL, "Unknown access_log option " << token); + self_destruct(); + } + } while ((token = ConfigParser::strtokFile()) != NULL); + } - debugs(3, 9, "Log definition name '" << logdef_name << "' file '" << filename << "'"); + // set format if it has not been specified explicitly + if (cl->type == Log::Format::CLF_UNKNOWN) + setLogformat(cl, "squid", true); - cl->filename = xstrdup(filename); - aclParseAclList(LegacyParser, &cl->aclList); ++ aclParseAclList(LegacyParser, &cl->aclList, cl->filename); + + while (*logs) + logs = &(*logs)->next; + + *logs = cl; + } + + /// sets CustomLog::type and, if needed, CustomLog::lf + /// returns false iff there is no named log format + static bool + setLogformat(CustomLog *cl, const char *logdef_name, const bool dieWhenMissing) + { + assert(cl); + assert(logdef_name); + + debugs(3, 9, "possible " << cl->filename << " logformat: " << logdef_name); + + if (cl->type != Log::Format::CLF_UNKNOWN) { + debugs(3, DBG_CRITICAL, "Second logformat name in one access_log: " << + logdef_name << " " << cl->type << " ? " << Log::Format::CLF_NONE); + self_destruct(); + return false; + } /* look for the definition pointer corresponding to this name */ Format::Format *lf = Log::TheConfig.logformats;