]> git.ipfire.org Git - thirdparty/squid.git/blob - src/RequestFlags.h
Prep for 3.3.12 and 3.4.4
[thirdparty/squid.git] / src / RequestFlags.h
1 #ifndef SQUID_REQUESTFLAGS_H_
2 #define SQUID_REQUESTFLAGS_H_
3 /*
4 * DEBUG: section 73 HTTP Request
5 * AUTHOR: Duane Wessels
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 */
34
35 /** request-related flags
36 *
37 * The bit-field contains both flags marking a request's current state,
38 * and flags requesting some processing to be done at a later stage.
39 * TODO: better distinguish the two cases.
40 */
41 class RequestFlags
42 {
43 public:
44 RequestFlags() {
45 memset(this,0,sizeof(RequestFlags));
46 }
47
48 /** true if the response to this request may not be READ from cache */
49 bool noCache :1;
50 /** request is if-modified-since */
51 bool ims :1;
52 /** request is authenticated */
53 bool auth :1;
54 /** he response to the request may be stored in the cache */
55 bool cachable :1;
56 /** the request can be forwarded through the hierarchy */
57 bool hierarchical :1;
58 /** a loop was detected on this request */
59 bool loopDetected :1;
60 /** the connection can be kept alive */
61 bool proxyKeepalive :1;
62 /* this should be killed, also in httpstateflags */
63 bool proxying :1;
64 /** content has expired, need to refresh it */
65 bool refresh :1;
66 /** request was redirected by redirectors */
67 bool redirected :1;
68 /** the requested object needs to be validated. See client_side_reply.cc
69 * for further information.
70 */
71 bool needValidation :1;
72 /** whether we should fail if validation fails */
73 bool failOnValidationError :1;
74 /** reply is stale if it is a hit */
75 bool staleIfHit :1;
76 /** request to override no-cache directives
77 *
78 * always use noCacheHack() for reading.
79 * \note only meaningful if USE_HTTP_VIOLATIONS is defined at build time
80 */
81 bool nocacheHack :1;
82 /** this request is accelerated (reverse-proxy) */
83 bool accelerated :1;
84 /** if set, ignore Cache-Control headers */
85 bool ignoreCc :1;
86 /** set for intercepted requests */
87 bool intercepted :1;
88 /** set if the Host: header passed verification */
89 bool hostVerified :1;
90 /// Set for requests handled by a "tproxy" port.
91 bool interceptTproxy :1;
92 /// The client IP address should be spoofed when connecting to the web server.
93 /// This applies to TPROXY traffic that has not had spoofing disabled through
94 /// the spoof_client_ip squid.conf ACL.
95 bool spoofClientIp :1;
96 /** set if the request is internal (\see ClientHttpRequest::flags.internal)*/
97 bool internal :1;
98 /** set for internally-generated requests */
99 //XXX this is set in in clientBeginRequest, but never tested.
100 bool internalClient :1;
101 /** if set, request to try very hard to keep the connection alive */
102 bool mustKeepalive :1;
103 /** set if the rquest wants connection oriented auth */
104 bool connectionAuth :1;
105 /** set if connection oriented auth can not be supported */
106 bool connectionAuthDisabled :1;
107 /** Request wants connection oriented auth */
108 // XXX This is set in clientCheckPinning but never tested
109 bool connectionProxyAuth :1;
110 /** set if the request was sent on a pinned connection */
111 bool pinned :1;
112 /** Authentication was already sent upstream (e.g. due tcp-level auth) */
113 bool authSent :1;
114 /** Deny direct forwarding unless overriden by always_direct
115 * Used in accelerator mode */
116 bool noDirect :1;
117 /** Reply with chunked transfer encoding */
118 bool chunkedReply :1;
119 /** set if stream error has occured */
120 bool streamError :1;
121 /** internal ssl-bump request to get server cert */
122 bool sslPeek :1;
123 /** set if X-Forwarded-For checking is complete
124 *
125 * do not read directly; use doneFollowXff for reading
126 */
127 bool done_follow_x_forwarded_for :1;
128 /** set for ssl-bumped requests */
129 bool sslBumped :1;
130 bool destinationIpLookedUp:1;
131 /** request to reset the TCP stream */
132 bool resetTcp:1;
133 /** set if the request is ranged */
134 bool isRanged :1;
135
136 /** clone the flags, resetting to default those which are not safe in
137 * a related (e.g. ICAP-adapted) request.
138 */
139 RequestFlags cloneAdaptationImmune() const;
140
141 // if FOLLOW_X_FORWARDED_FOR is not set, we always return "done".
142 bool doneFollowXff() const {
143 return done_follow_x_forwarded_for || !FOLLOW_X_FORWARDED_FOR;
144 }
145
146 // if USE_HTTP_VIOLATIONS is not set, never allow this
147 bool noCacheHack() const {
148 return USE_HTTP_VIOLATIONS && nocacheHack;
149 }
150 };
151
152 #endif /* SQUID_REQUESTFLAGS_H_ */