field.hpp 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  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. accept,
  21. accept_ch,
  22. accept_charset, // Deprecated
  23. accept_encoding,
  24. accept_language,
  25. accept_patch,
  26. accept_post,
  27. accept_ranges,
  28. accept_signature,
  29. access_control_allow_credentials,
  30. access_control_allow_headers,
  31. access_control_allow_methods,
  32. access_control_allow_origin,
  33. access_control_expose_headers,
  34. access_control_max_age,
  35. access_control_request_headers,
  36. access_control_request_method,
  37. age,
  38. allow,
  39. alt_svc,
  40. alt_used,
  41. authorization,
  42. cache_control,
  43. clear_site_data,
  44. connection,
  45. content_digest,
  46. content_disposition,
  47. content_dpr, // Non-standard // Deprecated
  48. content_encoding,
  49. content_language,
  50. content_length,
  51. content_location,
  52. content_range,
  53. content_security_policy,
  54. content_security_policy_report_only,
  55. content_type,
  56. cookie,
  57. cross_origin_embedder_policy,
  58. cross_origin_opener_policy,
  59. cross_origin_resource_policy,
  60. date,
  61. deprecation,
  62. device_memory,
  63. digest,
  64. dnt, // Non-standard // Deprecated
  65. dpr, // Non-standard // Deprecated
  66. etag,
  67. expect,
  68. expect_ct, // Deprecated
  69. expires,
  70. forwarded,
  71. from,
  72. host,
  73. if_match,
  74. if_modified_since,
  75. if_none_match,
  76. if_range,
  77. if_unmodified_since,
  78. keep_alive,
  79. last_modified,
  80. link,
  81. location,
  82. max_forwards,
  83. origin,
  84. origin_agent_cluster,
  85. pragma, // Deprecated
  86. prefer,
  87. preference_applied,
  88. priority,
  89. proxy_authenticate,
  90. proxy_authorization,
  91. proxy_connection,
  92. range,
  93. referer,
  94. referrer_policy,
  95. refresh,
  96. report_to, // Non-standard // Deprecated
  97. reporting_endpoints,
  98. repr_digest,
  99. retry_after,
  100. sec_ch_ua_full_version, // Deprecated
  101. sec_fetch_dest,
  102. sec_fetch_mode,
  103. sec_fetch_site,
  104. sec_fetch_user,
  105. sec_purpose,
  106. sec_websocket_accept,
  107. sec_websocket_extensions,
  108. sec_websocket_key,
  109. sec_websocket_protocol,
  110. sec_websocket_version,
  111. server,
  112. server_timing,
  113. service_worker,
  114. service_worker_allowed,
  115. service_worker_navigation_preload,
  116. set_cookie,
  117. set_login,
  118. signature,
  119. signature_input,
  120. sourcemap,
  121. strict_transport_security,
  122. te,
  123. timing_allow_origin,
  124. tk, // Non-standard // Deprecated
  125. trailer,
  126. transfer_encoding,
  127. upgrade,
  128. upgrade_insecure_requests,
  129. user_agent,
  130. vary,
  131. via,
  132. viewport_width, // Non-standard // Deprecated
  133. want_content_digest,
  134. want_repr_digest,
  135. warning, // Deprecated
  136. width, // Non-standard // Deprecated
  137. www_authenticate,
  138. x_content_type_options,
  139. x_dns_prefetch_control, // Non-standard
  140. x_forwarded_for, // Non-standard
  141. x_forwarded_host, // Non-standard
  142. x_forwarded_proto, // Non-standard
  143. x_frame_options,
  144. x_permitted_cross_domain_policies, // Non-standard
  145. x_powered_by, // Non-standard
  146. x_robots_tag, // Non-standard
  147. x_xss_protection, // Non-standard // Deprecated
  148. };
  149. /** Convert a field enum to a string.
  150. @param f The field to convert
  151. */
  152. BOOST_BEAST_DECL
  153. string_view
  154. to_string(field f);
  155. /** Attempt to convert a string to a field enum.
  156. The string comparison is case-insensitive.
  157. @return The corresponding field, or @ref field::unknown
  158. if no known field matches.
  159. */
  160. BOOST_BEAST_DECL
  161. field
  162. string_to_field(string_view s);
  163. /// Write the text for a field name to an output stream.
  164. BOOST_BEAST_DECL
  165. std::ostream&
  166. operator<<(std::ostream& os, field f);
  167. } // http
  168. } // beast
  169. } // boost
  170. #ifdef BOOST_BEAST_HEADER_ONLY
  171. #include <boost/beast/http/impl/field.ipp>
  172. #endif
  173. #endif