]> git.ipfire.org Git - thirdparty/squid.git/blob - src/RequestFlags.h
Merge from trunk
[thirdparty/squid.git] / src / RequestFlags.h
1 /*
2 * Copyright (C) 1996-2015 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 /** request-related flags
15 *
16 * The bit-field contains both flags marking a request's current state,
17 * and flags requesting some processing to be done at a later stage.
18 * TODO: better distinguish the two cases.
19 */
20 class RequestFlags
21 {
22 public:
23 RequestFlags() {
24 memset(this,0,sizeof(RequestFlags));
25 }
26
27 /** true if the response to this request may not be READ from cache */
28 bool noCache :1;
29 /** request is if-modified-since */
30 bool ims :1;
31 /** request is authenticated */
32 bool auth :1;
33 /** he response to the request may be stored in the cache */
34 bool cachable :1;
35 /** the request can be forwarded through the hierarchy */
36 bool hierarchical :1;
37 /** a loop was detected on this request */
38 bool loopDetected :1;
39 /** the connection can be kept alive */
40 bool proxyKeepalive :1;
41 /* this should be killed, also in httpstateflags */
42 bool proxying :1;
43 /** content has expired, need to refresh it */
44 bool refresh :1;
45 /** request was redirected by redirectors */
46 bool redirected :1;
47 /** the requested object needs to be validated. See client_side_reply.cc
48 * for further information.
49 */
50 bool needValidation :1;
51 /** whether we should fail if validation fails */
52 bool failOnValidationError :1;
53 /** reply is stale if it is a hit */
54 bool staleIfHit :1;
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 :1;
61 /** this request is accelerated (reverse-proxy) */
62 bool accelerated :1;
63 /** if set, ignore Cache-Control headers */
64 bool ignoreCc :1;
65 /** set for intercepted requests */
66 bool intercepted :1;
67 /** set if the Host: header passed verification */
68 bool hostVerified :1;
69 /// Set for requests handled by a "tproxy" port.
70 bool interceptTproxy :1;
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 :1;
75 /** set if the request is internal (\see ClientHttpRequest::flags.internal)*/
76 bool internal :1;
77 /** set for internally-generated requests */
78 //XXX this is set in in clientBeginRequest, but never tested.
79 bool internalClient :1;
80 /** if set, request to try very hard to keep the connection alive */
81 bool mustKeepalive :1;
82 /** set if the rquest wants connection oriented auth */
83 bool connectionAuth :1;
84 /** set if connection oriented auth can not be supported */
85 bool connectionAuthDisabled :1;
86 /** Request wants connection oriented auth */
87 // XXX This is set in clientCheckPinning but never tested
88 bool connectionProxyAuth :1;
89 /** set if the request was sent on a pinned connection */
90 bool pinned :1;
91 /** Authentication was already sent upstream (e.g. due tcp-level auth) */
92 bool authSent :1;
93 /** Deny direct forwarding unless overriden by always_direct
94 * Used in accelerator mode */
95 bool noDirect :1;
96 /** Reply with chunked transfer encoding */
97 bool chunkedReply :1;
98 /** set if stream error has occured */
99 bool streamError :1;
100 /** internal ssl-bump request to get server cert */
101 bool sslPeek :1;
102 /** set if X-Forwarded-For checking is complete
103 *
104 * do not read directly; use doneFollowXff for reading
105 */
106 bool done_follow_x_forwarded_for :1;
107 /** set for ssl-bumped requests */
108 bool sslBumped :1;
109 /// carries a representation of an FTP command [received on ftp_port]
110 bool ftpNative :1;
111 bool destinationIpLookedUp:1;
112 /** request to reset the TCP stream */
113 bool resetTcp:1;
114 /** set if the request is ranged */
115 bool isRanged :1;
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
133 #endif /* SQUID_REQUESTFLAGS_H_ */
134