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{
91 "Access-Control-Allow-Headers"};
92/// @}
93
94/// @name Validator Header Fields
95/// @{
96inline constexpr PredefinedHeader kETag{"ETag"};
97inline constexpr PredefinedHeader kLastModified{"Last-Modified"};
98/// @}
99
100/// @name Authentication Challenges
101/// @{
102inline constexpr PredefinedHeader kWWWAuthenticate{"WWW-Authenticate"};
103inline constexpr PredefinedHeader kProxyAuthenticate{"Proxy-Authenticate"};
104/// @}
105
106/// @name Response Context
107/// @{
108inline constexpr PredefinedHeader kAcceptRanges{"Accept-Ranges"};
109inline constexpr PredefinedHeader kAllow{"Allow"};
110inline constexpr PredefinedHeader kServer{"Server"};
111/// @}
112
113/// @name Cookie
114/// @{
115inline constexpr PredefinedHeader kSetCookie{"Set-Cookie"};
116/// @}
117
118/// @name Websockets headers
119/// @{
120inline constexpr PredefinedHeader kWebsocketKey{"Sec-WebSocket-Key"};
121inline constexpr PredefinedHeader kWebsocketAccept{"Sec-WebSocket-Accept"};
122inline constexpr PredefinedHeader kWebsocketVersion{"Sec-WebSocket-Version"};
123/// @}
124
125/// @name Extra headers
126/// @{
127inline constexpr PredefinedHeader kConnection{"Connection"};
128inline constexpr PredefinedHeader kUpgrade{"Upgrade"};
129inline constexpr PredefinedHeader kCookie{"Cookie"};
130/// @}
131
132/// @name Tracing headers
133/// @{
134inline constexpr PredefinedHeader kXYaRequestId{"X-YaRequestId"};
135inline constexpr PredefinedHeader kXYaTraceId{"X-YaTraceId"};
136inline constexpr PredefinedHeader kXYaSpanId{"X-YaSpanId"};
137inline constexpr PredefinedHeader kXRequestId{"X-RequestId"};
138inline constexpr PredefinedHeader kXBackendServer{"X-Backend-Server"};
139inline constexpr PredefinedHeader kXTaxiEnvoyProxyDstVhost{
140 "X-Taxi-EnvoyProxy-DstVhost"};
141
142/// B3 tracing Headers
143namespace b3 {
144inline constexpr PredefinedHeader kTraceId{"X-B3-TraceId"};
145inline constexpr PredefinedHeader kSpanId{"X-B3-SpanId"};
146inline constexpr PredefinedHeader kSampled{"X-B3-Sampled"};
147inline constexpr PredefinedHeader kParentSpanId{"X-B3-ParentSpanId"};
148} // namespace b3
149
150/// OpenTelemetry tracing Headers
151namespace opentelemetry {
152inline constexpr PredefinedHeader kTraceParent{"traceparent"};
153inline constexpr PredefinedHeader kTraceState{"tracestate"};
154} // namespace opentelemetry
155
156/// @}
157
158/// @name Baggage header
159/// @{
160inline constexpr PredefinedHeader kXBaggage{"baggage"};
161/// @}
162
163/// @name Generic Yandex headers
164/// @{
165inline constexpr PredefinedHeader kXYandexUid{"X-Yandex-UID"};
166
167// IP address of mobile client, not an IP address of single-hop client.
168inline constexpr PredefinedHeader kXRemoteIp{"X-Remote-IP"};
169/// @}
170
171/// @name Generic Yandex/MLU headers
172/// @{
173inline constexpr PredefinedHeader kXYaTaxiAllowAuthRequest{
174 "X-YaTaxi-Allow-Auth-Request"};
175inline constexpr PredefinedHeader kXYaTaxiAllowAuthResponse{
176 "X-YaTaxi-Allow-Auth-Response"};
177inline constexpr PredefinedHeader kXYaTaxiServerHostname{
178 "X-YaTaxi-Server-Hostname"};
179inline constexpr PredefinedHeader kXYaTaxiClientTimeoutMs{
180 "X-YaTaxi-Client-TimeoutMs"};
181inline constexpr PredefinedHeader kXYaTaxiDeadlineExpired{
182 "X-YaTaxi-Deadline-Expired"};
183inline constexpr PredefinedHeader kXYaTaxiRatelimitedBy{
184 "X-YaTaxi-Ratelimited-By"};
185inline constexpr PredefinedHeader kXYaTaxiRatelimitReason{
186 "X-YaTaxi-Ratelimit-Reason"};
187
188namespace ratelimit_reason {
189inline constexpr std::string_view kCC{"congestion-control"};
190inline constexpr std::string_view kMaxResponseSizeInFlight{
191 "max-response-size-in-flight"};
192inline constexpr std::string_view kMaxPendingResponses{
193 "too-many-pending-responses"};
194inline constexpr std::string_view kGlobal{"global-ratelimit"};
195inline constexpr std::string_view kInFlight{"max-requests-in-flight"};
196} // namespace ratelimit_reason
197/// @}
198
199} // namespace http::headers
200
201USERVER_NAMESPACE_END