]>
Commit | Line | Data |
---|---|---|
924f73bc | 1 | /* |
2 | * $Id: ESIInclude.h,v 1.1 2003/07/14 14:15:55 robertc Exp $ | |
3 | * | |
4 | * DEBUG: section 86 ESI processing | |
5 | * AUTHOR: Robert Collins | |
6 | * | |
7 | * SQUID Web Proxy Cache http://www.squid-cache.org/ | |
8 | * ---------------------------------------------------------- | |
9 | * | |
10 | * Squid is the result of efforts by numerous individuals from | |
11 | * the Internet community; see the CONTRIBUTORS file for full | |
12 | * details. Many organizations have provided support for Squid's | |
13 | * development; see the SPONSORS file for full details. Squid is | |
14 | * Copyrighted (C) 2001 by the Regents of the University of | |
15 | * California; see the COPYRIGHT file for full details. Squid | |
16 | * incorporates software developed and/or copyrighted by other | |
17 | * sources; see the CREDITS file for full details. | |
18 | * | |
19 | * This program is free software; you can redistribute it and/or modify | |
20 | * it under the terms of the GNU General Public License as published by | |
21 | * the Free Software Foundation; either version 2 of the License, or | |
22 | * (at your option) any later version. | |
23 | * | |
24 | * This program is distributed in the hope that it will be useful, | |
25 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
27 | * GNU General Public License for more details. | |
28 | * | |
29 | * You should have received a copy of the GNU General Public License | |
30 | * along with this program; if not, write to the Free Software | |
31 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA. | |
32 | * | |
33 | * Copyright (c) 2003, Robert Collins <robertc@squid-cache.org> | |
34 | */ | |
35 | ||
36 | #ifndef SQUID_ESIINCLUDE_H | |
37 | #define SQUID_ESIINCLUDE_H | |
38 | ||
39 | #include "squid.h" | |
40 | #include "ESISegment.h" | |
41 | #include "ESIElement.h" | |
42 | #include "ESIContext.h" | |
43 | ||
44 | class ESIInclude; | |
45 | typedef RefCount<ESIInclude> ESIIncludePtr; | |
46 | ||
47 | class ESIStreamContext : public RefCountable | |
48 | { | |
49 | ||
50 | public: | |
51 | typedef RefCount<ESIStreamContext> Pointer; | |
52 | void *operator new(size_t); | |
53 | void operator delete(void *); | |
54 | void deleteSelf() const; | |
55 | ESIStreamContext(); | |
56 | ~ESIStreamContext(); | |
57 | void freeResources(); | |
58 | int finished; | |
59 | ESIIncludePtr include; | |
60 | ESISegment::Pointer localbuffer; | |
61 | ESISegment::Pointer buffer; | |
62 | ||
63 | private: | |
64 | CBDATA_CLASS(ESIStreamContext); | |
65 | }; | |
66 | ||
67 | /* ESIInclude */ | |
68 | ||
69 | class ESIInclude : public ESIElement | |
70 | { | |
71 | ||
72 | public: | |
73 | void *operator new (size_t byteCount); | |
74 | void operator delete (void *address); | |
75 | void deleteSelf() const; | |
76 | ||
77 | ESIInclude(esiTreeParentPtr, int attributes, const char **attr, ESIContext *); | |
78 | ~ESIInclude(); | |
79 | void render(ESISegment::Pointer); | |
80 | esiProcessResult_t process (int dovars); | |
81 | Pointer makeCacheable() const; | |
82 | Pointer makeUsable(esiTreeParentPtr, ESIVarState &) const; | |
83 | void subRequestDone (ESIStreamContext::Pointer, bool); | |
84 | ||
85 | struct | |
86 | { | |
87 | ||
88 | int onerrorcontinue: | |
89 | 1; /* on error return zero data */ | |
90 | ||
91 | int failed: | |
92 | 1; /* Failed to process completely */ | |
93 | ||
94 | int finished: | |
95 | 1; /* Finished getting subrequest data */ | |
96 | } | |
97 | ||
98 | flags; | |
99 | ESIStreamContext::Pointer src; | |
100 | ESIStreamContext::Pointer alt; | |
101 | ESISegment::Pointer srccontent; | |
102 | ESISegment::Pointer altcontent; | |
103 | ESIVarState *varState; | |
104 | char *srcurl, *alturl; | |
105 | void fail(ESIStreamContext::Pointer); | |
106 | void finish(); | |
107 | ||
108 | private: | |
109 | static MemPool *Pool; | |
110 | void Start (ESIStreamContext::Pointer, char const *, ESIVarState *); | |
111 | esiTreeParentPtr parent; | |
112 | void start(); | |
113 | bool started; | |
114 | bool sent; | |
115 | ESIInclude(ESIInclude const &); | |
116 | bool dataNeeded() const; | |
117 | void prepareRequestHeaders(HttpHeader &tempheaders, ESIVarState *vars); | |
118 | }; | |
119 | ||
120 | #endif /* SQUID_ESIINCLUDE_H */ |