rfc7230.hpp 1.7 KB

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