]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/esi/Context.cc
2 * Copyright (C) 1996-2020 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 */
13 /* MS Visual Studio Projects are monolithic, so we need the following
14 * #if to exclude the ESI code from compile process when not needed.
16 #if (USE_SQUID_ESI == 1)
18 #include "client_side_request.h"
19 #include "esi/Context.h"
20 #include "http/Stream.h"
24 ESIContext::updateCachedAST()
27 assert (http
->storeEntry());
30 debugs(86, 5, "ESIContext::updateCachedAST: not updating AST cache for entry " <<
31 http
->storeEntry() << " from ESI Context " << this <<
32 " as there is already a cached AST.");
37 ESIElement::Pointer treeToCache
= tree
->makeCacheable();
38 debugs(86, 5, "ESIContext::updateCachedAST: Updating AST cache for entry " <<
39 http
->storeEntry() << " with current value " <<
40 http
->storeEntry()->cachedESITree
.getRaw() << " to new value " <<
41 treeToCache
.getRaw());
43 if (http
->storeEntry()->cachedESITree
.getRaw())
44 http
->storeEntry()->cachedESITree
->finish();
46 http
->storeEntry()->cachedESITree
= treeToCache
;
52 ESIContext::hasCachedAST() const
55 assert (http
->storeEntry());
57 if (http
->storeEntry()->cachedESITree
.getRaw()) {
58 debugs(86, 5, "ESIContext::hasCachedAST: " << this <<
59 " - Cached AST present in store entry " << http
->storeEntry() << ".");
62 debugs(86, 5, "ESIContext::hasCachedAST: " << this <<
63 " - Cached AST not present in store entry " << http
->storeEntry() << ".");
69 ESIContext::getCachedAST()
74 assert (hasCachedAST());
80 tree
= http
->storeEntry()->cachedESITree
->makeUsable (this, *varState
);
82 cachedASTInUse
= true;
86 ESIContext::setErrorMessage(char const *anError
)
89 errormessage
= xstrdup(anError
);
92 #endif /* USE_SQUID_ESI == 1 */