reg_name_rule.hpp 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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/url
  8. //
  9. #ifndef BOOST_URL_RFC_DETAIL_REG_NAME_RULE_HPP
  10. #define BOOST_URL_RFC_DETAIL_REG_NAME_RULE_HPP
  11. #include <boost/url/detail/config.hpp>
  12. #include <boost/url/rfc/pct_encoded_rule.hpp>
  13. #include <boost/url/rfc/sub_delim_chars.hpp>
  14. #include <boost/url/rfc/unreserved_chars.hpp>
  15. namespace boost {
  16. namespace urls {
  17. namespace detail {
  18. /* VFALCO In theory we could enforce these
  19. additional requirements from errata 4942:
  20. Such a name consists of a sequence of domain
  21. labels separated by ".", each domain label
  22. starting and ending with an alphanumeric character
  23. and possibly also containing "-" characters. The
  24. rightmost domain label of a fully qualified domain
  25. name in DNS may be followed by a single "." and
  26. should be if it is necessary to distinguish between
  27. the complete domain name and some local domain.
  28. */
  29. /** Rule for reg-name
  30. @par BNF
  31. @code
  32. reg-name = *( unreserved / pct-encoded / "-" / ".")
  33. @endcode
  34. @par Specification
  35. @li <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2"
  36. >3.2.2. Host (rfc3986)</a>
  37. @li <a href="https://www.rfc-editor.org/errata/eid4942"
  38. >Errata ID: 4942</a>
  39. */
  40. constexpr auto reg_name_rule =
  41. pct_encoded_rule(unreserved_chars + sub_delim_chars);
  42. } // detail
  43. } // urls
  44. } // boost
  45. #endif