rfc7230.hpp 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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_DETAIL_RFC7230_HPP
  10. #define BOOST_BEAST_HTTP_DETAIL_RFC7230_HPP
  11. #include <boost/beast/core/string.hpp>
  12. #include <cstdint>
  13. #include <iterator>
  14. #include <utility>
  15. namespace boost {
  16. namespace beast {
  17. namespace http {
  18. namespace detail {
  19. BOOST_BEAST_DECL
  20. bool
  21. is_digit(char c);
  22. BOOST_BEAST_DECL
  23. char
  24. is_alpha(char c);
  25. BOOST_BEAST_DECL
  26. char
  27. is_text(char c);
  28. BOOST_BEAST_DECL
  29. char
  30. is_token_char(char c);
  31. BOOST_BEAST_DECL
  32. char
  33. is_qdchar(char c);
  34. BOOST_BEAST_DECL
  35. char
  36. is_qpchar(char c);
  37. // converts to lower case,
  38. // returns 0 if not a valid text char
  39. //
  40. BOOST_BEAST_DECL
  41. char
  42. to_value_char(char c);
  43. // VFALCO TODO Make this return unsigned?
  44. BOOST_BEAST_DECL
  45. std::int8_t
  46. unhex(char c);
  47. BOOST_BEAST_DECL
  48. string_view
  49. trim(string_view s);
  50. struct param_iter
  51. {
  52. using iter_type = string_view::const_iterator;
  53. iter_type it;
  54. iter_type first;
  55. iter_type last;
  56. std::pair<string_view, string_view> v;
  57. bool
  58. empty() const
  59. {
  60. return first == it;
  61. }
  62. BOOST_BEAST_DECL
  63. void
  64. increment();
  65. };
  66. /*
  67. #token = [ ( "," / token ) *( OWS "," [ OWS token ] ) ]
  68. */
  69. struct opt_token_list_policy
  70. {
  71. using value_type = string_view;
  72. BOOST_BEAST_DECL
  73. bool
  74. operator()(value_type& v,
  75. char const*& it, string_view s) const;
  76. };
  77. } // detail
  78. } // http
  79. } // beast
  80. } // boost
  81. #ifdef BOOST_BEAST_HEADER_ONLY
  82. #include <boost/beast/http/detail/rfc7230.ipp>
  83. #endif
  84. #endif