userver: userver/http/common_headers.hpp Source File
Loading...
Searching...
No Matches
common_headers.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <userver/http/predefined_header.hpp>
4
5/// @file userver/http/common_headers.hpp
6/// @brief Common HTTP header names
7/// @ingroup userver_universal
8
9USERVER_NAMESPACE_BEGIN
10
11/// Common HTTP headers
12namespace http::headers {
13
14// Headers from rfc7231
15
16/// @name Representation Metadata
17/// @{
18inline constexpr PredefinedHeader kContentType{"Content-Type"};
19inline constexpr PredefinedHeader kContentEncoding{"Content-Encoding"};
20inline constexpr PredefinedHeader kContentLanguage{"Content-Language"};
21inline constexpr PredefinedHeader kContentLocation{"Content-Location"};
22inline constexpr PredefinedHeader kContentDisposition{"Content-Disposition"};
23/// @}
24
25/// @name Payload Semantics
26/// @{
27inline constexpr PredefinedHeader kContentLength{"Content-Length"};
28inline constexpr PredefinedHeader kContentRange{"Content-Range"};
29inline constexpr PredefinedHeader kTrailer{"Trailer"};
30inline constexpr PredefinedHeader kTransferEncoding{"Transfer-Encoding"};
31/// @}
32
33/// @name Request Headers - Controls
34/// @{
35inline constexpr PredefinedHeader kCacheControl{"Cache-Control"};
36inline constexpr PredefinedHeader kExpect{"Expect"};
37inline constexpr PredefinedHeader kHost{"Host"};
38inline constexpr PredefinedHeader kMaxForwards{"Max-Forwards"};
39inline constexpr PredefinedHeader kPragma{"Pragma"};
40inline constexpr PredefinedHeader kRange{"Range"};
41inline constexpr PredefinedHeader kTE{"TE"};
42/// @}
43
44/// @name Conditionals
45/// @{
46inline constexpr PredefinedHeader kIfMatch{"If-Match"};
47inline constexpr PredefinedHeader kIfNoneMatch{"If-None-Match"};
48inline constexpr PredefinedHeader kIfModifiedSince{"If-Modified-Since"};
49inline constexpr PredefinedHeader kIfUnmodifiedSince{"If-Unmodified-Since"};
50inline constexpr PredefinedHeader kIfRange{"If-Range"};
51/// @}
52
53/// @name Content Negotiation
54/// @{
55inline constexpr PredefinedHeader kAccept{"Accept"};
56inline constexpr PredefinedHeader kAcceptCharset{"Accept-Charset"};
57inline constexpr PredefinedHeader kAcceptEncoding{"Accept-Encoding"};
58inline constexpr PredefinedHeader kAcceptLanguage{"Accept-Language"};
59/// @}
60
61/// @name Authentication Credentials
62/// @{
63inline constexpr PredefinedHeader kAuthorization{"Authorization"};
64inline constexpr PredefinedHeader kProxyAuthorization{"Proxy-Authorization"};
65inline constexpr PredefinedHeader kApiKey{"X-YaTaxi-API-Key"};
66inline constexpr PredefinedHeader kExternalService{"X-YaTaxi-External-Service"};
67/// @}
68
69/// @name Request Context
70/// @{
71inline constexpr PredefinedHeader kFrom{"From"};
72inline constexpr PredefinedHeader kReferer{"Referer"};
73inline constexpr PredefinedHeader kUserAgent{"User-Agent"};
74inline constexpr PredefinedHeader kXTaxi{"X-Taxi"};
75inline constexpr PredefinedHeader kXRequestedUri{"X-Requested-Uri"};
76inline constexpr PredefinedHeader kXRequestApplication{"X-Request-Application"};
77/// @}
78
79// Response Header Fields
80
81/// @name Control Data
82/// @{
83inline constexpr PredefinedHeader kAge{"Age"};
84inline constexpr PredefinedHeader kExpires{"Expires"};
85inline constexpr PredefinedHeader kDate{"Date"};
86inline constexpr PredefinedHeader kLocation{"Location"};
87inline constexpr PredefinedHeader kRetryAfter{"Retry-After"};
88inline constexpr PredefinedHeader kVary{"Vary"};
89inline constexpr PredefinedHeader kWarning{"Warning"};
90inline constexpr PredefinedHeader kAccessControlAllowHeaders{"Access-Control-Allow-Headers"};
91/// @}
92
93/// @name Validator Header Fields
94/// @{
95inline constexpr PredefinedHeader kETag{"ETag"};
96inline constexpr PredefinedHeader kLastModified{"Last-Modified"};
97/// @}
98
99/// @name Authentication Challenges
100/// @{
101inline constexpr PredefinedHeader kWWWAuthenticate{"WWW-Authenticate"};
102inline constexpr PredefinedHeader kProxyAuthenticate{"Proxy-Authenticate"};
103/// @}
104
105/// @name Response Context
106/// @{
107inline constexpr PredefinedHeader kAcceptRanges{"Accept-Ranges"};
108inline constexpr PredefinedHeader kAllow{"Allow"};
109inline constexpr PredefinedHeader kServer{"Server"};
110/// @}
111
112/// @name Cookie
113/// @{
114inline constexpr PredefinedHeader kSetCookie{"Set-Cookie"};
115/// @}
116
117/// @name Websockets headers
118/// @{
119inline constexpr PredefinedHeader kWebsocketKey{"Sec-WebSocket-Key"};
120inline constexpr PredefinedHeader kWebsocketAccept{"Sec-WebSocket-Accept"};
121inline constexpr PredefinedHeader kWebsocketVersion{"Sec-WebSocket-Version"};
122/// @}
123
124/// @name Extra headers
125/// @{
126inline constexpr PredefinedHeader kConnection{"Connection"};
127inline constexpr PredefinedHeader kUpgrade{"Upgrade"};
128inline constexpr PredefinedHeader kCookie{"Cookie"};
129/// @}
130
131/// @name Tracing headers
132/// @{
133inline constexpr PredefinedHeader kXYaRequestId{"X-YaRequestId"};
134inline constexpr PredefinedHeader kXYaTraceId{"X-YaTraceId"};
135inline constexpr PredefinedHeader kXYaSpanId{"X-YaSpanId"};
136inline constexpr PredefinedHeader kXRequestId{"X-RequestId"};
137inline constexpr PredefinedHeader kXBackendServer{"X-Backend-Server"};
138inline constexpr PredefinedHeader kXTaxiEnvoyProxyDstVhost{"X-Taxi-EnvoyProxy-DstVhost"};
139
140/// B3 tracing Headers
141namespace b3 {
142inline constexpr PredefinedHeader kTraceId{"X-B3-TraceId"};
143inline constexpr PredefinedHeader kSpanId{"X-B3-SpanId"};
144inline constexpr PredefinedHeader kSampled{"X-B3-Sampled"};
145inline constexpr PredefinedHeader kParentSpanId{"X-B3-ParentSpanId"};
146} // namespace b3
147
148/// OpenTelemetry tracing Headers
149namespace opentelemetry {
150inline constexpr PredefinedHeader kTraceParent{"traceparent"};
151inline constexpr PredefinedHeader kTraceState{"tracestate"};
152} // namespace opentelemetry
153
154/// @}
155
156/// @name Baggage header
157/// @{
158inline constexpr PredefinedHeader kXBaggage{"baggage"};
159/// @}
160
161/// @name Generic Yandex headers
162/// @{
163inline constexpr PredefinedHeader kXYandexUid{"X-Yandex-UID"};
164
165// IP address of mobile client, not an IP address of single-hop client.
166inline constexpr PredefinedHeader kXRemoteIp{"X-Remote-IP"};
167/// @}
168
169/// @name Generic Yandex/MLU headers
170/// @{
171inline constexpr PredefinedHeader kXYaTaxiAllowAuthRequest{"X-YaTaxi-Allow-Auth-Request"};
172inline constexpr PredefinedHeader kXYaTaxiAllowAuthResponse{"X-YaTaxi-Allow-Auth-Response"};
173inline constexpr PredefinedHeader kXYaTaxiServerHostname{"X-YaTaxi-Server-Hostname"};
174inline constexpr PredefinedHeader kXYaTaxiClientTimeoutMs{"X-YaTaxi-Client-TimeoutMs"};
175inline constexpr PredefinedHeader kXYaTaxiDeadlineExpired{"X-YaTaxi-Deadline-Expired"};
176inline constexpr PredefinedHeader kXYaTaxiRatelimitedBy{"X-YaTaxi-Ratelimited-By"};
177inline constexpr PredefinedHeader kXYaTaxiRatelimitReason{"X-YaTaxi-Ratelimit-Reason"};
178
179namespace ratelimit_reason {
180inline constexpr std::string_view kCC{"congestion-control"};
181inline constexpr std::string_view kMaxResponseSizeInFlight{"max-response-size-in-flight"};
182inline constexpr std::string_view kMaxPendingResponses{"too-many-pending-responses"};
183inline constexpr std::string_view kGlobal{"global-ratelimit"};
184inline constexpr std::string_view kInFlight{"max-requests-in-flight"};
185} // namespace ratelimit_reason
186/// @}
187
188namespace k2 {
189inline constexpr PredefinedHeader kHttp2SettingsHeader{"HTTP2-Settings"};
190inline constexpr PredefinedHeader kMethod{":method"};
191inline constexpr PredefinedHeader kScheme{":scheme"};
192inline constexpr PredefinedHeader kAuthority{":authority"};
193inline constexpr PredefinedHeader kPath{":path"};
194inline constexpr PredefinedHeader kStatus{":status"};
195} // namespace k2
196
197} // namespace http::headers
198
199USERVER_NAMESPACE_END