basic_parser.ipp 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870
  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_IMPL_BASIC_PARSER_IPP
  10. #define BOOST_BEAST_HTTP_IMPL_BASIC_PARSER_IPP
  11. #include <boost/beast/http/basic_parser.hpp>
  12. #include <boost/beast/http/error.hpp>
  13. #include <boost/beast/http/rfc7230.hpp>
  14. #include <boost/beast/core/buffer_traits.hpp>
  15. #include <boost/beast/core/detail/clamp.hpp>
  16. #include <boost/beast/core/detail/config.hpp>
  17. #include <boost/beast/core/detail/string.hpp>
  18. #include <boost/asio/buffer.hpp>
  19. #include <algorithm>
  20. #include <utility>
  21. namespace boost {
  22. namespace beast {
  23. namespace http {
  24. template<bool isRequest>
  25. bool
  26. basic_parser<isRequest>::
  27. keep_alive() const
  28. {
  29. BOOST_ASSERT(is_header_done());
  30. if(f_ & flagHTTP11)
  31. {
  32. if(f_ & flagConnectionClose)
  33. return false;
  34. }
  35. else
  36. {
  37. if(! (f_ & flagConnectionKeepAlive))
  38. return false;
  39. }
  40. return (f_ & flagNeedEOF) == 0;
  41. }
  42. template<bool isRequest>
  43. boost::optional<std::uint64_t>
  44. basic_parser<isRequest>::
  45. content_length() const
  46. {
  47. BOOST_ASSERT(is_header_done());
  48. if(! (f_ & flagContentLength))
  49. return boost::none;
  50. return len0_;
  51. }
  52. template<bool isRequest>
  53. boost::optional<std::uint64_t>
  54. basic_parser<isRequest>::
  55. content_length_remaining() const
  56. {
  57. BOOST_ASSERT(is_header_done());
  58. if(! (f_ & flagContentLength))
  59. return boost::none;
  60. return len_;
  61. }
  62. template<bool isRequest>
  63. void
  64. basic_parser<isRequest>::
  65. skip(bool v)
  66. {
  67. BOOST_ASSERT(! got_some());
  68. if(v)
  69. f_ |= flagSkipBody;
  70. else
  71. f_ &= ~flagSkipBody;
  72. }
  73. template<bool isRequest>
  74. std::size_t
  75. basic_parser<isRequest>::
  76. put(net::const_buffer buffer,
  77. error_code& ec)
  78. {
  79. BOOST_ASSERT(state_ != state::complete);
  80. auto p = static_cast<char const*>(buffer.data());
  81. auto n = buffer.size();
  82. auto const p0 = p;
  83. auto const p1 = p0 + n;
  84. ec = {};
  85. loop:
  86. switch(state_)
  87. {
  88. case state::nothing_yet:
  89. if(n == 0)
  90. {
  91. ec = error::need_more;
  92. return 0;
  93. }
  94. state_ = state::start_line;
  95. BOOST_FALLTHROUGH;
  96. case state::start_line:
  97. {
  98. maybe_need_more(p, n, ec);
  99. if(ec)
  100. goto done;
  101. parse_start_line(p, p + (std::min<std::size_t>)(
  102. header_limit_, n), ec, is_request{});
  103. if(ec)
  104. {
  105. if(ec == error::need_more)
  106. {
  107. if(n >= header_limit_)
  108. {
  109. ec = error::header_limit;
  110. goto done;
  111. }
  112. if(p + 3 <= p1)
  113. skip_ = static_cast<
  114. std::size_t>(p1 - p - 3);
  115. }
  116. goto done;
  117. }
  118. BOOST_ASSERT(! is_done());
  119. n = static_cast<std::size_t>(p1 - p);
  120. if(p >= p1)
  121. {
  122. ec = error::need_more;
  123. goto done;
  124. }
  125. BOOST_FALLTHROUGH;
  126. }
  127. case state::fields:
  128. maybe_need_more(p, n, ec);
  129. if(ec)
  130. goto done;
  131. parse_fields(p, p + (std::min<std::size_t>)(
  132. header_limit_, n), ec);
  133. if(ec)
  134. {
  135. if(ec == error::need_more)
  136. {
  137. if(n >= header_limit_)
  138. {
  139. ec = error::header_limit;
  140. goto done;
  141. }
  142. if(p + 3 <= p1)
  143. skip_ = static_cast<
  144. std::size_t>(p1 - p - 3);
  145. }
  146. goto done;
  147. }
  148. finish_header(ec, is_request{});
  149. break;
  150. case state::body0:
  151. BOOST_ASSERT(! skip_);
  152. this->on_body_init_impl(content_length(), ec);
  153. if(ec)
  154. goto done;
  155. state_ = state::body;
  156. BOOST_FALLTHROUGH;
  157. case state::body:
  158. BOOST_ASSERT(! skip_);
  159. parse_body(p, n, ec);
  160. if(ec)
  161. goto done;
  162. break;
  163. case state::body_to_eof0:
  164. BOOST_ASSERT(! skip_);
  165. this->on_body_init_impl(content_length(), ec);
  166. if(ec)
  167. goto done;
  168. state_ = state::body_to_eof;
  169. BOOST_FALLTHROUGH;
  170. case state::body_to_eof:
  171. BOOST_ASSERT(! skip_);
  172. parse_body_to_eof(p, n, ec);
  173. if(ec)
  174. goto done;
  175. break;
  176. case state::chunk_header0:
  177. this->on_body_init_impl(content_length(), ec);
  178. if(ec)
  179. goto done;
  180. state_ = state::chunk_header;
  181. BOOST_FALLTHROUGH;
  182. case state::chunk_header:
  183. parse_chunk_header(p, n, ec);
  184. if(ec)
  185. goto done;
  186. break;
  187. case state::chunk_body:
  188. parse_chunk_body(p, n, ec);
  189. if(ec)
  190. goto done;
  191. break;
  192. case state::complete:
  193. ec = {};
  194. goto done;
  195. }
  196. if(p < p1 && ! is_done() && eager())
  197. {
  198. n = static_cast<std::size_t>(p1 - p);
  199. goto loop;
  200. }
  201. done:
  202. return static_cast<std::size_t>(p - p0);
  203. }
  204. template<bool isRequest>
  205. void
  206. basic_parser<isRequest>::
  207. put_eof(error_code& ec)
  208. {
  209. BOOST_ASSERT(got_some());
  210. if( state_ == state::start_line ||
  211. state_ == state::fields)
  212. {
  213. ec = error::partial_message;
  214. return;
  215. }
  216. if(f_ & (flagContentLength | flagChunked))
  217. {
  218. if(state_ != state::complete)
  219. {
  220. ec = error::partial_message;
  221. return;
  222. }
  223. ec = {};
  224. return;
  225. }
  226. ec = {};
  227. this->on_finish_impl(ec);
  228. if(ec)
  229. return;
  230. state_ = state::complete;
  231. }
  232. template<bool isRequest>
  233. void
  234. basic_parser<isRequest>::
  235. maybe_need_more(
  236. char const* p, std::size_t n,
  237. error_code& ec)
  238. {
  239. if(skip_ == 0)
  240. return;
  241. if( n > header_limit_)
  242. n = header_limit_;
  243. if(n < skip_ + 4)
  244. {
  245. ec = error::need_more;
  246. return;
  247. }
  248. auto const term =
  249. find_eom(p + skip_, p + n);
  250. if(! term)
  251. {
  252. skip_ = n - 3;
  253. if(skip_ + 4 > header_limit_)
  254. {
  255. ec = error::header_limit;
  256. return;
  257. }
  258. ec = error::need_more;
  259. return;
  260. }
  261. skip_ = 0;
  262. }
  263. template<bool isRequest>
  264. void
  265. basic_parser<isRequest>::
  266. parse_start_line(
  267. char const*& in, char const* last,
  268. error_code& ec, std::true_type)
  269. {
  270. /*
  271. request-line = method SP request-target SP HTTP-version CRLF
  272. method = token
  273. */
  274. auto p = in;
  275. string_view method;
  276. parse_method(p, last, method, ec);
  277. if(ec)
  278. return;
  279. string_view target;
  280. parse_target(p, last, target, ec);
  281. if(ec)
  282. return;
  283. int version = 0;
  284. parse_version(p, last, version, ec);
  285. if(ec)
  286. return;
  287. if(version < 10 || version > 11)
  288. {
  289. ec = error::bad_version;
  290. return;
  291. }
  292. if(p + 2 > last)
  293. {
  294. ec = error::need_more;
  295. return;
  296. }
  297. if(p[0] != '\r' || p[1] != '\n')
  298. {
  299. ec = error::bad_version;
  300. return;
  301. }
  302. p += 2;
  303. if(version >= 11)
  304. f_ |= flagHTTP11;
  305. this->on_request_impl(string_to_verb(method),
  306. method, target, version, ec);
  307. if(ec)
  308. return;
  309. in = p;
  310. state_ = state::fields;
  311. }
  312. template<bool isRequest>
  313. void
  314. basic_parser<isRequest>::
  315. parse_start_line(
  316. char const*& in, char const* last,
  317. error_code& ec, std::false_type)
  318. {
  319. /*
  320. status-line = HTTP-version SP status-code SP reason-phrase CRLF
  321. status-code = 3*DIGIT
  322. reason-phrase = *( HTAB / SP / VCHAR / obs-text )
  323. */
  324. auto p = in;
  325. int version = 0;
  326. parse_version(p, last, version, ec);
  327. if(ec)
  328. return;
  329. if(version < 10 || version > 11)
  330. {
  331. ec = error::bad_version;
  332. return;
  333. }
  334. // SP
  335. if(p + 1 > last)
  336. {
  337. ec = error::need_more;
  338. return;
  339. }
  340. if(*p++ != ' ')
  341. {
  342. ec = error::bad_version;
  343. return;
  344. }
  345. parse_status(p, last, status_, ec);
  346. if(ec)
  347. return;
  348. // parse reason CRLF
  349. string_view reason;
  350. parse_reason(p, last, reason, ec);
  351. if(ec)
  352. return;
  353. if(version >= 11)
  354. f_ |= flagHTTP11;
  355. this->on_response_impl(
  356. status_, reason, version, ec);
  357. if(ec)
  358. return;
  359. in = p;
  360. state_ = state::fields;
  361. }
  362. template<bool isRequest>
  363. void
  364. basic_parser<isRequest>::
  365. parse_fields(char const*& in,
  366. char const* last, error_code& ec)
  367. {
  368. string_view name;
  369. string_view value;
  370. // https://stackoverflow.com/questions/686217/maximum-on-http-header-values
  371. beast::detail::char_buffer<max_obs_fold> buf;
  372. auto p = in;
  373. for(;;)
  374. {
  375. if(p + 2 > last)
  376. {
  377. ec = error::need_more;
  378. return;
  379. }
  380. if(p[0] == '\r')
  381. {
  382. if(p[1] != '\n')
  383. ec = error::bad_line_ending;
  384. in = p + 2;
  385. return;
  386. }
  387. parse_field(p, last, name, value, buf, ec);
  388. if(ec)
  389. return;
  390. auto const f = string_to_field(name);
  391. do_field(f, value, ec);
  392. if(ec)
  393. return;
  394. this->on_field_impl(f, name, value, ec);
  395. if(ec)
  396. return;
  397. in = p;
  398. }
  399. }
  400. template<bool isRequest>
  401. void
  402. basic_parser<isRequest>::
  403. finish_header(error_code& ec, std::true_type)
  404. {
  405. // RFC 7230 section 3.3
  406. // https://tools.ietf.org/html/rfc7230#section-3.3
  407. if(f_ & flagSkipBody)
  408. {
  409. state_ = state::complete;
  410. }
  411. else if(f_ & flagContentLength)
  412. {
  413. if(len_ > body_limit_)
  414. {
  415. ec = error::body_limit;
  416. return;
  417. }
  418. if(len_ > 0)
  419. {
  420. f_ |= flagHasBody;
  421. state_ = state::body0;
  422. }
  423. else
  424. {
  425. state_ = state::complete;
  426. }
  427. }
  428. else if(f_ & flagChunked)
  429. {
  430. f_ |= flagHasBody;
  431. state_ = state::chunk_header0;
  432. }
  433. else
  434. {
  435. len_ = 0;
  436. len0_ = 0;
  437. state_ = state::complete;
  438. }
  439. ec = {};
  440. this->on_header_impl(ec);
  441. if(ec)
  442. return;
  443. if(state_ == state::complete)
  444. {
  445. this->on_finish_impl(ec);
  446. if(ec)
  447. return;
  448. }
  449. }
  450. template<bool isRequest>
  451. void
  452. basic_parser<isRequest>::
  453. finish_header(error_code& ec, std::false_type)
  454. {
  455. // RFC 7230 section 3.3
  456. // https://tools.ietf.org/html/rfc7230#section-3.3
  457. if( (f_ & flagSkipBody) || // e.g. response to a HEAD request
  458. status_ / 100 == 1 || // 1xx e.g. Continue
  459. status_ == 204 || // No Content
  460. status_ == 304) // Not Modified
  461. {
  462. // VFALCO Content-Length may be present, but we
  463. // treat the message as not having a body.
  464. // https://github.com/boostorg/beast/issues/692
  465. state_ = state::complete;
  466. }
  467. else if(f_ & flagContentLength)
  468. {
  469. if(len_ > 0)
  470. {
  471. f_ |= flagHasBody;
  472. state_ = state::body0;
  473. if(len_ > body_limit_)
  474. {
  475. ec = error::body_limit;
  476. return;
  477. }
  478. }
  479. else
  480. {
  481. state_ = state::complete;
  482. }
  483. }
  484. else if(f_ & flagChunked)
  485. {
  486. f_ |= flagHasBody;
  487. state_ = state::chunk_header0;
  488. }
  489. else
  490. {
  491. f_ |= flagHasBody;
  492. f_ |= flagNeedEOF;
  493. state_ = state::body_to_eof0;
  494. }
  495. ec = {};
  496. this->on_header_impl(ec);
  497. if(ec)
  498. return;
  499. if(state_ == state::complete)
  500. {
  501. this->on_finish_impl(ec);
  502. if(ec)
  503. return;
  504. }
  505. }
  506. template<bool isRequest>
  507. void
  508. basic_parser<isRequest>::
  509. parse_body(char const*& p,
  510. std::size_t n, error_code& ec)
  511. {
  512. ec = {};
  513. n = this->on_body_impl(string_view{p,
  514. beast::detail::clamp(len_, n)}, ec);
  515. p += n;
  516. len_ -= n;
  517. if(ec)
  518. return;
  519. if(len_ > 0)
  520. return;
  521. this->on_finish_impl(ec);
  522. if(ec)
  523. return;
  524. state_ = state::complete;
  525. }
  526. template<bool isRequest>
  527. void
  528. basic_parser<isRequest>::
  529. parse_body_to_eof(char const*& p,
  530. std::size_t n, error_code& ec)
  531. {
  532. if(n > body_limit_)
  533. {
  534. ec = error::body_limit;
  535. return;
  536. }
  537. body_limit_ = body_limit_ - n;
  538. ec = {};
  539. n = this->on_body_impl(string_view{p, n}, ec);
  540. p += n;
  541. if(ec)
  542. return;
  543. }
  544. template<bool isRequest>
  545. void
  546. basic_parser<isRequest>::
  547. parse_chunk_header(char const*& p0,
  548. std::size_t n, error_code& ec)
  549. {
  550. /*
  551. chunked-body = *chunk last-chunk trailer-part CRLF
  552. chunk = chunk-size [ chunk-ext ] CRLF chunk-data CRLF
  553. last-chunk = 1*("0") [ chunk-ext ] CRLF
  554. trailer-part = *( header-field CRLF )
  555. chunk-size = 1*HEXDIG
  556. chunk-data = 1*OCTET ; a sequence of chunk-size octets
  557. chunk-ext = *( ";" chunk-ext-name [ "=" chunk-ext-val ] )
  558. chunk-ext-name = token
  559. chunk-ext-val = token / quoted-string
  560. */
  561. auto p = p0;
  562. auto const pend = p + n;
  563. char const* eol;
  564. if(! (f_ & flagFinalChunk))
  565. {
  566. if(n < skip_ + 2)
  567. {
  568. ec = error::need_more;
  569. return;
  570. }
  571. if(f_ & flagExpectCRLF)
  572. {
  573. // Treat the last CRLF in a chunk as
  574. // part of the next chunk, so p can
  575. // be parsed in one call instead of two.
  576. if(! parse_crlf(p))
  577. {
  578. ec = error::bad_chunk;
  579. return;
  580. }
  581. }
  582. eol = find_eol(p0 + skip_, pend, ec);
  583. if(ec)
  584. return;
  585. if(! eol)
  586. {
  587. ec = error::need_more;
  588. skip_ = n - 1;
  589. return;
  590. }
  591. skip_ = static_cast<
  592. std::size_t>(eol - 2 - p0);
  593. std::uint64_t size;
  594. if(! parse_hex(p, size))
  595. {
  596. ec = error::bad_chunk;
  597. return;
  598. }
  599. if(size != 0)
  600. {
  601. if(size > body_limit_)
  602. {
  603. ec = error::body_limit;
  604. return;
  605. }
  606. body_limit_ -= size;
  607. auto const start = p;
  608. parse_chunk_extensions(p, pend, ec);
  609. if(ec)
  610. return;
  611. if(p != eol -2 )
  612. {
  613. ec = error::bad_chunk_extension;
  614. return;
  615. }
  616. auto const ext = make_string(start, p);
  617. this->on_chunk_header_impl(size, ext, ec);
  618. if(ec)
  619. return;
  620. len_ = size;
  621. skip_ = 2;
  622. p0 = eol;
  623. f_ |= flagExpectCRLF;
  624. state_ = state::chunk_body;
  625. return;
  626. }
  627. f_ |= flagFinalChunk;
  628. }
  629. else
  630. {
  631. BOOST_ASSERT(n >= 5);
  632. if(f_ & flagExpectCRLF)
  633. BOOST_VERIFY(parse_crlf(p));
  634. std::uint64_t size;
  635. BOOST_VERIFY(parse_hex(p, size));
  636. eol = find_eol(p, pend, ec);
  637. BOOST_ASSERT(! ec);
  638. }
  639. auto eom = find_eom(p0 + skip_, pend);
  640. if(! eom)
  641. {
  642. BOOST_ASSERT(n >= 3);
  643. skip_ = n - 3;
  644. ec = error::need_more;
  645. return;
  646. }
  647. auto const start = p;
  648. parse_chunk_extensions(p, pend, ec);
  649. if(ec)
  650. return;
  651. if(p != eol - 2)
  652. {
  653. ec = error::bad_chunk_extension;
  654. return;
  655. }
  656. auto const ext = make_string(start, p);
  657. this->on_chunk_header_impl(0, ext, ec);
  658. if(ec)
  659. return;
  660. p = eol;
  661. parse_fields(p, eom, ec);
  662. if(ec)
  663. return;
  664. BOOST_ASSERT(p == eom);
  665. p0 = eom;
  666. this->on_finish_impl(ec);
  667. if(ec)
  668. return;
  669. state_ = state::complete;
  670. }
  671. template<bool isRequest>
  672. void
  673. basic_parser<isRequest>::
  674. parse_chunk_body(char const*& p,
  675. std::size_t n, error_code& ec)
  676. {
  677. ec = {};
  678. n = this->on_chunk_body_impl(
  679. len_, string_view{p,
  680. beast::detail::clamp(len_, n)}, ec);
  681. p += n;
  682. len_ -= n;
  683. if(len_ == 0)
  684. state_ = state::chunk_header;
  685. }
  686. template<bool isRequest>
  687. void
  688. basic_parser<isRequest>::
  689. do_field(field f,
  690. string_view value, error_code& ec)
  691. {
  692. using namespace beast::detail::string_literals;
  693. // Connection
  694. if(f == field::connection ||
  695. f == field::proxy_connection)
  696. {
  697. auto const list = opt_token_list{value};
  698. if(! validate_list(list))
  699. {
  700. // VFALCO Should this be a field specific error?
  701. ec = error::bad_value;
  702. return;
  703. }
  704. for(auto const& s : list)
  705. {
  706. if(beast::iequals("close"_sv, s))
  707. {
  708. f_ |= flagConnectionClose;
  709. continue;
  710. }
  711. if(beast::iequals("keep-alive"_sv, s))
  712. {
  713. f_ |= flagConnectionKeepAlive;
  714. continue;
  715. }
  716. if(beast::iequals("upgrade"_sv, s))
  717. {
  718. f_ |= flagConnectionUpgrade;
  719. continue;
  720. }
  721. }
  722. ec = {};
  723. return;
  724. }
  725. // Content-Length
  726. if(f == field::content_length)
  727. {
  728. if(f_ & flagContentLength)
  729. {
  730. // duplicate
  731. ec = error::bad_content_length;
  732. return;
  733. }
  734. if(f_ & flagChunked)
  735. {
  736. // conflicting field
  737. ec = error::bad_content_length;
  738. return;
  739. }
  740. std::uint64_t v;
  741. if(! parse_dec(value, v))
  742. {
  743. ec = error::bad_content_length;
  744. return;
  745. }
  746. ec = {};
  747. len_ = v;
  748. len0_ = v;
  749. f_ |= flagContentLength;
  750. return;
  751. }
  752. // Transfer-Encoding
  753. if(f == field::transfer_encoding)
  754. {
  755. if(f_ & flagChunked)
  756. {
  757. // duplicate
  758. ec = error::bad_transfer_encoding;
  759. return;
  760. }
  761. if(f_ & flagContentLength)
  762. {
  763. // conflicting field
  764. ec = error::bad_transfer_encoding;
  765. return;
  766. }
  767. ec = {};
  768. auto const v = token_list{value};
  769. auto const p = std::find_if(v.begin(), v.end(),
  770. [&](string_view const& s)
  771. {
  772. return beast::iequals("chunked"_sv, s);
  773. });
  774. if(p == v.end())
  775. return;
  776. if(std::next(p) != v.end())
  777. return;
  778. len_ = 0;
  779. f_ |= flagChunked;
  780. return;
  781. }
  782. // Upgrade
  783. if(f == field::upgrade)
  784. {
  785. ec = {};
  786. f_ |= flagUpgrade;
  787. return;
  788. }
  789. ec = {};
  790. }
  791. #ifdef BOOST_BEAST_SOURCE
  792. template class http::basic_parser<true>;
  793. template class http::basic_parser<false>;
  794. #endif
  795. } // http
  796. } // beast
  797. } // boost
  798. #endif