field.hpp 7.9 KB

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