]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/esi/Parser.cc
2 * Copyright (C) 1996-2021 The Squid Software Foundation and contributors
4 * Squid software is distributed under GPLv2+ license and includes
5 * contributions from numerous individuals and organizations.
6 * Please see the COPYING and CONTRIBUTORS files for details.
9 /* DEBUG: section 86 ESI processing */
12 #include "esi/Parser.h"
15 char *ESIParser::Type
= NULL
;
16 ESIParser::Register
*ESIParser::Parser
= NULL
;
18 std::list
<ESIParser::Register
*> &
19 ESIParser::GetRegistry()
21 static std::list
<ESIParser::Register
*> parsers
;
26 ESIParser::NewParser(ESIParserClient
*aClient
)
29 Parser
= GetRegistry().front();
31 // if type name matters, use it
32 if (strcasecmp(Type
, "auto") != 0) {
33 for (auto *p
: GetRegistry()) {
34 if (p
&& strcasecmp(p
->name
, Type
) != 0)
40 fatal ("Unknown ESI Parser type");
43 return (Parser
->newParser
)(aClient
);
46 ESIParser::Register::Register(const char *_name
, ESIParser::Pointer (*_newParser
)(ESIParserClient
*aClient
)) : name(_name
), newParser(_newParser
)
48 ESIParser::GetRegistry().emplace_back(this);
51 ESIParser::Register::~Register()
53 ESIParser::GetRegistry().remove(this);