Detected by Coverity. CID
1554662: Initialization or destruction
ordering is unspecified (GLOBAL_INIT_ORDER).
int Adaptation::Config::send_client_ip = false;
int Adaptation::Config::send_username = false;
int Adaptation::Config::use_indirect_client = true;
-static const char *protectedFieldNamesRaw[] = {
- "Allow",
- "Date",
- "Encapsulated",
- "ISTag",
- "Max-Connections",
- "Methods",
- "Opt-body-type",
- "Options-TTL",
- "Preview",
- "Service",
- "Service-ID",
- "Transfer-Complete",
- "Transfer-Ignore",
- "Transfer-Preview"
-};
-static const Notes::Keys protectedFieldNames(std::begin(protectedFieldNamesRaw), std::end(protectedFieldNamesRaw));
-Notes Adaptation::Config::metaHeaders("ICAP header", &protectedFieldNames);
+
+Notes&
+Adaptation::Config::metaHeaders()
+{
+ static const auto protectedFieldNamesRaw = {
+ "Allow",
+ "Date",
+ "Encapsulated",
+ "ISTag",
+ "Max-Connections",
+ "Methods",
+ "Opt-body-type",
+ "Options-TTL",
+ "Preview",
+ "Service",
+ "Service-ID",
+ "Transfer-Complete",
+ "Transfer-Ignore",
+ "Transfer-Preview"
+ };
+ static const Notes::Keys protectedFieldNames(std::begin(protectedFieldNamesRaw), std::end(protectedFieldNamesRaw));
+ static const auto metaHeaders = new Notes("ICAP header", &protectedFieldNames);
+ return *metaHeaders;
+}
bool Adaptation::Config::needHistory = false;
Adaptation::ServiceConfig*
time_t oldest_service_failure;
int service_revival_delay;
- static Notes metaHeaders; ///< The list of configured meta headers
+ static Notes& metaHeaders(); ///< The list of configured meta headers
static bool needHistory; ///< HttpRequest adaptation history should recorded
makeUsernameHeader(request, buf);
// Adaptation::Config::metaHeaders
- for (auto h: Adaptation::Config::metaHeaders) {
+ for (const auto &h: Adaptation::Config::metaHeaders()) {
HttpRequest *r = virgin.cause ?
virgin.cause : dynamic_cast<HttpRequest*>(virgin.header);
Must(r);
NAME: adaptation_meta
TYPE: note
IFDEF: USE_ADAPTATION
-LOC: Adaptation::Config::metaHeaders
+LOC: Adaptation::Config::metaHeaders()
DEFAULT: none
DOC_START
This option allows Squid administrator to add custom ICAP request
curr_token->type == Format::LFT_ADAPTATION_LAST_HEADER ||
curr_token->type == Format::LFT_ADAPTATION_LAST_HEADER_ELEM ||
curr_token->type == Format::LFT_ADAPTATION_LAST_ALL_HEADERS||
- (curr_token->type == Format::LFT_NOTE && !Adaptation::Config::metaHeaders.empty())) {
+ (curr_token->type == Format::LFT_NOTE && !Adaptation::Config::metaHeaders().empty())) {
Log::TheConfig.hasAdaptToken = true;
}
#if ICAP_CLIENT