]>
Commit | Line | Data |
---|---|---|
eac61ce1 | 1 | /* |
bde978a6 | 2 | * Copyright (C) 1996-2015 The Squid Software Foundation and contributors |
eac61ce1 AJ |
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 | ||
1139d406 AJ |
9 | #ifndef SQUID_HTTP_REGISTEREDHEADERS_H |
10 | #define SQUID_HTTP_REGISTEREDHEADERS_H | |
11 | ||
d1ea2a11 | 12 | #include "base/LookupTable.h" |
789217a2 | 13 | #include <iosfwd> |
d1ea2a11 | 14 | |
789217a2 FC |
15 | namespace Http |
16 | { | |
1139d406 | 17 | /// recognized or "known" header fields; and the RFC which defines them (or not) |
17437edf | 18 | /// http://www.iana.org/assignments/message-headers/message-headers.xhtml |
789217a2 FC |
19 | enum HdrType { |
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 */ | |
26 | AGE, /**< RFC 7234 */ | |
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 */ | |
89 | TE, /**< RFC 7230 */ | |
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 */ | |
1139d406 AJ |
108 | #if X_ACCELERATOR_VARY |
109 | HDR_X_ACCELERATOR_VARY, /**< obsolete Squid custom header. */ | |
110 | #endif | |
111 | #if USE_ADAPTATION | |
789217a2 | 112 | X_NEXT_SERVICES, /**< Squid custom ICAP header */ |
1139d406 | 113 | #endif |
789217a2 FC |
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 */ | |
125 | }; | |
126 | ||
127 | }; /* namespace Http */ | |
1139d406 | 128 | |
dc25554a | 129 | /** possible types for http header fields */ |
d9b7869c | 130 | enum class field_type { |
789217a2 | 131 | ftInvalid,// = ENUM_END, /**< to catch nasty errors with hdr_id<->fld_type clashes */ |
dc25554a FC |
132 | ftInt, |
133 | ftInt64, | |
134 | ftStr, | |
135 | ftDate_1123, | |
136 | ftETag, | |
137 | ftPCc, | |
138 | ftPContRange, | |
139 | ftPRange, | |
140 | ftPSc, | |
141 | ftDate_1123_or_ETag | |
d9b7869c | 142 | }; |
dc25554a FC |
143 | |
144 | /* POD for headerTable */ | |
145 | class HeaderTableRecord { | |
146 | public: | |
147 | const char *name; | |
789217a2 | 148 | Http::HdrType id; |
dc25554a FC |
149 | field_type type; |
150 | }; | |
151 | ||
d1ea2a11 | 152 | /// header ID->namelookup table. |
dc25554a FC |
153 | extern const HeaderTableRecord headerTable[]; |
154 | ||
d1ea2a11 | 155 | /// for header name->id lookup, use HeaderLookupTable.lookup(hdr-as-sbuf); |
789217a2 FC |
156 | extern const LookupTable<Http::HdrType, HeaderTableRecord> HeaderLookupTable; |
157 | ||
158 | const HeaderTableRecord& | |
159 | HeaderById(Http::HdrType id); | |
160 | ||
161 | std::ostream & | |
162 | operator << (std::ostream &, Http::HdrType); | |
d1ea2a11 | 163 | |
1139d406 | 164 | #endif /* SQUID_HTTP_REGISTEREDHEADERS_H */ |
f53969cc | 165 |