fields.hpp 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893
  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_FIELDS_HPP
  10. #define BOOST_BEAST_HTTP_FIELDS_HPP
  11. #include <boost/beast/http/fields_fwd.hpp>
  12. #include <boost/beast/core/detail/allocator.hpp>
  13. #include <boost/beast/core/detail/config.hpp>
  14. #include <boost/beast/core/error.hpp>
  15. #include <boost/beast/core/string.hpp>
  16. #include <boost/beast/http/field.hpp>
  17. #include <boost/asio/buffer.hpp>
  18. #include <boost/core/empty_value.hpp>
  19. #include <boost/intrusive/list.hpp>
  20. #include <boost/intrusive/set.hpp>
  21. #include <boost/optional.hpp>
  22. #include <cctype>
  23. #include <cstring>
  24. #include <memory>
  25. #include <type_traits>
  26. #include <utility>
  27. namespace boost {
  28. namespace beast {
  29. namespace http {
  30. /** A container for storing HTTP header fields.
  31. This container is designed to store the field value pairs that make
  32. up the fields and trailers in an HTTP message. Objects of this type
  33. are iterable, with each element holding the field name and field
  34. value.
  35. Field names are stored as-is, but comparisons are case-insensitive.
  36. The container behaves as a `std::multiset`; there will be a separate
  37. value for each occurrence of the same field name. When the container
  38. is iterated the fields are presented in the order of insertion, with
  39. fields having the same name following each other consecutively.
  40. Meets the requirements of <em>Fields</em>
  41. @tparam Allocator The allocator to use.
  42. */
  43. template<class Allocator>
  44. class basic_fields
  45. #if ! BOOST_BEAST_DOXYGEN
  46. : private boost::empty_value<Allocator>
  47. #endif
  48. {
  49. // Fancy pointers are not supported
  50. static_assert(std::is_pointer<typename
  51. std::allocator_traits<Allocator>::pointer>::value,
  52. "Allocator must use regular pointers");
  53. #ifndef BOOST_BEAST_DOXYGEN
  54. friend class fields_test; // for `header`
  55. #endif
  56. struct element;
  57. using off_t = std::uint16_t;
  58. public:
  59. /// The type of allocator used.
  60. using allocator_type = Allocator;
  61. /// The type of element used to represent a field
  62. class value_type
  63. {
  64. #ifndef BOOST_BEAST_DOXYGEN
  65. friend class basic_fields;
  66. #endif
  67. off_t off_;
  68. off_t len_;
  69. field f_;
  70. char*
  71. data() const;
  72. net::const_buffer
  73. buffer() const;
  74. protected:
  75. value_type(field name,
  76. string_view sname, string_view value);
  77. public:
  78. /// Constructor (deleted)
  79. value_type(value_type const&) = delete;
  80. /// Assignment (deleted)
  81. value_type& operator=(value_type const&) = delete;
  82. /// Returns the field enum, which can be @ref boost::beast::http::field::unknown
  83. field
  84. name() const;
  85. /// Returns the field name as a string
  86. string_view const
  87. name_string() const;
  88. /// Returns the value of the field
  89. string_view const
  90. value() const;
  91. };
  92. /** A strictly less predicate for comparing keys, using a case-insensitive comparison.
  93. The case-comparison operation is defined only for low-ASCII characters.
  94. */
  95. #if BOOST_BEAST_DOXYGEN
  96. using key_compare = __implementation_defined__;
  97. #else
  98. struct key_compare : beast::iless
  99. #endif
  100. {
  101. /// Returns `true` if lhs is less than rhs using a strict ordering
  102. bool
  103. operator()(
  104. string_view lhs,
  105. value_type const& rhs) const noexcept
  106. {
  107. if(lhs.size() < rhs.name_string().size())
  108. return true;
  109. if(lhs.size() > rhs.name_string().size())
  110. return false;
  111. return iless::operator()(lhs, rhs.name_string());
  112. }
  113. /// Returns `true` if lhs is less than rhs using a strict ordering
  114. bool
  115. operator()(
  116. value_type const& lhs,
  117. string_view rhs) const noexcept
  118. {
  119. if(lhs.name_string().size() < rhs.size())
  120. return true;
  121. if(lhs.name_string().size() > rhs.size())
  122. return false;
  123. return iless::operator()(lhs.name_string(), rhs);
  124. }
  125. /// Returns `true` if lhs is less than rhs using a strict ordering
  126. bool
  127. operator()(
  128. value_type const& lhs,
  129. value_type const& rhs) const noexcept
  130. {
  131. if(lhs.name_string().size() < rhs.name_string().size())
  132. return true;
  133. if(lhs.name_string().size() > rhs.name_string().size())
  134. return false;
  135. return iless::operator()(lhs.name_string(), rhs.name_string());
  136. }
  137. };
  138. /// The algorithm used to serialize the header
  139. #if BOOST_BEAST_DOXYGEN
  140. using writer = __implementation_defined__;
  141. #else
  142. class writer;
  143. #endif
  144. private:
  145. struct element
  146. : public boost::intrusive::list_base_hook<
  147. boost::intrusive::link_mode<
  148. boost::intrusive::normal_link>>
  149. , public boost::intrusive::set_base_hook<
  150. boost::intrusive::link_mode<
  151. boost::intrusive::normal_link>>
  152. , public value_type
  153. {
  154. element(field name,
  155. string_view sname, string_view value);
  156. };
  157. using list_t = typename boost::intrusive::make_list<
  158. element,
  159. boost::intrusive::constant_time_size<false>
  160. >::type;
  161. using set_t = typename boost::intrusive::make_multiset<
  162. element,
  163. boost::intrusive::constant_time_size<false>,
  164. boost::intrusive::compare<key_compare>
  165. >::type;
  166. using align_type = typename
  167. boost::type_with_alignment<alignof(element)>::type;
  168. using rebind_type = typename
  169. beast::detail::allocator_traits<Allocator>::
  170. template rebind_alloc<align_type>;
  171. using alloc_traits =
  172. beast::detail::allocator_traits<rebind_type>;
  173. using pocma = typename
  174. alloc_traits::propagate_on_container_move_assignment;
  175. using pocca = typename
  176. alloc_traits::propagate_on_container_copy_assignment;
  177. using pocs = typename
  178. alloc_traits::propagate_on_container_swap;
  179. using size_type = typename
  180. beast::detail::allocator_traits<Allocator>::size_type;
  181. public:
  182. /// Maximum field name size
  183. static std::size_t constexpr max_name_size =
  184. (std::numeric_limits<std::uint16_t>::max)() - 2;
  185. /// Maximum field value size
  186. static std::size_t constexpr max_value_size =
  187. (std::numeric_limits<std::uint16_t>::max)() - 2;
  188. /// Destructor
  189. ~basic_fields();
  190. /// Constructor.
  191. basic_fields() = default;
  192. /** Constructor.
  193. @param alloc The allocator to use.
  194. */
  195. explicit
  196. basic_fields(Allocator const& alloc) noexcept;
  197. /** Move constructor.
  198. The state of the moved-from object is
  199. as if constructed using the same allocator.
  200. */
  201. basic_fields(basic_fields&&) noexcept;
  202. /** Move constructor.
  203. The state of the moved-from object is
  204. as if constructed using the same allocator.
  205. @param alloc The allocator to use.
  206. */
  207. basic_fields(basic_fields&&, Allocator const& alloc);
  208. /// Copy constructor.
  209. basic_fields(basic_fields const&);
  210. /** Copy constructor.
  211. @param alloc The allocator to use.
  212. */
  213. basic_fields(basic_fields const&, Allocator const& alloc);
  214. /// Copy constructor.
  215. template<class OtherAlloc>
  216. basic_fields(basic_fields<OtherAlloc> const&);
  217. /** Copy constructor.
  218. @param alloc The allocator to use.
  219. */
  220. template<class OtherAlloc>
  221. basic_fields(basic_fields<OtherAlloc> const&,
  222. Allocator const& alloc);
  223. /** Move assignment.
  224. The state of the moved-from object is
  225. as if constructed using the same allocator.
  226. */
  227. basic_fields& operator=(basic_fields&&) noexcept(
  228. pocma::value && std::is_nothrow_move_assignable<Allocator>::value);
  229. /// Copy assignment.
  230. basic_fields& operator=(basic_fields const&);
  231. /// Copy assignment.
  232. template<class OtherAlloc>
  233. basic_fields& operator=(basic_fields<OtherAlloc> const&);
  234. public:
  235. /// A constant iterator to the field sequence.
  236. #if BOOST_BEAST_DOXYGEN
  237. using const_iterator = __implementation_defined__;
  238. #else
  239. using const_iterator = typename list_t::const_iterator;
  240. #endif
  241. /// A constant iterator to the field sequence.
  242. using iterator = const_iterator;
  243. /// Return a copy of the allocator associated with the container.
  244. allocator_type
  245. get_allocator() const
  246. {
  247. return this->get();
  248. }
  249. //--------------------------------------------------------------------------
  250. //
  251. // Element access
  252. //
  253. //--------------------------------------------------------------------------
  254. /** Returns the value for a field, or throws an exception.
  255. If more than one field with the specified name exists, the
  256. first field defined by insertion order is returned.
  257. @param name The name of the field.
  258. @return The field value.
  259. @throws std::out_of_range if the field is not found.
  260. */
  261. string_view const
  262. at(field name) const;
  263. /** Returns the value for a field, or throws an exception.
  264. If more than one field with the specified name exists, the
  265. first field defined by insertion order is returned.
  266. @param name The name of the field. It is interpreted as a case-insensitive string.
  267. @return The field value.
  268. @throws std::out_of_range if the field is not found.
  269. */
  270. string_view const
  271. at(string_view name) const;
  272. /** Returns the value for a field, or `""` if it does not exist.
  273. If more than one field with the specified name exists, the
  274. first field defined by insertion order is returned.
  275. @param name The name of the field.
  276. */
  277. string_view const
  278. operator[](field name) const;
  279. /** Returns the value for a case-insensitive matching header, or `""` if it does not exist.
  280. If more than one field with the specified name exists, the
  281. first field defined by insertion order is returned.
  282. @param name The name of the field. It is interpreted as a case-insensitive string.
  283. */
  284. string_view const
  285. operator[](string_view name) const;
  286. //--------------------------------------------------------------------------
  287. //
  288. // Iterators
  289. //
  290. //--------------------------------------------------------------------------
  291. /// Return a const iterator to the beginning of the field sequence.
  292. const_iterator
  293. begin() const
  294. {
  295. return list_.cbegin();
  296. }
  297. /// Return a const iterator to the end of the field sequence.
  298. const_iterator
  299. end() const
  300. {
  301. return list_.cend();
  302. }
  303. /// Return a const iterator to the beginning of the field sequence.
  304. const_iterator
  305. cbegin() const
  306. {
  307. return list_.cbegin();
  308. }
  309. /// Return a const iterator to the end of the field sequence.
  310. const_iterator
  311. cend() const
  312. {
  313. return list_.cend();
  314. }
  315. //--------------------------------------------------------------------------
  316. //
  317. // Capacity
  318. //
  319. //--------------------------------------------------------------------------
  320. private:
  321. // VFALCO Since the header and message derive from Fields,
  322. // what does the expression m.empty() mean? Its confusing.
  323. bool
  324. empty() const
  325. {
  326. return list_.empty();
  327. }
  328. public:
  329. //--------------------------------------------------------------------------
  330. //
  331. // Modifiers
  332. //
  333. //--------------------------------------------------------------------------
  334. /** Remove all fields from the container
  335. All references, pointers, or iterators referring to contained
  336. elements are invalidated. All past-the-end iterators are also
  337. invalidated.
  338. @par Postconditions:
  339. @code
  340. std::distance(this->begin(), this->end()) == 0
  341. @endcode
  342. */
  343. void
  344. clear();
  345. /** Insert a field.
  346. If one or more fields with the same name already exist,
  347. the new field will be inserted after the last field with
  348. the matching name, in serialization order.
  349. The value can be an empty string.
  350. @param name The field name.
  351. @param value The field value.
  352. @throws boost::system::system_error Thrown if an error occurs:
  353. @li If the size of @c value exceeds @ref max_value_size, the
  354. error code will be @ref error::header_field_value_too_large.
  355. */
  356. void
  357. insert(field name, string_view value);
  358. void
  359. insert(field, std::nullptr_t) = delete;
  360. /** Insert a field.
  361. If one or more fields with the same name already exist,
  362. the new field will be inserted after the last field with
  363. the matching name, in serialization order.
  364. The value can be an empty string.
  365. @param name The field name. It is interpreted as a case-insensitive string.
  366. @param value The field value.
  367. @throws boost::system::system_error Thrown if an error occurs:
  368. @li If the size of @c name exceeds @ref max_name_size, the
  369. error code will be @ref error::header_field_name_too_large.
  370. @li If the size of @c value exceeds @ref max_value_size, the
  371. error code will be @ref error::header_field_value_too_large.
  372. */
  373. void
  374. insert(string_view name, string_view value);
  375. void
  376. insert(string_view, std::nullptr_t) = delete;
  377. /** Insert a field.
  378. If one or more fields with the same name already exist,
  379. the new field will be inserted after the last field with
  380. the matching name, in serialization order.
  381. The value can be an empty string.
  382. @param name The field name.
  383. @param name_string The literal text corresponding to the
  384. field name. If `name != field::unknown`, then this value
  385. must be equal to `to_string(name)` using a case-insensitive
  386. comparison, otherwise the behavior is undefined.
  387. @param value The field value.
  388. @throws boost::system::system_error Thrown if an error occurs:
  389. @li If the size of @c name_string exceeds @ref max_name_size,
  390. the error code will be @ref error::header_field_name_too_large.
  391. @li If the size of @c value exceeds @ref max_value_size, the
  392. error code will be @ref error::header_field_value_too_large.
  393. */
  394. void
  395. insert(field name, string_view name_string,
  396. string_view value);
  397. void
  398. insert(field, string_view, std::nullptr_t) = delete;
  399. /** Insert a field.
  400. If one or more fields with the same name already exist,
  401. the new field will be inserted after the last field with
  402. the matching name, in serialization order.
  403. The value can be an empty string.
  404. @param name The field name.
  405. @param name_string The literal text corresponding to the
  406. field name. If `name != field::unknown`, then this value
  407. must be equal to `to_string(name)` using a case-insensitive
  408. comparison, otherwise the behavior is undefined.
  409. @param value The field value.
  410. @param ec Set to indicate what error occurred:
  411. @li If the size of @c name_string exceeds @ref max_name_size,
  412. the error code will be @ref error::header_field_name_too_large.
  413. @li If the size of @c value exceeds @ref max_value_size, the
  414. error code will be @ref error::header_field_value_too_large.
  415. */
  416. void
  417. insert(field name, string_view name_string,
  418. string_view value, error_code& ec);
  419. void
  420. insert(field, string_view, std::nullptr_t, error_code& ec) = delete;
  421. /** Set a field value, removing any other instances of that field.
  422. First removes any values with matching field names, then
  423. inserts the new field value. The value may be an empty string.
  424. @param name The field name.
  425. @param value The field value.
  426. @throws boost::system::system_error Thrown if an error occurs:
  427. @li If the size of @c value exceeds @ref max_value_size, the
  428. error code will be @ref error::header_field_value_too_large.
  429. */
  430. void
  431. set(field name, string_view value);
  432. void
  433. set(field, std::nullptr_t) = delete;
  434. /** Set a field value, removing any other instances of that field.
  435. First removes any values with matching field names, then
  436. inserts the new field value. The value can be an empty string.
  437. @param name The field name. It is interpreted as a case-insensitive string.
  438. @param value The field value.
  439. @throws boost::system::system_error Thrown if an error occurs:
  440. @li If the size of @c name exceeds @ref max_name_size, the
  441. error code will be @ref error::header_field_name_too_large.
  442. @li If the size of @c value exceeds @ref max_value_size, the
  443. error code will be @ref error::header_field_value_too_large.
  444. */
  445. void
  446. set(string_view name, string_view value);
  447. void
  448. set(string_view, std::nullptr_t) = delete;
  449. /** Remove a field.
  450. References and iterators to the erased elements are
  451. invalidated. Other references and iterators are not
  452. affected.
  453. @param pos An iterator to the element to remove.
  454. @return An iterator following the last removed element.
  455. If the iterator refers to the last element, the end()
  456. iterator is returned.
  457. */
  458. const_iterator
  459. erase(const_iterator pos);
  460. /** Remove all fields with the specified name.
  461. All fields with the same field name are erased from the
  462. container.
  463. References and iterators to the erased elements are
  464. invalidated. Other references and iterators are not
  465. affected.
  466. @param name The field name.
  467. @return The number of fields removed.
  468. */
  469. std::size_t
  470. erase(field name);
  471. /** Remove all fields with the specified name.
  472. All fields with the same field name are erased from the
  473. container.
  474. References and iterators to the erased elements are
  475. invalidated. Other references and iterators are not
  476. affected.
  477. @param name The field name. It is interpreted as a case-insensitive string.
  478. @return The number of fields removed.
  479. */
  480. std::size_t
  481. erase(string_view name);
  482. /** Return a buffer sequence representing the trailers.
  483. This function returns a buffer sequence holding the
  484. serialized representation of the trailer fields promised
  485. in the Accept field. Before calling this function the
  486. Accept field must contain the exact trailer fields
  487. desired. Each field must also exist.
  488. */
  489. /// Swap this container with another
  490. void
  491. swap(basic_fields& other);
  492. /// Swap two field containers
  493. template<class Alloc>
  494. friend
  495. void
  496. swap(basic_fields<Alloc>& lhs, basic_fields<Alloc>& rhs);
  497. //--------------------------------------------------------------------------
  498. //
  499. // Lookup
  500. //
  501. //--------------------------------------------------------------------------
  502. /** Returns `true` if there is a field with the specified name.
  503. @param name The field name.
  504. */
  505. bool
  506. contains(field name) const;
  507. /** Returns `true` if there is a field with the specified name.
  508. @param name The field name. It is interpreted as a case-insensitive string.
  509. */
  510. bool
  511. contains(string_view name) const;
  512. /** Return the number of fields with the specified name.
  513. @param name The field name.
  514. */
  515. std::size_t
  516. count(field name) const;
  517. /** Return the number of fields with the specified name.
  518. @param name The field name. It is interpreted as a case-insensitive string.
  519. */
  520. std::size_t
  521. count(string_view name) const;
  522. /** Returns an iterator to the case-insensitive matching field.
  523. If more than one field with the specified name exists, the
  524. first field defined by insertion order is returned.
  525. @param name The field name.
  526. @return An iterator to the matching field, or `end()` if
  527. no match was found.
  528. */
  529. const_iterator
  530. find(field name) const;
  531. /** Returns an iterator to the case-insensitive matching field name.
  532. If more than one field with the specified name exists, the
  533. first field defined by insertion order is returned.
  534. @param name The field name. It is interpreted as a case-insensitive string.
  535. @return An iterator to the matching field, or `end()` if
  536. no match was found.
  537. */
  538. const_iterator
  539. find(string_view name) const;
  540. /** Returns a range of iterators to the fields with the specified name.
  541. This function returns the first and last iterators to the ordered
  542. fields with the specified name.
  543. @note The fields represented by the range are ordered. Its elements
  544. are guaranteed to match the field ordering of the message. This
  545. means users do not need to sort this range when comparing fields
  546. of the same name in different messages.
  547. @param name The field name.
  548. @return A range of iterators to fields with the same name,
  549. otherwise an empty range.
  550. */
  551. std::pair<const_iterator, const_iterator>
  552. equal_range(field name) const;
  553. /// @copydoc boost::beast::http::basic_fields::equal_range(boost::beast::http::field) const
  554. std::pair<const_iterator, const_iterator>
  555. equal_range(string_view name) const;
  556. //--------------------------------------------------------------------------
  557. //
  558. // Observers
  559. //
  560. //--------------------------------------------------------------------------
  561. /// Returns a copy of the key comparison function
  562. key_compare
  563. key_comp() const
  564. {
  565. return key_compare{};
  566. }
  567. protected:
  568. /** Returns the request-method string.
  569. @note Only called for requests.
  570. */
  571. string_view
  572. get_method_impl() const;
  573. /** Returns the request-target string.
  574. @note Only called for requests.
  575. */
  576. string_view
  577. get_target_impl() const;
  578. /** Returns the response reason-phrase string.
  579. @note Only called for responses.
  580. */
  581. string_view
  582. get_reason_impl() const;
  583. /** Returns the chunked Transfer-Encoding setting
  584. */
  585. bool
  586. get_chunked_impl() const;
  587. /** Returns the keep-alive setting
  588. */
  589. bool
  590. get_keep_alive_impl(unsigned version) const;
  591. /** Returns `true` if the Content-Length field is present.
  592. */
  593. bool
  594. has_content_length_impl() const;
  595. /** Set or clear the method string.
  596. @note Only called for requests.
  597. */
  598. void
  599. set_method_impl(string_view s);
  600. /** Set or clear the target string.
  601. @note Only called for requests.
  602. */
  603. void
  604. set_target_impl(string_view s);
  605. /** Set or clear the reason string.
  606. @note Only called for responses.
  607. */
  608. void
  609. set_reason_impl(string_view s);
  610. /** Adjusts the chunked Transfer-Encoding value
  611. */
  612. void
  613. set_chunked_impl(bool value);
  614. /** Sets or clears the Content-Length field
  615. */
  616. void
  617. set_content_length_impl(
  618. boost::optional<std::uint64_t> const& value);
  619. /** Adjusts the Connection field
  620. */
  621. void
  622. set_keep_alive_impl(
  623. unsigned version, bool keep_alive);
  624. private:
  625. template<class OtherAlloc>
  626. friend class basic_fields;
  627. element*
  628. try_create_new_element(
  629. field name,
  630. string_view sname,
  631. string_view value,
  632. error_code& ec);
  633. element&
  634. new_element(
  635. field name,
  636. string_view sname,
  637. string_view value);
  638. void
  639. insert_element(element& e);
  640. void
  641. delete_element(element& e);
  642. void
  643. set_element(element& e);
  644. void
  645. realloc_string(string_view& dest, string_view s);
  646. void
  647. realloc_target(
  648. string_view& dest, string_view s);
  649. template<class OtherAlloc>
  650. void
  651. copy_all(basic_fields<OtherAlloc> const&);
  652. void
  653. clear_all();
  654. void
  655. delete_list();
  656. void
  657. move_assign(basic_fields&, std::true_type);
  658. void
  659. move_assign(basic_fields&, std::false_type);
  660. void
  661. copy_assign(basic_fields const&, std::true_type);
  662. void
  663. copy_assign(basic_fields const&, std::false_type);
  664. void
  665. swap(basic_fields& other, std::true_type);
  666. void
  667. swap(basic_fields& other, std::false_type);
  668. set_t set_;
  669. list_t list_;
  670. string_view method_;
  671. string_view target_or_reason_;
  672. };
  673. #if BOOST_BEAST_DOXYGEN
  674. /// A typical HTTP header fields container
  675. using fields = basic_fields<std::allocator<char>>;
  676. #endif
  677. } // http
  678. } // beast
  679. } // boost
  680. #include <boost/beast/http/impl/fields.hpp>
  681. #endif