]> git.ipfire.org Git - thirdparty/squid.git/blob - src/http/StateFlags.h
Allow upgrading from HTTP/1.1 to other protocols (#481)
[thirdparty/squid.git] / src / http / StateFlags.h
1 /*
2 * Copyright (C) 1996-2020 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 #ifndef SQUID_SRC_HTTP_STATEFLAGS_H
10 #define SQUID_SRC_HTTP_STATEFLAGS_H
11
12 namespace Http
13 {
14
15 class StateFlags
16 {
17 public:
18 unsigned int front_end_https = 0; ///< send "Front-End-Https: On" header (off/on/auto=2)
19 bool keepalive = false; ///< whether to keep the connection persistent
20 bool only_if_cached = false;
21
22 /// Whether we are processing an HTTP 1xx control message.
23 bool handling1xx = false;
24
25 /// Whether we received an HTTP 101 (Switching Protocols) control message.
26 /// Implies true handling1xx, but the serverSwitchedProtocols state is
27 /// permanent/final while handling of other control messages usually stops.
28 bool serverSwitchedProtocols = false;
29
30 bool headers_parsed = false;
31
32 /// Whether the next TCP hop is a cache_peer, including originserver
33 bool peering = false;
34
35 /// Whether this request is being forwarded inside a CONNECT tunnel
36 /// through a [non-originserver] cache_peer; implies peering and toOrigin
37 bool tunneling = false;
38
39 /// Whether the next HTTP hop is an origin server, including an
40 /// originserver cache_peer. The three possible cases are:
41 /// -# a direct TCP/HTTP connection to an origin server,
42 /// -# a direct TCP/HTTP connection to an originserver cache_peer, and
43 /// -# a CONNECT tunnel through a [non-originserver] cache_peer [to an origin server]
44 /// Thus, toOrigin is false only when the HTTP request is sent over
45 /// a direct TCP/HTTP connection to a non-originserver cache_peer.
46 bool toOrigin = false;
47
48 /// Whether the next TCP/HTTP hop is an originserver cache_peer.
49 bool toOriginPeer() const { return toOrigin && peering && !tunneling; }
50
51 bool keepalive_broken = false;
52 bool abuse_detected = false;
53 bool request_sent = false;
54 bool do_next_read = false;
55 bool chunked = false; ///< reading a chunked response; TODO: rename
56 bool chunked_request = false; ///< writing a chunked request
57 bool sentLastChunk = false; ///< do not try to write last-chunk again
58 };
59
60 } // namespace Http
61
62 #endif /* SQUID_SRC_HTTP_STATEFLAGS_H */
63