]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/beast/test/beast/http/field.cpp
import quincy beta 17.1.0
[ceph.git] / ceph / src / boost / libs / beast / test / beast / http / field.cpp
1 //
2 // Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com)
3 //
4 // Distributed under the Boost Software License, Version 1.0. (See accompanying
5 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 //
7 // Official repository: https://github.com/boostorg/beast
8 //
9
10 // Test that header file is self-contained.
11 #include <boost/beast/http/field.hpp>
12
13 #include <boost/beast/_experimental/unit_test/suite.hpp>
14
15 namespace boost {
16 namespace beast {
17 namespace http {
18
19 class field_test : public beast::unit_test::suite
20 {
21 public:
22 void
23 testField()
24 {
25 auto const match =
26 [&](field f, string_view s)
27 {
28 BEAST_EXPECT(iequals(to_string(f), s));
29 BEAST_EXPECT(string_to_field(s) == f);
30 };
31
32 match(field::accept, "accept");
33 match(field::accept, "aCcept");
34 match(field::accept, "ACCEPT");
35
36 match(field::a_im, "A-IM");
37 match(field::accept, "Accept");
38 match(field::accept_additions, "Accept-Additions");
39 match(field::accept_charset, "Accept-Charset");
40 match(field::accept_datetime, "Accept-Datetime");
41 match(field::accept_encoding, "Accept-Encoding");
42 match(field::accept_features, "Accept-Features");
43 match(field::accept_language, "Accept-Language");
44 match(field::accept_patch, "Accept-Patch");
45 match(field::accept_post, "Accept-Post");
46 match(field::accept_ranges, "Accept-Ranges");
47 match(field::access_control, "Access-Control");
48 match(field::access_control_allow_credentials, "Access-Control-Allow-Credentials");
49 match(field::access_control_allow_headers, "Access-Control-Allow-Headers");
50 match(field::access_control_allow_methods, "Access-Control-Allow-Methods");
51 match(field::access_control_allow_origin, "Access-Control-Allow-Origin");
52 match(field::access_control_expose_headers, "Access-Control-Expose-Headers");
53 match(field::access_control_max_age, "Access-Control-Max-Age");
54 match(field::access_control_request_headers, "Access-Control-Request-Headers");
55 match(field::access_control_request_method, "Access-Control-Request-Method");
56 match(field::age, "Age");
57 match(field::allow, "Allow");
58 match(field::alpn, "ALPN");
59 match(field::also_control, "Also-Control");
60 match(field::alt_svc, "Alt-Svc");
61 match(field::alt_used, "Alt-Used");
62 match(field::alternate_recipient, "Alternate-Recipient");
63 match(field::alternates, "Alternates");
64 match(field::apparently_to, "Apparently-To");
65 match(field::apply_to_redirect_ref, "Apply-To-Redirect-Ref");
66 match(field::approved, "Approved");
67 match(field::archive, "Archive");
68 match(field::archived_at, "Archived-At");
69 match(field::article_names, "Article-Names");
70 match(field::article_updates, "Article-Updates");
71 match(field::authentication_control, "Authentication-Control");
72 match(field::authentication_info, "Authentication-Info");
73 match(field::authentication_results, "Authentication-Results");
74 match(field::authorization, "Authorization");
75 match(field::auto_submitted, "Auto-Submitted");
76 match(field::autoforwarded, "Autoforwarded");
77 match(field::autosubmitted, "Autosubmitted");
78 match(field::base, "Base");
79 match(field::bcc, "Bcc");
80 match(field::body, "Body");
81 match(field::c_ext, "C-Ext");
82 match(field::c_man, "C-Man");
83 match(field::c_opt, "C-Opt");
84 match(field::c_pep, "C-PEP");
85 match(field::c_pep_info, "C-PEP-Info");
86 match(field::cache_control, "Cache-Control");
87 match(field::caldav_timezones, "CalDAV-Timezones");
88 match(field::cancel_key, "Cancel-Key");
89 match(field::cancel_lock, "Cancel-Lock");
90 match(field::cc, "Cc");
91 match(field::close, "Close");
92 match(field::comments, "Comments");
93 match(field::compliance, "Compliance");
94 match(field::connection, "Connection");
95 match(field::content_alternative, "Content-Alternative");
96 match(field::content_base, "Content-Base");
97 match(field::content_description, "Content-Description");
98 match(field::content_disposition, "Content-Disposition");
99 match(field::content_duration, "Content-Duration");
100 match(field::content_encoding, "Content-Encoding");
101 match(field::content_features, "Content-features");
102 match(field::content_id, "Content-ID");
103 match(field::content_identifier, "Content-Identifier");
104 match(field::content_language, "Content-Language");
105 match(field::content_length, "Content-Length");
106 match(field::content_location, "Content-Location");
107 match(field::content_md5, "Content-MD5");
108 match(field::content_range, "Content-Range");
109 match(field::content_return, "Content-Return");
110 match(field::content_script_type, "Content-Script-Type");
111 match(field::content_style_type, "Content-Style-Type");
112 match(field::content_transfer_encoding, "Content-Transfer-Encoding");
113 match(field::content_type, "Content-Type");
114 match(field::content_version, "Content-Version");
115 match(field::control, "Control");
116 match(field::conversion, "Conversion");
117 match(field::conversion_with_loss, "Conversion-With-Loss");
118 match(field::cookie, "Cookie");
119 match(field::cookie2, "Cookie2");
120 match(field::cost, "Cost");
121 match(field::dasl, "DASL");
122 match(field::date, "Date");
123 match(field::date_received, "Date-Received");
124 match(field::dav, "DAV");
125 match(field::default_style, "Default-Style");
126 match(field::deferred_delivery, "Deferred-Delivery");
127 match(field::delivery_date, "Delivery-Date");
128 match(field::delta_base, "Delta-Base");
129 match(field::depth, "Depth");
130 match(field::derived_from, "Derived-From");
131 match(field::destination, "Destination");
132 match(field::differential_id, "Differential-ID");
133 match(field::digest, "Digest");
134 match(field::discarded_x400_ipms_extensions, "Discarded-X400-IPMS-Extensions");
135 match(field::discarded_x400_mts_extensions, "Discarded-X400-MTS-Extensions");
136 match(field::disclose_recipients, "Disclose-Recipients");
137 match(field::disposition_notification_options, "Disposition-Notification-Options");
138 match(field::disposition_notification_to, "Disposition-Notification-To");
139 match(field::distribution, "Distribution");
140 match(field::dkim_signature, "DKIM-Signature");
141 match(field::dl_expansion_history, "DL-Expansion-History");
142 match(field::downgraded_bcc, "Downgraded-Bcc");
143 match(field::downgraded_cc, "Downgraded-Cc");
144 match(field::downgraded_disposition_notification_to, "Downgraded-Disposition-Notification-To");
145 match(field::downgraded_final_recipient, "Downgraded-Final-Recipient");
146 match(field::downgraded_from, "Downgraded-From");
147 match(field::downgraded_in_reply_to, "Downgraded-In-Reply-To");
148 match(field::downgraded_mail_from, "Downgraded-Mail-From");
149 match(field::downgraded_message_id, "Downgraded-Message-Id");
150 match(field::downgraded_original_recipient, "Downgraded-Original-Recipient");
151 match(field::downgraded_rcpt_to, "Downgraded-Rcpt-To");
152 match(field::downgraded_references, "Downgraded-References");
153 match(field::downgraded_reply_to, "Downgraded-Reply-To");
154 match(field::downgraded_resent_bcc, "Downgraded-Resent-Bcc");
155 match(field::downgraded_resent_cc, "Downgraded-Resent-Cc");
156 match(field::downgraded_resent_from, "Downgraded-Resent-From");
157 match(field::downgraded_resent_reply_to, "Downgraded-Resent-Reply-To");
158 match(field::downgraded_resent_sender, "Downgraded-Resent-Sender");
159 match(field::downgraded_resent_to, "Downgraded-Resent-To");
160 match(field::downgraded_return_path, "Downgraded-Return-Path");
161 match(field::downgraded_sender, "Downgraded-Sender");
162 match(field::downgraded_to, "Downgraded-To");
163 match(field::ediint_features, "EDIINT-Features");
164 match(field::eesst_version, "Eesst-Version");
165 match(field::encoding, "Encoding");
166 match(field::encrypted, "Encrypted");
167 match(field::errors_to, "Errors-To");
168 match(field::etag, "ETag");
169 match(field::expect, "Expect");
170 match(field::expires, "Expires");
171 match(field::expiry_date, "Expiry-Date");
172 match(field::ext, "Ext");
173 match(field::followup_to, "Followup-To");
174 match(field::forwarded, "Forwarded");
175 match(field::from, "From");
176 match(field::generate_delivery_report, "Generate-Delivery-Report");
177 match(field::getprofile, "GetProfile");
178 match(field::hobareg, "Hobareg");
179 match(field::host, "Host");
180 match(field::http2_settings, "HTTP2-Settings");
181 match(field::if_, "If");
182 match(field::if_match, "If-Match");
183 match(field::if_modified_since, "If-Modified-Since");
184 match(field::if_none_match, "If-None-Match");
185 match(field::if_range, "If-Range");
186 match(field::if_schedule_tag_match, "If-Schedule-Tag-Match");
187 match(field::if_unmodified_since, "If-Unmodified-Since");
188 match(field::im, "IM");
189 match(field::importance, "Importance");
190 match(field::in_reply_to, "In-Reply-To");
191 match(field::incomplete_copy, "Incomplete-Copy");
192 match(field::injection_date, "Injection-Date");
193 match(field::injection_info, "Injection-Info");
194 match(field::jabber_id, "Jabber-ID");
195 match(field::keep_alive, "Keep-Alive");
196 match(field::keywords, "Keywords");
197 match(field::label, "Label");
198 match(field::language, "Language");
199 match(field::last_modified, "Last-Modified");
200 match(field::latest_delivery_time, "Latest-Delivery-Time");
201 match(field::lines, "Lines");
202 match(field::link, "Link");
203 match(field::list_archive, "List-Archive");
204 match(field::list_help, "List-Help");
205 match(field::list_id, "List-ID");
206 match(field::list_owner, "List-Owner");
207 match(field::list_post, "List-Post");
208 match(field::list_subscribe, "List-Subscribe");
209 match(field::list_unsubscribe, "List-Unsubscribe");
210 match(field::list_unsubscribe_post, "List-Unsubscribe-Post");
211 match(field::location, "Location");
212 match(field::lock_token, "Lock-Token");
213 match(field::man, "Man");
214 match(field::max_forwards, "Max-Forwards");
215 match(field::memento_datetime, "Memento-Datetime");
216 match(field::message_context, "Message-Context");
217 match(field::message_id, "Message-ID");
218 match(field::message_type, "Message-Type");
219 match(field::meter, "Meter");
220 match(field::method_check, "Method-Check");
221 match(field::method_check_expires, "Method-Check-Expires");
222 match(field::mime_version, "MIME-Version");
223 match(field::mmhs_acp127_message_identifier, "MMHS-Acp127-Message-Identifier");
224 match(field::mmhs_authorizing_users, "MMHS-Authorizing-Users");
225 match(field::mmhs_codress_message_indicator, "MMHS-Codress-Message-Indicator");
226 match(field::mmhs_copy_precedence, "MMHS-Copy-Precedence");
227 match(field::mmhs_exempted_address, "MMHS-Exempted-Address");
228 match(field::mmhs_extended_authorisation_info, "MMHS-Extended-Authorisation-Info");
229 match(field::mmhs_handling_instructions, "MMHS-Handling-Instructions");
230 match(field::mmhs_message_instructions, "MMHS-Message-Instructions");
231 match(field::mmhs_message_type, "MMHS-Message-Type");
232 match(field::mmhs_originator_plad, "MMHS-Originator-PLAD");
233 match(field::mmhs_originator_reference, "MMHS-Originator-Reference");
234 match(field::mmhs_other_recipients_indicator_cc, "MMHS-Other-Recipients-Indicator-CC");
235 match(field::mmhs_other_recipients_indicator_to, "MMHS-Other-Recipients-Indicator-To");
236 match(field::mmhs_primary_precedence, "MMHS-Primary-Precedence");
237 match(field::mmhs_subject_indicator_codes, "MMHS-Subject-Indicator-Codes");
238 match(field::mt_priority, "MT-Priority");
239 match(field::negotiate, "Negotiate");
240 match(field::newsgroups, "Newsgroups");
241 match(field::nntp_posting_date, "NNTP-Posting-Date");
242 match(field::nntp_posting_host, "NNTP-Posting-Host");
243 match(field::non_compliance, "Non-Compliance");
244 match(field::obsoletes, "Obsoletes");
245 match(field::opt, "Opt");
246 match(field::optional, "Optional");
247 match(field::optional_www_authenticate, "Optional-WWW-Authenticate");
248 match(field::ordering_type, "Ordering-Type");
249 match(field::organization, "Organization");
250 match(field::origin, "Origin");
251 match(field::original_encoded_information_types, "Original-Encoded-Information-Types");
252 match(field::original_from, "Original-From");
253 match(field::original_message_id, "Original-Message-ID");
254 match(field::original_recipient, "Original-Recipient");
255 match(field::original_sender, "Original-Sender");
256 match(field::original_subject, "Original-Subject");
257 match(field::originator_return_address, "Originator-Return-Address");
258 match(field::overwrite, "Overwrite");
259 match(field::p3p, "P3P");
260 match(field::path, "Path");
261 match(field::pep, "PEP");
262 match(field::pep_info, "Pep-Info");
263 match(field::pics_label, "PICS-Label");
264 match(field::position, "Position");
265 match(field::posting_version, "Posting-Version");
266 match(field::pragma, "Pragma");
267 match(field::prefer, "Prefer");
268 match(field::preference_applied, "Preference-Applied");
269 match(field::prevent_nondelivery_report, "Prevent-NonDelivery-Report");
270 match(field::priority, "Priority");
271 match(field::privicon, "Privicon");
272 match(field::profileobject, "ProfileObject");
273 match(field::protocol, "Protocol");
274 match(field::protocol_info, "Protocol-Info");
275 match(field::protocol_query, "Protocol-Query");
276 match(field::protocol_request, "Protocol-Request");
277 match(field::proxy_authenticate, "Proxy-Authenticate");
278 match(field::proxy_authentication_info, "Proxy-Authentication-Info");
279 match(field::proxy_authorization, "Proxy-Authorization");
280 match(field::proxy_connection, "Proxy-Connection");
281 match(field::proxy_features, "Proxy-Features");
282 match(field::proxy_instruction, "Proxy-Instruction");
283 match(field::public_, "Public");
284 match(field::public_key_pins, "Public-Key-Pins");
285 match(field::public_key_pins_report_only, "Public-Key-Pins-Report-Only");
286 match(field::range, "Range");
287 match(field::received, "Received");
288 match(field::received_spf, "Received-SPF");
289 match(field::redirect_ref, "Redirect-Ref");
290 match(field::references, "References");
291 match(field::referer, "Referer");
292 match(field::referer_root, "Referer-Root");
293 match(field::relay_version, "Relay-Version");
294 match(field::reply_by, "Reply-By");
295 match(field::reply_to, "Reply-To");
296 match(field::require_recipient_valid_since, "Require-Recipient-Valid-Since");
297 match(field::resent_bcc, "Resent-Bcc");
298 match(field::resent_cc, "Resent-Cc");
299 match(field::resent_date, "Resent-Date");
300 match(field::resent_from, "Resent-From");
301 match(field::resent_message_id, "Resent-Message-ID");
302 match(field::resent_reply_to, "Resent-Reply-To");
303 match(field::resent_sender, "Resent-Sender");
304 match(field::resent_to, "Resent-To");
305 match(field::resolution_hint, "Resolution-Hint");
306 match(field::resolver_location, "Resolver-Location");
307 match(field::retry_after, "Retry-After");
308 match(field::return_path, "Return-Path");
309 match(field::safe, "Safe");
310 match(field::schedule_reply, "Schedule-Reply");
311 match(field::schedule_tag, "Schedule-Tag");
312 match(field::sec_fetch_dest, "Sec-Fetch-Dest");
313 match(field::sec_fetch_mode, "Sec-Fetch-Mode");
314 match(field::sec_fetch_site, "Sec-Fetch-Site");
315 match(field::sec_fetch_user, "Sec-Fetch-User");
316 match(field::sec_websocket_accept, "Sec-WebSocket-Accept");
317 match(field::sec_websocket_extensions, "Sec-WebSocket-Extensions");
318 match(field::sec_websocket_key, "Sec-WebSocket-Key");
319 match(field::sec_websocket_protocol, "Sec-WebSocket-Protocol");
320 match(field::sec_websocket_version, "Sec-WebSocket-Version");
321 match(field::security_scheme, "Security-Scheme");
322 match(field::see_also, "See-Also");
323 match(field::sender, "Sender");
324 match(field::sensitivity, "Sensitivity");
325 match(field::server, "Server");
326 match(field::set_cookie, "Set-Cookie");
327 match(field::set_cookie2, "Set-Cookie2");
328 match(field::setprofile, "SetProfile");
329 match(field::sio_label, "SIO-Label");
330 match(field::sio_label_history, "SIO-Label-History");
331 match(field::slug, "SLUG");
332 match(field::soapaction, "SoapAction");
333 match(field::solicitation, "Solicitation");
334 match(field::status_uri, "Status-URI");
335 match(field::strict_transport_security, "Strict-Transport-Security");
336 match(field::subject, "Subject");
337 match(field::subok, "SubOK");
338 match(field::subst, "Subst");
339 match(field::summary, "Summary");
340 match(field::supersedes, "Supersedes");
341 match(field::surrogate_capability, "Surrogate-Capability");
342 match(field::surrogate_control, "Surrogate-Control");
343 match(field::tcn, "TCN");
344 match(field::te, "TE");
345 match(field::timeout, "Timeout");
346 match(field::title, "Title");
347 match(field::to, "To");
348 match(field::topic, "Topic");
349 match(field::trailer, "Trailer");
350 match(field::transfer_encoding, "Transfer-Encoding");
351 match(field::ttl, "TTL");
352 match(field::ua_color, "UA-Color");
353 match(field::ua_media, "UA-Media");
354 match(field::ua_pixels, "UA-Pixels");
355 match(field::ua_resolution, "UA-Resolution");
356 match(field::ua_windowpixels, "UA-Windowpixels");
357 match(field::upgrade, "Upgrade");
358 match(field::urgency, "Urgency");
359 match(field::uri, "URI");
360 match(field::user_agent, "User-Agent");
361 match(field::variant_vary, "Variant-Vary");
362 match(field::vary, "Vary");
363 match(field::vbr_info, "VBR-Info");
364 match(field::version, "Version");
365 match(field::via, "Via");
366 match(field::want_digest, "Want-Digest");
367 match(field::warning, "Warning");
368 match(field::www_authenticate, "WWW-Authenticate");
369 match(field::x_archived_at, "X-Archived-At");
370 match(field::x_device_accept, "X-Device-Accept");
371 match(field::x_device_accept_charset, "X-Device-Accept-Charset");
372 match(field::x_device_accept_encoding, "X-Device-Accept-Encoding");
373 match(field::x_device_accept_language, "X-Device-Accept-Language");
374 match(field::x_device_user_agent, "X-Device-User-Agent");
375 match(field::x_frame_options, "X-Frame-Options");
376 match(field::x_mittente, "X-Mittente");
377 match(field::x_pgp_sig, "X-PGP-Sig");
378 match(field::x_ricevuta, "X-Ricevuta");
379 match(field::x_riferimento_message_id, "X-Riferimento-Message-ID");
380 match(field::x_tiporicevuta, "X-TipoRicevuta");
381 match(field::x_trasporto, "X-Trasporto");
382 match(field::x_verificasicurezza, "X-VerificaSicurezza");
383 match(field::x400_content_identifier, "X400-Content-Identifier");
384 match(field::x400_content_return, "X400-Content-Return");
385 match(field::x400_content_type, "X400-Content-Type");
386 match(field::x400_mts_identifier, "X400-MTS-Identifier");
387 match(field::x400_originator, "X400-Originator");
388 match(field::x400_received, "X400-Received");
389 match(field::x400_recipients, "X400-Recipients");
390 match(field::x400_trace, "X400-Trace");
391 match(field::xref, "Xref");
392
393 auto const unknown =
394 [&](string_view s)
395 {
396 BEAST_EXPECT(string_to_field(s) == field::unknown);
397 };
398 unknown("");
399 unknown("x");
400 }
401
402 void run() override
403 {
404 testField();
405 pass();
406 }
407 };
408
409 BEAST_DEFINE_TESTSUITE(beast,http,field);
410
411 } // http
412 } // beast
413 } // boost