| 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 | |
| 10 | #ifndef BOOST_URL_RFC_DETAIL_USERINFO_RULE_HPP |
| 11 | #define BOOST_URL_RFC_DETAIL_USERINFO_RULE_HPP |
| 12 | |
| 13 | #include "boost/url/detail/config.hpp" |
| 14 | #include "boost/url/error_types.hpp" |
| 15 | #include "boost/url/pct_string_view.hpp" |
| 16 | |
| 17 | namespace boost { |
| 18 | namespace urls { |
| 19 | namespace detail { |
| 20 | |
| 21 | /** Rule for userinfo |
| 22 | |
| 23 | @par BNF |
| 24 | @code |
| 25 | userinfo = user [ ":" [ password ] ] |
| 26 | |
| 27 | user = *( unreserved / pct-encoded / sub-delims ) |
| 28 | password = *( unreserved / pct-encoded / sub-delims / ":" ) |
| 29 | @endcode |
| 30 | |
| 31 | @par Specification |
| 32 | <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.1" |
| 33 | >3.2.1. User Information (3986)</a> |
| 34 | */ |
| 35 | struct userinfo_rule_t |
| 36 | { |
| 37 | struct value_type |
| 38 | { |
| 39 | pct_string_view user; |
| 40 | pct_string_view password; |
| 41 | bool has_password = false; |
| 42 | }; |
| 43 | |
| 44 | auto |
| 45 | parse( |
| 46 | char const*& it, |
| 47 | char const* end |
| 48 | ) const noexcept -> |
| 49 | system::result<value_type>; |
| 50 | }; |
| 51 | |
| 52 | constexpr userinfo_rule_t userinfo_rule{}; |
| 53 | |
| 54 | } // detail |
| 55 | } // urls |
| 56 | } // boost |
| 57 | |
| 58 | #endif |
| 59 |
