]> git.ipfire.org Git - thirdparty/squid.git/blob - src/RequestFlags.h
Source Format Enforcement (#1234)
[thirdparty/squid.git] / src / RequestFlags.h
1 /*
2 * Copyright (C) 1996-2023 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 73 HTTP Request */
10
11 #ifndef SQUID_REQUESTFLAGS_H_
12 #define SQUID_REQUESTFLAGS_H_
13
14 #include "base/SupportOrVeto.h"
15
16 /** request-related flags
17 *
18 * Contains both flags marking a request's current state,
19 * and flags requesting some processing to be done at a later stage.
20 * TODO: better distinguish the two cases.
21 */
22 class RequestFlags
23 {
24 public:
25 /** true if the response to this request may not be READ from cache */
26 bool noCache = false;
27 /** request is if-modified-since */
28 bool ims = false;
29 /** request is authenticated */
30 bool auth = false;
31 /** do not use keytabs for peer Kerberos authentication */
32 bool auth_no_keytab = false;
33
34 /// whether the response may be stored in the cache
35 SupportOrVeto cachable;
36
37 /** the request can be forwarded through the hierarchy */
38 bool hierarchical = false;
39 /** a loop was detected on this request */
40 bool loopDetected = false;
41 /** the connection can be kept alive */
42 bool proxyKeepalive = false;
43 /** content has expired, need to refresh it */
44 bool refresh = false;
45 /** request was redirected by redirectors */
46 bool redirected = false;
47 /** the requested object needs to be validated. See client_side_reply.cc
48 * for further information.
49 */
50 bool needValidation = false;
51 /** whether we should fail if validation fails */
52 bool failOnValidationError = false;
53 /** reply is stale if it is a hit */
54 bool staleIfHit = false;
55 /** request to override no-cache directives
56 *
57 * always use noCacheHack() for reading.
58 * \note only meaningful if USE_HTTP_VIOLATIONS is defined at build time
59 */
60 bool nocacheHack = false;
61 /** this request is accelerated (reverse-proxy) */
62 bool accelerated = false;
63 /** if set, ignore Cache-Control headers */
64 bool ignoreCc = false;
65 /** set for intercepted requests */
66 bool intercepted = false;
67 /** set if the Host: header passed verification */
68 bool hostVerified = false;
69 /// Set for requests handled by a "tproxy" port.
70 bool interceptTproxy = false;
71 /// The client IP address should be spoofed when connecting to the web server.
72 /// This applies to TPROXY traffic that has not had spoofing disabled through
73 /// the spoof_client_ip squid.conf ACL.
74 bool spoofClientIp = false;
75 /** set if the request is internal (\see ClientHttpRequest::flags.internal)*/
76 bool internal = false;
77 /** if set, request to try very hard to keep the connection alive */
78 bool mustKeepalive = false;
79 /** set if the request wants connection oriented auth */
80 bool connectionAuth = false;
81 /** set if connection oriented auth can not be supported */
82 bool connectionAuthDisabled = false;
83 // XXX This is set in clientCheckPinning but never tested
84 /** Request wants connection oriented auth */
85 bool connectionProxyAuth = false;
86 /** set if the request was sent on a pinned connection */
87 bool pinned = false;
88 /** Authentication was already sent upstream (e.g. due tcp-level auth) */
89 bool authSent = false;
90 /** Deny direct forwarding unless overridden by always_direct
91 * Used in accelerator mode */
92 bool noDirect = false;
93 /** Reply with chunked transfer encoding */
94 bool chunkedReply = false;
95 /** set if stream error has occurred */
96 bool streamError = false;
97 /** internal ssl-bump request to get server cert */
98 bool sslPeek = false;
99 /** set if X-Forwarded-For checking is complete
100 *
101 * do not read directly; use doneFollowXff for reading
102 */
103 bool done_follow_x_forwarded_for = false;
104 /** set for ssl-bumped requests */
105 bool sslBumped = false;
106 /// carries a representation of an FTP command [received on ftp_port]
107 bool ftpNative = false;
108 bool destinationIpLookedUp = false;
109 /** request to reset the TCP stream */
110 bool resetTcp = false;
111 /** set if the request is ranged */
112 bool isRanged = false;
113
114 /// whether to forward via TunnelStateData (instead of FwdState)
115 bool forceTunnel = false;
116
117 /** clone the flags, resetting to default those which are not safe in
118 * a related (e.g. ICAP-adapted) request.
119 */
120 RequestFlags cloneAdaptationImmune() const;
121
122 // if FOLLOW_X_FORWARDED_FOR is not set, we always return "done".
123 bool doneFollowXff() const {
124 return done_follow_x_forwarded_for || !FOLLOW_X_FORWARDED_FOR;
125 }
126
127 // if USE_HTTP_VIOLATIONS is not set, never allow this
128 bool noCacheHack() const {
129 return USE_HTTP_VIOLATIONS && nocacheHack;
130 }
131
132 /// ban satisfying the request from the cache and ban storing the response
133 /// in the cache
134 /// \param reason summarizes the marking decision context (for debugging)
135 void disableCacheUse(const char *reason);
136 };
137
138 #endif /* SQUID_REQUESTFLAGS_H_ */
139