Context.cc
Go to the documentation of this file.
1/*
2 * Copyright (C) 1996-2022 The Squid Software Foundation and contributors
3 *
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.
7 */
8
9/* DEBUG: section 86 ESI processing */
10
11#include "squid.h"
12
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.
15 */
16#if (USE_SQUID_ESI == 1)
17
18#include "client_side_request.h"
19#include "esi/Context.h"
20#include "http/Stream.h"
21#include "Store.h"
22
23void
25{
26 assert (http);
28
29 if (hasCachedAST()) {
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.");
33
34 return;
35 }
36
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());
42
45
46 http->storeEntry()->cachedESITree = treeToCache;
47
48 treeToCache = nullptr;
49}
50
51bool
53{
54 assert (http);
56
58 debugs(86, 5, "ESIContext::hasCachedAST: " << this <<
59 " - Cached AST present in store entry " << http->storeEntry() << ".");
60 return true;
61 } else {
62 debugs(86, 5, "ESIContext::hasCachedAST: " << this <<
63 " - Cached AST not present in store entry " << http->storeEntry() << ".");
64 return false;
65 }
66}
67
68void
70{
72 return;
73
75
77
79
81
82 cachedASTInUse = true;
83}
84
85void
86ESIContext::setErrorMessage(char const *anError)
87{
88 if (!errormessage)
89 errormessage = xstrdup(anError);
90}
91
92#endif /* USE_SQUID_ESI == 1 */
93
#define assert(EX)
Definition: assert.h:19
StoreEntry * storeEntry() const
ClientHttpRequest * http
Definition: Context.h:75
ESIVarState * varState
Definition: Context.h:133
void getCachedAST()
Definition: Context.cc:69
void setErrorMessage(char const *)
Definition: Context.cc:86
char * errormessage
Definition: Context.h:96
bool hasCachedAST() const
Definition: Context.cc:52
class ESIContext::ParserState parserState
void updateCachedAST()
Definition: Context.cc:24
ESIElement::Pointer tree
Definition: Context.h:134
bool cachedASTInUse
Definition: Context.h:140
virtual void finish()=0
virtual Pointer makeCacheable() const =0
virtual Pointer makeUsable(esiTreeParentPtr, ESIVarState &) const =0
C * getRaw() const
Definition: RefCount.h:80
ESIElement::Pointer cachedESITree
Definition: Store.h:253
#define debugs(SECTION, LEVEL, CONTENT)
Definition: Stream.h:196
#define xstrdup

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors