| 109 | } |
| 110 | |
| 111 | ada_really_inline constexpr bool verify_dns_length( |
| 112 | std::string_view input) noexcept { |
| 113 | if (input.back() == '.') { |
| 114 | if (input.size() > 254) return false; |
| 115 | } else if (input.size() > 253) |
| 116 | return false; |
| 117 | |
| 118 | size_t start = 0; |
| 119 | while (start < input.size()) { |
| 120 | auto dot_location = input.find('.', start); |
| 121 | // If not found, it's likely the end of the domain |
| 122 | if (dot_location == std::string_view::npos) dot_location = input.size(); |
| 123 | |
| 124 | auto label_size = dot_location - start; |
| 125 | if (label_size > 63 || label_size == 0) return false; |
| 126 | |
| 127 | start = dot_location + 1; |
| 128 | } |
| 129 | |
| 130 | return true; |
| 131 | } |
| 132 | } // namespace ada::checkers |
| 133 | /* end file src/checkers.cpp */ |
| 134 | /* begin file src/unicode.cpp */ |
no test coverage detected