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 #ifndef BOOST_BEAST_HTTP_FIELD_HPP
11 #define BOOST_BEAST_HTTP_FIELD_HPP
12 
13 #include <boost/beast/core/detail/config.hpp>
14 #include <boost/beast/core/string.hpp>
15 #include <iosfwd>
16 
17 namespace boost {
18 namespace beast {
19 namespace http {
20 
21 enum class field : unsigned short
22 {
23     unknown = 0,
24 
25     a_im,
26     accept,
27     accept_additions,
28     accept_charset,
29     accept_datetime,
30     accept_encoding,
31     accept_features,
32     accept_language,
33     accept_patch,
34     accept_post,
35     accept_ranges,
36     access_control,
37     access_control_allow_credentials,
38     access_control_allow_headers,
39     access_control_allow_methods,
40     access_control_allow_origin,
41     access_control_expose_headers,
42     access_control_max_age,
43     access_control_request_headers,
44     access_control_request_method,
45     age,
46     allow,
47     alpn,
48     also_control,
49     alt_svc,
50     alt_used,
51     alternate_recipient,
52     alternates,
53     apparently_to,
54     apply_to_redirect_ref,
55     approved,
56     archive,
57     archived_at,
58     article_names,
59     article_updates,
60     authentication_control,
61     authentication_info,
62     authentication_results,
63     authorization,
64     auto_submitted,
65     autoforwarded,
66     autosubmitted,
67     base,
68     bcc,
69     body,
70     c_ext,
71     c_man,
72     c_opt,
73     c_pep,
74     c_pep_info,
75     cache_control,
76     caldav_timezones,
77     cancel_key,
78     cancel_lock,
79     cc,
80     close,
81     comments,
82     compliance,
83     connection,
84     content_alternative,
85     content_base,
86     content_description,
87     content_disposition,
88     content_duration,
89     content_encoding,
90     content_features,
91     content_id,
92     content_identifier,
93     content_language,
94     content_length,
95     content_location,
96     content_md5,
97     content_range,
98     content_return,
99     content_script_type,
100     content_style_type,
101     content_transfer_encoding,
102     content_type,
103     content_version,
104     control,
105     conversion,
106     conversion_with_loss,
107     cookie,
108     cookie2,
109     cost,
110     dasl,
111     date,
112     date_received,
113     dav,
114     default_style,
115     deferred_delivery,
116     delivery_date,
117     delta_base,
118     depth,
119     derived_from,
120     destination,
121     differential_id,
122     digest,
123     discarded_x400_ipms_extensions,
124     discarded_x400_mts_extensions,
125     disclose_recipients,
126     disposition_notification_options,
127     disposition_notification_to,
128     distribution,
129     dkim_signature,
130     dl_expansion_history,
131     downgraded_bcc,
132     downgraded_cc,
133     downgraded_disposition_notification_to,
134     downgraded_final_recipient,
135     downgraded_from,
136     downgraded_in_reply_to,
137     downgraded_mail_from,
138     downgraded_message_id,
139     downgraded_original_recipient,
140     downgraded_rcpt_to,
141     downgraded_references,
142     downgraded_reply_to,
143     downgraded_resent_bcc,
144     downgraded_resent_cc,
145     downgraded_resent_from,
146     downgraded_resent_reply_to,
147     downgraded_resent_sender,
148     downgraded_resent_to,
149     downgraded_return_path,
150     downgraded_sender,
151     downgraded_to,
152     ediint_features,
153     eesst_version,
154     encoding,
155     encrypted,
156     errors_to,
157     etag,
158     expect,
159     expires,
160     expiry_date,
161     ext,
162     followup_to,
163     forwarded,
164     from,
165     generate_delivery_report,
166     getprofile,
167     hobareg,
168     host,
169     http2_settings,
170     if_,
171     if_match,
172     if_modified_since,
173     if_none_match,
174     if_range,
175     if_schedule_tag_match,
176     if_unmodified_since,
177     im,
178     importance,
179     in_reply_to,
180     incomplete_copy,
181     injection_date,
182     injection_info,
183     jabber_id,
184     keep_alive,
185     keywords,
186     label,
187     language,
188     last_modified,
189     latest_delivery_time,
190     lines,
191     link,
192     list_archive,
193     list_help,
194     list_id,
195     list_owner,
196     list_post,
197     list_subscribe,
198     list_unsubscribe,
199     list_unsubscribe_post,
200     location,
201     lock_token,
202     man,
203     max_forwards,
204     memento_datetime,
205     message_context,
206     message_id,
207     message_type,
208     meter,
209     method_check,
210     method_check_expires,
211     mime_version,
212     mmhs_acp127_message_identifier,
213     mmhs_authorizing_users,
214     mmhs_codress_message_indicator,
215     mmhs_copy_precedence,
216     mmhs_exempted_address,
217     mmhs_extended_authorisation_info,
218     mmhs_handling_instructions,
219     mmhs_message_instructions,
220     mmhs_message_type,
221     mmhs_originator_plad,
222     mmhs_originator_reference,
223     mmhs_other_recipients_indicator_cc,
224     mmhs_other_recipients_indicator_to,
225     mmhs_primary_precedence,
226     mmhs_subject_indicator_codes,
227     mt_priority,
228     negotiate,
229     newsgroups,
230     nntp_posting_date,
231     nntp_posting_host,
232     non_compliance,
233     obsoletes,
234     opt,
235     optional,
236     optional_www_authenticate,
237     ordering_type,
238     organization,
239     origin,
240     original_encoded_information_types,
241     original_from,
242     original_message_id,
243     original_recipient,
244     original_sender,
245     original_subject,
246     originator_return_address,
247     overwrite,
248     p3p,
249     path,
250     pep,
251     pep_info,
252     pics_label,
253     position,
254     posting_version,
255     pragma,
256     prefer,
257     preference_applied,
258     prevent_nondelivery_report,
259     priority,
260     privicon,
261     profileobject,
262     protocol,
263     protocol_info,
264     protocol_query,
265     protocol_request,
266     proxy_authenticate,
267     proxy_authentication_info,
268     proxy_authorization,
269     proxy_connection,
270     proxy_features,
271     proxy_instruction,
272     public_,
273     public_key_pins,
274     public_key_pins_report_only,
275     range,
276     received,
277     received_spf,
278     redirect_ref,
279     references,
280     referer,
281     referer_root,
282     relay_version,
283     reply_by,
284     reply_to,
285     require_recipient_valid_since,
286     resent_bcc,
287     resent_cc,
288     resent_date,
289     resent_from,
290     resent_message_id,
291     resent_reply_to,
292     resent_sender,
293     resent_to,
294     resolution_hint,
295     resolver_location,
296     retry_after,
297     return_path,
298     safe,
299     schedule_reply,
300     schedule_tag,
301     sec_websocket_accept,
302     sec_websocket_extensions,
303     sec_websocket_key,
304     sec_websocket_protocol,
305     sec_websocket_version,
306     security_scheme,
307     see_also,
308     sender,
309     sensitivity,
310     server,
311     set_cookie,
312     set_cookie2,
313     setprofile,
314     sio_label,
315     sio_label_history,
316     slug,
317     soapaction,
318     solicitation,
319     status_uri,
320     strict_transport_security,
321     subject,
322     subok,
323     subst,
324     summary,
325     supersedes,
326     surrogate_capability,
327     surrogate_control,
328     tcn,
329     te,
330     timeout,
331     title,
332     to,
333     topic,
334     trailer,
335     transfer_encoding,
336     ttl,
337     ua_color,
338     ua_media,
339     ua_pixels,
340     ua_resolution,
341     ua_windowpixels,
342     upgrade,
343     urgency,
344     uri,
345     user_agent,
346     variant_vary,
347     vary,
348     vbr_info,
349     version,
350     via,
351     want_digest,
352     warning,
353     www_authenticate,
354     x_archived_at,
355     x_device_accept,
356     x_device_accept_charset,
357     x_device_accept_encoding,
358     x_device_accept_language,
359     x_device_user_agent,
360     x_frame_options,
361     x_mittente,
362     x_pgp_sig,
363     x_ricevuta,
364     x_riferimento_message_id,
365     x_tiporicevuta,
366     x_trasporto,
367     x_verificasicurezza,
368     x400_content_identifier,
369     x400_content_return,
370     x400_content_type,
371     x400_mts_identifier,
372     x400_originator,
373     x400_received,
374     x400_recipients,
375     x400_trace,
376     xref,
377 };
378 
379 /** Convert a field enum to a string.
380 
381     @param f The field to convert
382 */
383 BOOST_BEAST_DECL
384 string_view
385 to_string(field f);
386 
387 /** Attempt to convert a string to a field enum.
388 
389     The string comparison is case-insensitive.
390 
391     @return The corresponding field, or @ref field::unknown
392     if no known field matches.
393 */
394 BOOST_BEAST_DECL
395 field
396 string_to_field(string_view s);
397 
398 /// Write the text for a field name to an output stream.
399 inline
400 std::ostream&
operator <<(std::ostream & os,field f)401 operator<<(std::ostream& os, field f)
402 {
403     return os << to_string(f);
404 }
405 
406 } // http
407 } // beast
408 } // boost
409 
410 #ifdef BOOST_BEAST_HEADER_ONLY
411 #include <boost/beast/http/impl/field.ipp>
412 #endif
413 
414 #endif
415