1 /* 2 * Copyright (C) 1996-2021 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 #ifndef SQUID_ESIINCLUDE_H 12 #define SQUID_ESIINCLUDE_H 13 14 #include "esi/Context.h" 15 #include "esi/Element.h" 16 #include "esi/Segment.h" 17 18 class ESIInclude; 19 typedef RefCount<ESIInclude> ESIIncludePtr; 20 21 class ESIStreamContext : public RefCountable 22 { 23 CBDATA_CLASS(ESIStreamContext); 24 25 public: 26 typedef RefCount<ESIStreamContext> Pointer; 27 ESIStreamContext(); 28 ~ESIStreamContext(); 29 void freeResources(); 30 int finished; 31 ESIIncludePtr include; 32 ESISegment::Pointer localbuffer; 33 ESISegment::Pointer buffer; 34 }; 35 36 class ESIInclude : public ESIElement 37 { 38 MEMPROXY_CLASS(ESIInclude); 39 40 public: 41 ESIInclude(esiTreeParentPtr, int attributes, const char **attr, ESIContext *); 42 ~ESIInclude(); 43 void render(ESISegment::Pointer); 44 esiProcessResult_t process (int dovars); 45 Pointer makeCacheable() const; 46 Pointer makeUsable(esiTreeParentPtr, ESIVarState &) const; 47 void subRequestDone (ESIStreamContext::Pointer, bool); 48 49 struct { 50 int onerrorcontinue:1; /* on error return zero data */ 51 int failed:1; /* Failed to process completely */ 52 int finished:1; /* Finished getting subrequest data */ 53 } flags; 54 ESIStreamContext::Pointer src; 55 ESIStreamContext::Pointer alt; 56 ESISegment::Pointer srccontent; 57 ESISegment::Pointer altcontent; 58 ESIVarState *varState; 59 char *srcurl, *alturl; 60 void includeFail(ESIStreamContext::Pointer); 61 void finish(); 62 63 private: 64 void Start (ESIStreamContext::Pointer, char const *, ESIVarState *); 65 esiTreeParentPtr parent; 66 void start(); 67 bool started; 68 bool sent; 69 ESIInclude(ESIInclude const &); 70 bool dataNeeded() const; 71 void prepareRequestHeaders(HttpHeader &tempheaders, ESIVarState *vars); 72 }; 73 74 #endif /* SQUID_ESIINCLUDE_H */ 75 76