]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/RequestFlags.h
1 #ifndef SQUID_REQUESTFLAGS_H_
2 #define SQUID_REQUESTFLAGS_H_
4 * DEBUG: section 73 HTTP Request
5 * AUTHOR: Duane Wessels
7 * SQUID Web Proxy Cache http://www.squid-cache.org/
8 * ----------------------------------------------------------
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.
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.
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.
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.
38 nocache(0), ims(0), auth(0), cachable(0),
39 hierarchical(0), loopdetect(false), proxy_keepalive(false), proxying_(false),
40 refresh_(false), redirected(false), need_validation(false),
41 fail_on_validation_err(false), stale_if_hit(false), nocache_hack(false), accelerated_(false),
42 ignore_cc(false), intercepted_(false), hostVerified_(false), spoof_client_ip(false),
43 internal(false), internalclient(false), must_keepalive(false), connection_auth_wanted(false), connection_auth_disabled(false), connection_proxy_auth(false), pinned_(false),
44 canRePin_(false), authSent_(false), noDirect_(false), chunkedReply_(false),
45 streamError_(false), sslPeek_(false),
46 doneFollowXForwardedFor(!FOLLOW_X_FORWARDED_FOR
),
47 sslBumped_(false), destinationIPLookedUp_(false), resetTCP_(false),
51 unsigned int nocache
:1; ///< whether the response to this request may be READ from cache
54 unsigned int cachable
:1; ///< whether the response to thie request may be stored in the cache
55 unsigned int hierarchical
:1;
57 // When adding new flags, please update cloneAdaptationImmune() as needed.
58 bool resetTCP() const;
61 void destinationIPLookupCompleted();
62 bool destinationIPLookedUp() const;
63 // returns a partial copy of the flags that includes only those flags
64 // that are safe for a related (e.g., ICAP-adapted) request to inherit
65 RequestFlags
cloneAdaptationImmune() const;
67 bool isRanged() const;
71 bool sslBumped() const { return sslBumped_
; }
72 void setSslBumped(bool newValue
=true) { sslBumped_
=newValue
; }
73 void clearSslBumpeD() { sslBumped_
=false; }
75 bool doneFollowXFF() const { return doneFollowXForwardedFor
; }
76 void setDoneFollowXFF() {
77 doneFollowXForwardedFor
= true;
79 void clearDoneFollowXFF() {
80 /* do not allow clearing if FOLLOW_X_FORWARDED_FOR is unset */
81 doneFollowXForwardedFor
= false || !FOLLOW_X_FORWARDED_FOR
;
84 bool sslPeek() const { return sslPeek_
; }
85 void setSslPeek() { sslPeek_
=true; }
86 void clearSslPeek() { sslPeek_
=false; }
88 bool hadStreamError() const { return streamError_
; }
89 void setStreamError() { streamError_
= true; }
90 void clearStreamError() { streamError_
= false; }
92 bool isReplyChunked() const { return chunkedReply_
; }
93 void markReplyChunked() { chunkedReply_
= true; }
95 void setNoDirect() { noDirect_
=true; }
96 bool noDirect() const{ return noDirect_
; }
98 bool authSent() const { return authSent_
; }
99 void markAuthSent() { authSent_
=true;}
101 bool canRePin() const { return canRePin_
; }
102 void allowRepinning() { canRePin_
=true; }
104 void markPinned() { pinned_
= true; }
105 void clearPinned() { pinned_
= false; }
106 bool pinned() const { return pinned_
; }
108 //XXX: oddly this is set in client_side_request.cc, but never checked.
109 bool wantConnectionProxyAuth() const { return connection_proxy_auth
; }
110 void requestConnectionProxyAuth() { connection_proxy_auth
=true; }
112 void disableConnectionAuth() { connection_auth_disabled
=true; }
113 bool connectionAuthDisabled() const { return connection_auth_disabled
; }
115 void wantConnectionAuth() { connection_auth_wanted
=true; }
116 bool connectionAuthWanted() const { return connection_auth_wanted
; }
118 void setMustKeepalive() { must_keepalive
= true; }
119 bool mustKeepalive() const { return must_keepalive
; }
121 //XXX: oddly this is set in client_side_request.cc but never checked.
122 void setInternalClient() { internalclient
=true;}
124 void markInternal() { internal
=true; }
125 bool isInternal() const { return internal
; }
127 bool spoofClientIp() const { return spoof_client_ip
; }
128 void setSpoofClientIp() { spoof_client_ip
= true; }
130 bool hostVerified() const { return hostVerified_
; }
131 void markHostVerified() { hostVerified_
=true; }
133 bool intercepted() const { return intercepted_
; }
134 void markIntercepted() { intercepted_
=true; }
136 bool ignoringCacheControl() const { return ignore_cc
; }
137 void ignoreCacheControl() { ignore_cc
=true; }
139 bool accelerated() const { return accelerated_
; }
140 void markAccelerated() { accelerated_
= true; }
142 /* nocache_hack is only enabled if USE_HTTP_VIOLATIONS is set at build-time.
143 * Compilers will have an easy time optimizing to a NOP otherwise. */
144 void hackNocache() { if (USE_HTTP_VIOLATIONS
) nocache_hack
=true; }
145 bool noCacheHackEnabled() const { return USE_HTTP_VIOLATIONS
&& nocache_hack
; }
147 void setStaleIfHit() { stale_if_hit
=true; }
148 void clearStaleIfHit() { stale_if_hit
=false; }
149 bool staleIfHit() const { return stale_if_hit
; }
151 void setFailOnValidationError() { fail_on_validation_err
=true; }
152 bool failOnValidationError() const { return fail_on_validation_err
; }
154 bool validationNeeded() const { return need_validation
; }
155 void setNeedValidation() { need_validation
=true; }
157 bool isRedirected() const { return redirected
; }
158 void markRedirected() { redirected
=true; }
160 bool refresh() const { return refresh_
; }
161 void setRefresh() { refresh_
= true; }
163 bool proxying() const { return proxying_
; }
164 void setProxying() { proxying_
= true; }
165 void clearProxying() { proxying_
= false; }
167 bool proxyKeepalive() const { return proxy_keepalive
; }
168 void setProxyKeepalive() { proxy_keepalive
=true;}
169 void clearProxyKeepalive() { proxy_keepalive
=false; }
171 bool loopDetect() const { return loopdetect
; }
172 void setLoopDetect() { loopdetect
= 1; }
175 bool proxy_keepalive
:1;
176 bool proxying_
:1; /* this should be killed, also in httpstateflags */
179 bool need_validation
:1;
180 bool fail_on_validation_err
:1; ///< whether we should fail if validation fails
181 bool stale_if_hit
:1; ///< reply is stale if it is a hit
182 /* for changing/ignoring no-cache requests. Unused unless USE_HTTP_VIOLATIONS */
183 bool nocache_hack
:1;
184 bool accelerated_
:1; ///<request is accelerated
185 bool ignore_cc
:1; ///< ignore Cache-Control
186 bool intercepted_
:1; ///< intercepted request
187 bool hostVerified_
:1; ///< whether the Host: header passed verification
188 bool spoof_client_ip
:1; ///< spoof client ip if possible
190 bool internalclient
:1;
191 bool must_keepalive
:1;
192 bool connection_auth_wanted
:1; /** Request wants connection oriented auth */
193 bool connection_auth_disabled
:1; ///< Connection oriented auth can't be supported
194 bool connection_proxy_auth
:1; ///< Request wants connection oriented auth
195 bool pinned_
:1; ///< Request sent on a pinned connection
196 bool canRePin_
:1; ///< OK to reopen a failed pinned connection
197 bool authSent_
:1; ///< Authentication was forwarded
198 /** Deny direct forwarding unless overriden by always_direct.
199 * Used in accelerator mode */
201 bool chunkedReply_
:1; ///< Reply with chunked transfer encoding
202 bool streamError_
:1; ///< Whether stream error has occured
203 bool sslPeek_
:1; ///< internal ssl-bump request to get server cert
204 /* doneFollowXForwardedFor is set by default to the opposite of
205 * compilation option FOLLOW_X_FORWARDED_FOR (so that it returns
206 * always "done" if the build option is disabled).
208 bool doneFollowXForwardedFor
:1;
209 bool sslBumped_
:1; /**< ssl-bumped request*/
210 bool destinationIPLookedUp_
:1;
211 bool resetTCP_
:1; ///< request to reset the TCP stream
215 #endif /* SQUID_REQUESTFLAGS_H_ */