2 * Copyright (C) 1996-2015 The Squid Software Foundation and contributors
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.
9 #ifndef SQUID_HTTP_REGISTEREDHEADERS_H
10 #define SQUID_HTTP_REGISTEREDHEADERS_H
12 #include "base/LookupTable.h"
17 /// recognized or "known" header fields; and the RFC which defines them (or not)
18 /// http://www.iana.org/assignments/message-headers/message-headers.xhtml
20 ACCEPT
= 0, /**< RFC 7231 */ /* MUST BE FIRST */
21 ACCEPT_CHARSET
, /**< RFC 7231 */
22 ACCEPT_ENCODING
, /**< RFC 7231 */
23 /*ACCEPT_FEATURES,*/ /* RFC 2295 */
24 ACCEPT_LANGUAGE
, /**< RFC 7231 */
25 ACCEPT_RANGES
, /**< RFC 7233 */
27 ALLOW
, /**< RFC 7231 */
28 ALTERNATE_PROTOCOL
, /**< GFE custom header we may have to erase */
29 AUTHENTICATION_INFO
, /**< RFC 2617 */
30 AUTHORIZATION
, /**< RFC 7235, 4559 */
31 CACHE_CONTROL
, /**< RFC 7234 */
32 CONNECTION
, /**< RFC 7230 */
33 CONTENT_BASE
, /**< obsoleted RFC 2068 */
34 CONTENT_DISPOSITION
, /**< RFC 2183, 6266 */
35 CONTENT_ENCODING
, /**< RFC 7231 */
36 CONTENT_LANGUAGE
, /**< RFC 7231 */
37 CONTENT_LENGTH
, /**< RFC 7230 */
38 CONTENT_LOCATION
, /**< RFC 7231 */
39 CONTENT_MD5
, /**< deprecated, RFC 2616 */
40 CONTENT_RANGE
, /**< RFC 7233 */
41 CONTENT_TYPE
, /**< RFC 7231 */
42 COOKIE
, /**< RFC 6265 header we may need to erase */
43 COOKIE2
, /**< obsolete RFC 2965 header we may need to erase */
44 DATE
, /**< RFC 7231 */
45 /*DAV,*/ /* RFC 2518 */
46 /*DEPTH,*/ /* RFC 2518 */
47 /*DERIVED_FROM,*/ /* deprecated RFC 2068 */
48 /*DESTINATION,*/ /* RFC 2518 */
49 ETAG
, /**< RFC 7232 */
50 EXPECT
, /**< RFC 7231 */
51 EXPIRES
, /**< RFC 7234 */
52 FORWARDED
, /**< RFC 7239 */
53 FROM
, /**< RFC 7231 */
54 HOST
, /**< RFC 7230 */
55 HTTP2_SETTINGS
, /**< RFC 7540 */
56 /*IF,*/ /* RFC 2518 */
57 IF_MATCH
, /**< RFC 7232 */
58 IF_MODIFIED_SINCE
, /**< RFC 7232 */
59 IF_NONE_MATCH
, /**< RFC 7232 */
60 IF_RANGE
, /**< RFC 7233 */
61 IF_UNMODIFIED_SINCE
, /**< RFC 7232 */
62 KEEP_ALIVE
, /**< obsoleted RFC 2068 header we may need to erase */
63 KEY
, /**< experimental RFC Draft draft-fielding-http-key-02 */
64 LAST_MODIFIED
, /**< RFC 7232 */
65 LINK
, /**< RFC 5988 */
66 LOCATION
, /**< RFC 7231 */
67 /*LOCK_TOKEN,*/ /* RFC 2518 */
68 MAX_FORWARDS
, /**< RFC 7231 */
69 MIME_VERSION
, /**< RFC 2045, 7231 */
70 NEGOTIATE
, /**< experimental RFC 2295. Why only this one from 2295? */
71 /*OVERWRITE,*/ /* RFC 2518 */
72 ORIGIN
, /* CORS Draft specification (see http://www.w3.org/TR/cors/) */
73 PRAGMA
, /**< RFC 7234 */
74 PROXY_AUTHENTICATE
, /**< RFC 7235 */
75 PROXY_AUTHENTICATION_INFO
, /**< RFC 2617 */
76 PROXY_AUTHORIZATION
, /**< RFC 7235 */
77 PROXY_CONNECTION
, /**< obsolete Netscape header we may need to erase. */
78 PROXY_SUPPORT
, /**< RFC 4559 */
79 PUBLIC
, /**< RFC 2068 */
80 RANGE
, /**< RFC 7233 */
81 REFERER
, /**< RFC 7231 */
82 REQUEST_RANGE
, /**< some clients use this, sigh */
83 RETRY_AFTER
, /**< RFC 7231 */
84 SERVER
, /**< RFC 7231 */
85 SET_COOKIE
, /**< RFC 6265 header we may need to erase */
86 SET_COOKIE2
, /**< obsoleted RFC 2965 header we may need to erase */
87 /*STATUS_URI,*/ /* RFC 2518 */
88 /*TCN,*/ /* experimental RFC 2295 */
90 /*TIMEOUT,*/ /* RFC 2518 */
91 TITLE
, /* obsolete draft suggested header */
92 TRAILER
, /**< RFC 7230 */
93 TRANSFER_ENCODING
, /**< RFC 7230 */
94 TRANSLATE
, /**< IIS custom header we may need to erase */
95 UNLESS_MODIFIED_SINCE
, /**< IIS custom header we may need to erase */
96 UPGRADE
, /**< RFC 7230 */
97 USER_AGENT
, /**< RFC 7231 */
98 /*VARIANT_VARY,*/ /* experimental RFC 2295 */
99 VARY
, /**< RFC 7231 */
100 VIA
, /**< RFC 7230 */
101 WARNING
, /**< RFC 7234 */
102 WWW_AUTHENTICATE
, /**< RFC 7235, 4559 */
103 X_CACHE
, /**< Squid custom header */
104 X_CACHE_LOOKUP
, /**< Squid custom header. temporary hack that became de-facto. TODO remove */
105 X_FORWARDED_FOR
, /**< obsolete Squid custom header, RFC 7239 */
106 X_REQUEST_URI
, /**< Squid custom header appended if ADD_X_REQUEST_URI is defined */
107 X_SQUID_ERROR
, /**< Squid custom header on generated error responses */
108 #if X_ACCELERATOR_VARY
109 HDR_X_ACCELERATOR_VARY
, /**< obsolete Squid custom header. */
112 X_NEXT_SERVICES
, /**< Squid custom ICAP header */
114 SURROGATE_CAPABILITY
, /**< Edge Side Includes (ESI) header */
115 SURROGATE_CONTROL
, /**< Edge Side Includes (ESI) header */
116 FRONT_END_HTTPS
, /**< MS Exchange custom header we may have to add */
117 FTP_COMMAND
, /**< Internal header for FTP command */
118 FTP_ARGUMENTS
, /**< Internal header for FTP command arguments */
119 FTP_PRE
, /**< Internal header containing leading FTP control response lines */
120 FTP_STATUS
, /**< Internal header for FTP reply status */
121 FTP_REASON
, /**< Internal header for FTP reply reason */
122 OTHER
, /**< internal tag value for "unknown" headers */
123 ENUM_END
, /**< internal tag for end-of-valid headers */
124 BAD_HDR
/**< Invalid header. Must be after ENUM_END */
127 /** possible types for http header fields */
128 enum class HdrFieldType
{
129 ftInvalid
, /**< to catch nasty errors with hdr_id<->fld_type clashes */
142 /* POD for HeaderTable */
143 class HeaderTableRecord
{
147 Http::HdrFieldType type
;
150 /// header ID->namelookup table.
151 extern const HeaderTableRecord HeaderTable
[];
153 /** LookupTable for HTTP Header name -> Http::HdrType lookup.
155 * use as HeaderLookupTable.lookup(header-as-sbuf).
156 * It will return Http::HdrType::HDR_BAD if the header is unknown/not registered,
157 * including the case of Http::HdrType::OTHER, which will have to be handled
160 extern const LookupTable
<Http::HdrType
, HeaderTableRecord
> HeaderLookupTable
;
163 any_HdrType_enum_value (const Http::HdrType id
)
165 return (id
== Http::HdrType::BAD_HDR
|| (id
>= Http::HdrType::ACCEPT
&& id
< Http::HdrType::ENUM_END
));
169 any_valid_header (const Http::HdrType id
)
171 return (id
>= Http::HdrType::ACCEPT
&& id
< Http::HdrType::ENUM_END
);
174 }; /* namespace Http */
177 operator << (std::ostream
&, Http::HdrType
);
179 #endif /* SQUID_HTTP_REGISTEREDHEADERS_H */